- Notifications
You must be signed in to change notification settings - Fork6
Reindexer's python connector
License
Restream/reindexer-py
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The PyReindexer module provides a connector and its auxiliary tools for interaction with Reindexer. Reindexer static library or reindexer-dev package must be installed
- The PyReindexer module provides a connector and its auxiliary tools for interaction with Reindexer. Reindexer static library or reindexer-dev package must be installed
- pyreindexer.rx_connector
- RxConnector Objects
- Arguments
- Attributes
- RxConnector.close
- RxConnector.namespace_open
- RxConnector.namespace_close
- RxConnector.namespace_drop
- RxConnector.namespaces_enum
- RxConnector.index_add
- RxConnector.index_update
- RxConnector.index_drop
- RxConnector.item_insert
- RxConnector.item_update
- RxConnector.item_upsert
- RxConnector.item_delete
- RxConnector.meta_put
- RxConnector.meta_get
- RxConnector.meta_delete
- RxConnector.meta_enum
- RxConnector.exec_sql
- RxConnector.new_transaction
- RxConnector.new_query
- RxConnector Objects
- pyreindexer.query_results
- pyreindexer.transaction
- pyreindexer.point
- pyreindexer.query
- Query Objects
- Attributes
- Query.where
- Query.where_query
- Query.where_subquery
- Query.where_composite
- Query.where_uuid
- Query.where_between_fields
- Query.where_knn
- Query.where_knn_string
- Query.open_bracket
- Query.close_bracket
- Query.match
- Query.dwithin
- Query.distinct
- Query.aggregate_sum
- Query.aggregate_avg
- Query.aggregate_min
- Query.aggregate_max
- Query.aggregate_facet
- Query.sort
- Query.sort_stpoint_distance
- Query.sort_stfield_distance
- Query.op_and
- Query.op_or
- Query.op_not
- Query.request_total
- Query.cached_total
- Query.limit
- Query.offset
- Query.debug
- Query.strict
- Query.explain
- Query.with_rank
- Query.execute
- Query.delete
- Query.set_object
- Query.set
- Query.drop
- Query.expression
- Query.update
- Query.must_execute
- Query.get
- Query.inner_join
- Query.join
- Query.left_join
- Query.merge
- Query.on
- Query.select_fields
- Query.functions
- Query.equal_position
- Query Objects
- pyreindexer.index_search_params
- pyreindexer.index_definition
classRxConnector(RaiserMixin)
RxConnector provides a binding to Reindexer upon two shared libraries (hereinafter - APIs): 'rawpyreindexerb.so'and 'rawpyreindexerc.so'. The first one is aimed at built-in usage. That API embeds Reindexer, so it couldbe used right in-place as is. The second one acts as a lightweight client which establishes a connection toReindexer server via RPC. The APIs interfaces are completely the same.
dsn (string): The connection string which contains a protocol Examples: 'builtin:///tmp/pyrx', 'cproto://127.0.0.1:6534/pyrx' cproto options: fetch_amount (int): The number of items that will be fetched by one operation reconnect_attempts (int): Number of reconnection attempts when connection is lost net_timeout (`datetime.timedelta`): Connection and database login timeout value [milliseconds] enable_compression (bool): Flag enable/disable traffic compression start_special_thread (bool): Determines whether to request a special thread of execution on the server for this connection client_name (string): Proper name of the application (as a client for Reindexer-server) sync_rxcoro_count (int): Client concurrency per connection [1..10'000], default 10 built-in options: max_replication_updates_size (int): Max pended replication updates size in bytes allocator_cache_limit (int): Recommended maximum free cache size of tcmalloc memory allocator in bytes allocator_cache_part (float): Recommended maximum free cache size of tcmalloc memory allocator in relation to total Reindexer allocated memory size, in unitsapi (module): An API module loaded dynamically for Reindexer callsrx (int): A memory pointer to the Reindexer instanceerr_code (int): The API error codeerr_msg (string): The API error messagedefclose()->None
Closes the API instance and frees Reindexer resources
ConnectionError: Raises with an error message when Reindexer instance is not initialized yetdefnamespace_open(namespace:str,timeout:timedelta=timedelta(milliseconds=0))->None
Opens a namespace specified or creates a namespace if it does not exist
namespace (string): The name of the namespacetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefnamespace_close(namespace:str,timeout:timedelta=timedelta(milliseconds=0))->None
Closes the specified namespace
namespace (string): The name of the namespacetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefnamespace_drop(namespace:str,timeout:timedelta=timedelta(milliseconds=0))->None
Drops the specified namespace
namespace (string): The name of the namespacetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)Exception: Raises with an error message when Reindexer instance is not initialized yetException: Raises with an error message of API return on non-zero error codedefnamespaces_enum(enum_not_opened:bool=False,timeout:timedelta=timedelta(milliseconds=0))->List[Dict[str,str]]
Gets a list of namespaces available
enum_not_opened (bool, optional): An enumeration mode flag. If it is set then closed namespaces are in result list too. Defaults to Falsetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`list` of :obj:`dict`): A list of dictionaries which describe each namespaceConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefindex_add(namespace:str,index_def:Dict,timeout:timedelta=timedelta(milliseconds=0))->None
Adds an index to the specified namespace
namespace (string): The name of the namespaceindex_def (dict): A dictionary of index definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefindex_update(namespace:str,index_def:Dict,timeout:timedelta=timedelta(milliseconds=0))->None
Updates an index in the specified namespace
namespace (string): The name of the namespaceindex_def (dict): A dictionary of index definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefindex_drop(namespace:str,index_name:str,timeout:timedelta=timedelta(milliseconds=0))->None
Drops an index from the specified namespace
namespace (string): The name of the namespaceindex_name (string): A name of an indextimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefitem_insert(namespace:str,item_def:Dict,precepts:List[str]=None,timeout:timedelta=timedelta(milliseconds=0))->None
Inserts an item with its precepts into the specified namespace
namespace (string): The name of the namespaceitem_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefitem_update(namespace:str,item_def:Dict,precepts:List[str]=None,timeout:timedelta=timedelta(milliseconds=0))->None
Updates an item with its precepts in the specified namespace
namespace (string): The name of the namespaceitem_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefitem_upsert(namespace:str,item_def:Dict,precepts:List[str]=None,timeout:timedelta=timedelta(milliseconds=0))->None
Updates an item with its precepts in the specified namespace. Creates the item if it does not exist
namespace (string): The name of the namespaceitem_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefitem_delete(namespace:str,item_def:Dict,timeout:timedelta=timedelta(milliseconds=0))->None
Deletes an item from the namespace specified
namespace (string): The name of the namespaceitem_def (dict): A dictionary of item definitiontimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefmeta_put(namespace:str,key:str,value:str,timeout:timedelta=timedelta(milliseconds=0))->None
Puts metadata to a storage of Reindexer by key
namespace (string): The name of the namespacekey (string): A key in a storage of Reindexer for metadata keepingvalue (string): A metadata for storagetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefmeta_get(namespace:str,key:str,timeout:timedelta=timedelta(milliseconds=0))->str
Gets metadata from a storage of Reindexer by key specified
namespace (string): The name of the namespacekey (string): A key in a storage of Reindexer where metadata is kepttimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)string: A metadata valueConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefmeta_delete(namespace:str,key:str,timeout:timedelta=timedelta(milliseconds=0))->None
Deletes metadata from a storage of Reindexer by key specified
namespace (string): The name of the namespacekey (string): A key in a storage of Reindexer where metadata is kepttimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)ConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefmeta_enum(namespace:str,timeout:timedelta=timedelta(milliseconds=0))->List[str]
Gets a list of metadata keys from a storage of Reindexer
namespace (string): The name of the namespacetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`list` of :obj:`str`): A list of all metadata keysConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefexec_sql(query:str,timeout:timedelta=timedelta(milliseconds=0))->QueryResults
Executes an SQL query and returns query results
query (string): An SQL querytimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`QueryResults`): A QueryResults iteratorConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefnew_transaction(namespace:str,timeout:timedelta=timedelta(milliseconds=0))->Transaction
Starts a new transaction and return the transaction object to processing.Warning: once a timeout is set, it will apply to all subsequent steps in the transaction
namespace (string): The name of the namespacetimeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`Transaction`): A new transactionConnectionError: Raises with an error message when Reindexer instance is not initialized yetApiError: Raises with an error message of API return on non-zero error codedefnew_query(namespace:str)->Query
Creates a new query and return the query object to processing
namespace (string): The name of the namespace(:obj:`Query`): A new queryConnectionError: Raises with an error message when Reindexer instance is not initialized yetclassQueryResults()
QueryResults is a disposable iterator of Reindexer results for such queries as SELECT etc.When the results are fetched the iterator closes and frees a memory of results buffer of Reindexer
api (module): An API module for Reindexer callserr_code (int): The API error codeerr_msg (string): The API error messageqres_wrapper_ptr (int): A memory pointer to Reindexer iterator objectqres_iter_count (int): A count of results for iterationspos (int): The current result position in iteratordefstatus()->None
Check status
ApiError: Raises with an error message of API return on non-zero error codedefcount()->int
Returns a count of results for iterations
int: A count of resultsdeftotal_count()->int
Returns a total or cached count of results
int: A total or cached count of resultsdefget_agg_results()->dict
Returns aggregation results for the current query
(:obj:`dict`): Dictionary with all results for the current queryApiError: Raises with an error message of API return on non-zero error codedefget_explain_results()->str
Returns explain results for the current query
(string): Formatted string with explain of results for the current queryApiError: Raises with an error message of API return on non-zero error codeclassTransaction()
An object representing the context of a Reindexer transaction
api (module): An API module for Reindexer callstransaction_wrapper_ptr (int): A memory pointer to Reindexer transaction objecterr_code (int): The API error codeerr_msg (string): The API error messagedefinsert(item_def:Dict,precepts:List[str]=None)->None
Inserts an item with its precepts to the transactionWarning: the timeout set when the transaction was created is used
item_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitionTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefupdate(item_def:Dict,precepts:List[str]=None)->None
Updates an item with its precepts to the transactionWarning: the timeout set when the transaction was created is used
item_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitionTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefupdate_query(query:Query)->None
Updates items with the transactionRead-committed isolation is available for read operations.Changes made in active transaction is invisible to current and another transactions.
query (:obj:`Query`): A query object to modifyTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefupsert(item_def:Dict,precepts:List[str]=None)->None
Updates an item with its precepts to the transaction. Creates the item if it does not existWarning: the timeout set when the transaction was created is used
item_def (dict): A dictionary of item definitionprecepts (:obj:`list` of :obj:`str`): A dictionary of index definitionTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefdelete(item_def:Dict)->None
Deletes an item from the transactionWarning: the timeout set when the transaction was created is used
item_def (dict): A dictionary of item definitionTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefdelete_query(query:Query)
Deletes items with the transactionRead-committed isolation is available for read operations.Changes made in active transaction is invisible to current and another transactions.
query (:obj:`Query`): A query object to modifyTransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefcommit(timeout:timedelta=timedelta(milliseconds=0))->None
Applies changes
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)TransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefcommit_with_count(timeout:timedelta=timedelta(milliseconds=0))->int
Applies changes and return the number of count of changed items
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)TransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codedefrollback(timeout:timedelta=timedelta(milliseconds=0))->None
Rollbacks changes
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)TransactionError: Raises with an error message of API return if Transaction is overApiError: Raises with an error message of API return on non-zero error codeclassPoint()
An object representing the context of a Reindexer 2D point
x (float): x coordinate of the pointy (float): y coordinate of the pointclassQuery()
An object representing the context of a Reindexer query
api (module): An API module for Reindexer callsquery_wrapper_ptr (int): A memory pointer to Reindexer query objecterr_code (int): The API error codeerr_msg (string): The API error messageroot (:object: Optional[`Query`]): The root query of the Reindexer queryjoin_queries (list[:object:`Query`]): The list of join Reindexer query objectsmerged_queries (list[:object:`Query`]): The list of merged Reindexer query objectsdefwhere(index:str,condition:CondType,keys:Union[simple_types,tuple[list[simple_types], ...]]=None)->Query
Adds where condition to DB query with args
index (string): Field name used in condition clausecondition (:enum:`CondType`): Type of conditionkeys (union[simple_types, (list[simple_types], ...)]): Value of index to be compared with. For composite indexes keys must be list, with value of each sub-index(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefwhere_query(sub_query:Query,condition:CondType,keys:Union[simple_types,tuple[list[simple_types], ...]]=None)->Query
Adds sub-query where condition to DB query with args
sub_query (:obj:`Query`): Field name used in condition clausecondition (:enum:`CondType`): Type of conditionkeys (union[simple_types, (list[simple_types], ...)]): Value of index to be compared with. For composite indexes keys must be list, with value of each sub-index(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefwhere_subquery(index:str,condition:CondType,sub_query:Query)->Query
Adds sub-query where condition to DB query
index (string): Field name used in condition clausecondition (:enum:`CondType`): Type of conditionsub_query (:obj:`Query`): Field name used in condition clause(:obj:`Query`): Query object for further customizationsdefwhere_composite(index:str,condition:CondType,keys:tuple[list[simple_types], ...])->Query
Adds where condition to DB query with interface args for composite indexes
index (string): Field name used in condition clausecondition (:enum:`CondType`): Type of conditionkeys (list[simple_types], ...): Values of composite index to be compared with (value of each sub-index). Supported variants: ([1, "test1"], [2, "test2"]) [[1, "test1"], [2, "test2"]]) ([1, "testval1"], ) [[1, "testval1"]] (1, "testval1")(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefwhere_uuid(index:str,condition:CondType,*uuids:UUID)->Query
Adds where condition to DB query with UUID.index MUST be declared as uuid-string index in this case
index (string): Field name used in condition clausecondition (:enum:`CondType`): Type of conditionuuids (*:obj:`UUID`): Value of index to be compared with. For composite indexes uuids must be list, with value of each sub-index(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefwhere_between_fields(first_field:str,condition:CondType,second_field:str)->Query
Adds comparing two fields where condition to DB query
first_field (string): First field name used in condition clausecondition (:enum:`CondType`): Type of conditionsecond_field (string): Second field name used in condition clause(:obj:`Query`): Query object for further customizationsdefwhere_knn(index:str,vec:List[float],param:Union[IndexSearchParamBruteForce|IndexSearchParamHnsw|IndexSearchParamIvf])->Query
Adds where condition to DB query with float_vector as args.index MUST be declared as float_vector index in this case
index (string): Field name used in condition clause (only float_vector)vec (list[float]): KNN value of index to be compared withparam (:obj:`union[IndexSearchParamBruteForce|IndexSearchParamHnsw|IndexSearchParamIvf]`): KNN search parameters(:obj:`Query`): Query object for further customizationsQueryError: Raises with an error message if no vec are specifiedQueryError: Raises with an error message if no param are specified or have an invalid valueApiError: Raises with an error message of API return on non-zero error codedefwhere_knn_string(index:str,value:str,param:Union[IndexSearchParamBruteForce|IndexSearchParamHnsw|IndexSearchParamIvf])->Query
Adds where condition to DB query with string as args.index MUST be declared as float_vector index in this case.WARNING: Only relevant if automatic embedding is configured for this float_vector index
index (string): Field name used in condition clause (only float_vector)value (string): value to be generated using automatic embedding of KNN index value to be compared toparam (:obj:`union[IndexSearchParamBruteForce|IndexSearchParamHnsw|IndexSearchParamIvf]`): KNN search parameters(:obj:`Query`): Query object for further customizationsQueryError: Raises with an error message if no value are specifiedQueryError: Raises with an error message if no param are specified or have an invalid valueApiError: Raises with an error message of API return on non-zero error codedefopen_bracket()->Query
Opens bracket for where condition to DB query
(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefclose_bracket()->Query
Closes bracket for where condition to DB query
(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefmatch(index:str,*keys:str)->Query
Adds string EQ-condition to DB query with string args
index (string): Field name used in condition clausekeys (*string): Value of index to be compared with. For composite indexes keys must be list, with value of each sub-index(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefdwithin(index:str,point:Point,distance:float)->Query
Adds DWithin condition to DB query
index (string): Field name used in condition clausepoint (:obj:`Point`): Point object used in condition clausedistance (float): Distance in meters between point(:obj:`Query`): Query object for further customizationsdefdistinct(index:str)->Query
Performs distinct for a certain index. Return only items with uniq value of field
index (string): Field name for distinct operation(:obj:`Query`): Query object for further customizationsdefaggregate_sum(index:str)->Query
Performs a summation of values for a specified index
index (string): Field name for sum operation(:obj:`Query`): Query object for further customizationsdefaggregate_avg(index:str)->Query
Finds for the average at the specified index
index (string): Field name for sum operation(:obj:`Query`): Query object for further customizationsdefaggregate_min(index:str)->Query
Finds for the minimum at the specified index
index (string): Field name for sum operation(:obj:`Query`): Query object for further customizationsdefaggregate_max(index:str)->Query
Finds for the maximum at the specified index
index (string): Field name for sum operation(:obj:`Query`): Query object for further customizationsdefaggregate_facet(*fields:str)->Query._AggregateFacet
Gets fields facet value. Applicable to multiple data fields and the result of that could be sortedby any data column orcount and cut off by offset and limit. In order to support this functionalitythis method returns AggregationFacetRequest which has methods sort, limit and offset
fields (*string): Fields any data column name or `count`, fields should not be empty(:obj:`_AggregateFacet`): Request object for further customizationsdefsort(index:str,desc:bool=False,forced_sort_values:Union[simple_types,tuple[list[simple_types], ...]]=None)->Query
Applies sort order to return from query items. If forced_sort_values argument specified, then items equal tovalues, if found will be placed in the top positions. Forced sort is support for the first sorting fieldonly
index (string): The index namedesc (bool): Sort in descending orderforced_sort_values (union[simple_types, (list[simple_types], ...)]): Value of index to match. For composite indexes keys must be list, with value of each sub-index(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefsort_stpoint_distance(index:str,point:Point,desc:bool)->Query
Applies geometry sort order to return from query items. Wrapper for geometry sorting by shortest distancebetween geometry field and point (ST_Distance)
index (string): The index namepoint (:obj:`Point`): Point object used in sorting operationdesc (bool): Sort in descending order(:obj:`Query`): Query object for further customizationsdefsort_stfield_distance(first_field:str,second_field:str,desc:bool)->Query
Applies geometry sort order to return from query items. Wrapper for geometry sorting by shortest distancebetween 2 geometry fields (ST_Distance)
first_field (string): First field name used in conditionsecond_field (string): Second field name used in conditiondesc (bool): Sort in descending order(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefop_and()->Query
Next condition will be added with AND.This is the default operation for WHERE statement. Do not have to be called explicitly in user's code.Used in DSL conversion
(:obj:`Query`): Query object for further customizationsdefop_or()->Query
Next condition will be added with OR.Implements short-circuiting:if the previous condition is successful the next will not be evaluated, but except Join conditions
(:obj:`Query`): Query object for further customizationsdefop_not()->Query
Next condition will be added with NOT AND.Implements short-circuiting: if the previous condition is failed the next will not be evaluated
(:obj:`Query`): Query object for further customizationsdefrequest_total()->Query
Requests total items calculation
total_name (string, optional): Name to be requested(:obj:`Query`): Query object for further customizationsdefcached_total()->Query
Requests cached total items calculation
total_name (string, optional): Name to be requested(:obj:`Query`): Query object for further customizationsdeflimit(limit_items:int)->Query
Sets a limit (count) of returned items. Analog to sql LIMIT rowsNumber
limit_items (int): Number of rows to get from result set(:obj:`Query`): Query object for further customizationsdefoffset(start_offset:int)->Query
Sets the number of the first selected row from result query
limit_items (int): Index of the first row to get from result set(:obj:`Query`): Query object for further customizationsdefdebug(level:LogLevel)->Query
Changes debug log level on server
level (:enum:`LogLevel`): Debug log level on server(:obj:`Query`): Query object for further customizationsdefstrict(mode:StrictMode)->Query
Changes strict mode
mode (:enum:`StrictMode`): Strict mode(:obj:`Query`): Query object for further customizationsdefexplain()->Query
Enables explain query
(:obj:`Query`): Query object for further customizationsdefwith_rank()->Query
Outputs fulltext/float_vector rank. Allowed only with fulltext and KNN query
(:obj:`Query`): Query object for further customizationsdefexecute(timeout:timedelta=timedelta(milliseconds=0))->QueryResults
Executes a select query
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`QueryResults`): A QueryResults iteratorApiError: Raises with an error message when query is in an invalid stateApiError: Raises with an error message of API return on non-zero error codedefdelete(timeout:timedelta=timedelta(milliseconds=0))->int
Executes a query, and delete items, matches query
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(int): Number of deleted elementsQueryError: Raises with an error message when query is in an invalid stateApiError: Raises with an error message of API return on non-zero error codedefset_object(field:str,values:list[simple_types])->Query
Adds an update query to an object field for an update query
field (string): Field namevalues (list[simple_types]): List of values to add(:obj:`Query`): Query object for further customizationsQueryError: Raises with an error message if no values are specifiedApiError: Raises with an error message of API return on non-zero error codedefset(field:str,values:list[simple_types])->Query
Adds a field update request to the update request
field (string): Field namevalues (list[simple_types]): List of values to add(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefdrop(index:str)->Query
Drops a value for a field
index (string): Field name for drop operation(:obj:`Query`): Query object for further customizationsdefexpression(field:str,value:str)->Query
Updates indexed field by arithmetical expression
field (string): Field namevalue (string): New value expression for field(:obj:`Query`): Query object for further customizationsdefupdate(timeout:timedelta=timedelta(milliseconds=0))->QueryResults
Executes update query, and update fields in items, which matches query
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`QueryResults`): A QueryResults iteratorQueryError: Raises with an error message when query is in an invalid stateApiError: Raises with an error message of API return on non-zero error codedefmust_execute(timeout:timedelta=timedelta(milliseconds=0))->QueryResults
Executes a query, and update fields in items, which matches query, with status check
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:obj:`QueryResults`): A QueryResults iteratorApiError: Raises with an error message when query is in an invalid stateApiError: Raises with an error message of API return on non-zero error codedefget(timeout:timedelta=timedelta(milliseconds=0))-> (str,bool)
Executes a query, and return 1 JSON item
timeout (`datetime.timedelta`): Optional timeout for performing a server-side operation. Minimum is 1 millisecond; if set to a lower value, it corresponds to disabling the timeout. A value of 0 disables the timeout (default value)(:tuple:string,bool): 1st string item and found flagApiError: Raises with an error message when query is in an invalid stateApiError: Raises with an error message of API return on non-zero error codedefinner_join(query:Query,field:str)->Query
Joins 2 queries.Items from the 1-st query are filtered by and expanded with the data from the 2-nd query
query (:obj:`Query`): Query object to left joinfield (string): Joined field name. As unique identifier for the join between this query and `join_query`. Parameter in order for InnerJoin to work: namespace of `query` contains `field` as one of its fields marked as `joined`(:obj:`Query`): Query object for further customizationsdefjoin(query:Query,field:str)->Query
Join is an alias for LeftJoin. Joins 2 queries.Items from this query are expanded with the data from thequery
query (:obj:`Query`): Query object to left joinfield (string): Joined field name. As unique identifier for the join between this query and `join_query`(:obj:`Query`): Query object for further customizationsdefleft_join(join_query:Query,field:str)->Query
Joins 2 queries.Items from this query are expanded with the data from the join_query.One of the conditions below must hold forfield parameter in order for LeftJoin to work:namespace ofjoin_query containsfield as one of its fields marked asjoined
query (:obj:`Query`): Query object to left joinfield (string): Joined field name. As unique identifier for the join between this query and `join_query`(:obj:`Query`): Query object for further customizationsdefmerge(query:Query)->Query
Merges queries of the same type
query (:obj:`Query`): Query object to merge(:obj:`Query`): Query object for further customizationsdefon(index:str,condition:CondType,join_index:str)->Query
On specifies join condition
index (string): Field name from `Query` namespace should be used during joincondition (:enum:`CondType`): Type of condition, specifies how `Query` will be joined with the latest join query issued on `Query` (e.g. `EQ`/`GT`/`SET`/...)join_index (string): Index-field name from namespace for the latest join query issued on `Query` should be used during join(:obj:`Query`): Query object for further customizationsQueryError: Raises with an error message when query is in an invalid statedefselect_fields(*fields:str)->Query
Sets list of columns in this namespace to be finally selected.The columns should be specified in the same case as the jsonpaths corresponding to them.Non-existent fields and fields in the wrong case are ignored.If there are no fields in this list that meet these conditions, then the filter works as "*"
fields (*string): List of columns to be selected(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedeffunctions(*functions:str)->Query
Adds sql-functions to query
functions (*string): Functions declaration(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codedefequal_position(*equal_position:str)->Query
Adds equal position fields to arrays queries
equal_poses (*string): Equal position fields to arrays queries(:obj:`Query`): Query object for further customizationsApiError: Raises with an error message of API return on non-zero error codeclassIndexSearchParamBruteForce()
Index search param for brute force index. Equal to basic parameters
k (int): Expected size of KNN index results. Should not be less than 1radius (float): In addition to the parameter `k`, the query results can also be filtered by a `rank` - value using the parameter, witch called `radius`. It's named so because, under the `L2`-metric, it restricts vectors from query result to a sphere of the specified radius. [More about `radius`] (https://github.com/Restream/reindexer/blob/master/float_vector.md)classIndexSearchParamHnsw()
Index search param for HNSW index.
k (int): Expected size of KNN index results. Should not be less than 1ef (int): Size of nearest neighbor buffer that will be filled during fetching. Should not be less than 'k',good story when `ef` ~= 1.5 * `k`radius (float): In addition to the parameter `k`, the query results can also be filtered by a `rank` - value using the parameter, witch called `radius`. It's named so because, under the `L2`-metric, it restricts vectors from query result to a sphere of the specified radius. [More about `radius`] (https://github.com/Restream/reindexer/blob/master/float_vector.md)classIndexSearchParamIvf()
Index search param for IVF index.
k (int): Expected size of KNN index results. Should not be less than 1nprobe (int): Number of centroids that will be scanned in where. Should not be less than 1radius (float): In addition to the parameter `k`, the query results can also be filtered by a `rank` - value using the parameter, witch called `radius`. It's named so because, under the `L2`-metric, it restricts vectors from query result to a sphere of the specified radius. [More about `radius`] (https://github.com/Restream/reindexer/blob/master/float_vector.md)classIndexDefinition(dict)
IndexDefinition is a dictionary subclass which allows to construct and manage indexes more efficiently.NOT IMPLEMENTED YET. USE FIELDS DESCRIPTION ONLY.
name (str): An index name.json_paths (:obj:`list` of :obj:`str`): A name for mapping a value to a json field.field_type (str): A type of field. Possible values are: `int`, `int64`, `double`, `string`, `bool`,`composite`, `float_vector`.index_type (str): An index type. Possible values are: `hash`, `tree`, `text`, `-`, `hnsw`, `vec_bf`, `ivf`.is_pk (bool): True if a field is a primary key.is_array (bool): True if an index is an array.is_dense (bool): True if an index is dense. Reduce the index size. Saves 8 bytes per unique key value for 'hash' and 'tree' index types. For '-' index type saves 4-8 bytes per each element. Useful for indexes with high selectivity, but for tree and hash indexes with low selectivity can seriously decrease update performance.is_no_column (bool): True if allows to disable column subindex. Reduces the index size. Allows to save ~(`stored_type_size` * `namespace_items_count`) bytes, where `stored_type_size` is the size of the type stored in the index, and `namespace_items_count` is the number of items in the namespace. May reduce performance.is_sparse (bool): True if a value of an index may be not presented.collate_mode (str): Sets an order of values by collate mode. Possible values are: `none`, `ascii`, `utf8`, `numeric`, `custom`.sort_order_letters (str): Order for a sort sequence for a custom collate mode.config (dict): A config for a fulltext and float_vector engine.[More about `fulltext`](https://github.com/Restream/reindexer/blob/master/fulltext.md) or[More about `float_vector`](https://github.com/Restream/reindexer/blob/master/float_vector.md).About
Reindexer's python connector
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors11
Uh oh!
There was an error while loading.Please reload this page.