How to use the phoenixdb.avatica.proto.common_pb2.TypedValue function in phoenixdb

To help you get started, we’ve selected a few phoenixdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / phoenix-queryserver / python-phoenixdb / phoenixdb / cursor.py View on Github external
def _transform_parameters(self, parameters):
        typed_parameters = []
        for value, data_type in zip(parameters, self._parameter_data_types):
            field_name, rep, mutate_to, cast_from, is_array = data_type
            typed_value = common_pb2.TypedValue()

            if value is None:
                typed_value.null = True
                typed_value.type = common_pb2.NULL
            else:
                typed_value.null = False
                if is_array:
                    if type(value) in [list, tuple]:
                        for element in value:
                            if mutate_to is not None:
                                element = mutate_to(element)
                            typed_element = common_pb2.TypedValue()
                            if element is None:
                                typed_element.null = True
                            else:
                                typed_element.type = rep
github apache / phoenix / python / phoenixdb / phoenixdb / cursor.py View on Github external
def _transform_parameters(self, parameters):
        typed_parameters = []
        for value, data_type in zip(parameters, self._parameter_data_types):
            field_name, rep, mutate_to, cast_from = data_type
            typed_value = common_pb2.TypedValue()

            if value is None:
                typed_value.null = True
                typed_value.type = common_pb2.NULL
            else:
                typed_value.null = False

                # use the mutator function
                if mutate_to is not None:
                    value = mutate_to(value)

                typed_value.type = rep
                setattr(typed_value, field_name, value)

            typed_parameters.append(typed_value)
        return typed_parameters
github apache / phoenix-queryserver / python-phoenixdb / phoenixdb / cursor.py View on Github external
typed_parameters = []
        for value, data_type in zip(parameters, self._parameter_data_types):
            field_name, rep, mutate_to, cast_from, is_array = data_type
            typed_value = common_pb2.TypedValue()

            if value is None:
                typed_value.null = True
                typed_value.type = common_pb2.NULL
            else:
                typed_value.null = False
                if is_array:
                    if type(value) in [list, tuple]:
                        for element in value:
                            if mutate_to is not None:
                                element = mutate_to(element)
                            typed_element = common_pb2.TypedValue()
                            if element is None:
                                typed_element.null = True
                            else:
                                typed_element.type = rep
                                setattr(typed_element, field_name, element)
                            typed_value.array_value.append(typed_element)
                        typed_value.type = common_pb2.ARRAY
                        typed_value.component_type = rep
                    else:
                        raise ProgrammingError('scalar value specified for array parameter')
                else:
                    if mutate_to is not None:
                        value = mutate_to(value)
                    typed_value.type = rep
                    setattr(typed_value, field_name, value)
github lalinsky / python-phoenixdb / phoenixdb / cursor.py View on Github external
def _transform_parameters(self, parameters):
        typed_parameters = []
        for value, data_type in zip(parameters, self._parameter_data_types):
            field_name, rep, mutate_to, cast_from = data_type
            typed_value = common_pb2.TypedValue()

            if value is None:
                typed_value.null = True
                typed_value.type = common_pb2.NULL
            else:
                typed_value.null = False

                # use the mutator function
                if mutate_to is not None:
                    value = mutate_to(value)

                typed_value.type = rep
                setattr(typed_value, field_name, value)

            typed_parameters.append(typed_value)
        return typed_parameters