delta_trace_db.query.query

Classes

Query(target, type_[, add_data, ...])

(en) This is a query class for DB operations.

class delta_trace_db.query.query.Query(target: str, type_: EnumQueryType, add_data: List[Dict[str, Any]] | None = None, override_data: Dict[str, Any] | None = None, template: Dict[str, Any] | None = None, query_node: QueryNode | None = None, sort_obj: AbstractSort | None = None, offset: int | None = None, start_after: Dict[str, Any] | None = None, end_before: Dict[str, Any] | None = None, rename_before: str | None = None, rename_after: str | None = None, limit: int | None = None, return_data: bool = False, must_affect_at_least_one: bool = True, serial_key: str | None = None, reset_serial: bool = False, cause: Cause | None = None)

Bases: CloneableFile

(en) This is a query class for DB operations. It is usually built using QueryBuilder or RawQueryBuilder. This class allows you to set the operation target and operation type, as well as specify paging and Track operations by Cause. If you output this class directly to a log on the server side, the log will be a complete history of DB operations.

(ja) DB操作用のクエリクラスです。通常はQueryBuilderまたはRawQueryBuilderを使用して構築されます。 このクラスは、操作対象の設定、操作の種類の設定の他、ページングの指定や Causeによる操作追跡機能を持っています。このクラスをサーバー側でそのままログに出力すると、 そのログは完全なDB操作の履歴になります。

Parameters:
  • target (str) – The collection name in DB.

  • type (EnumQueryType) – The query type.

  • add_data (Optional[List[Dict[str, Any]]]) – Use add type only. Data specified when performing an add operation. Typically, this is assigned the list that results from calling toDict on a subclass of ClonableFile.

  • override_data (Optional[Dict[str, Any]]) – Use update or updateOne type only. This is not a serialized version of the full class, but a dictionary containing only the parameters you want to update.

  • template (Optional[Dict[str, Any]]) – Use conformToTemplate type only. Specify this when changing the structure of the DB class. Fields that do not exist in the existing structure but exist in the template will be added with the template value as the initial value. Fields that do not exist in the template will be deleted.

  • query_node (Optional[QueryNode]) – This is the node object used for the search. You can build queries by combining the various nodes.

  • sort_obj (Optional[AbstractSort]) – An object for sorting the return values. SingleSort or MultiSort can be used. If you set returnData to true, the return values of an update or delete query will be sorted by this object.

  • offset (Optional[int]) – Used only with search or getAll types. An offset for paging support in the front end. This is only valid when sorting is specified, and allows you to specify that the results returned will be from a specific index after sorting.

  • start_after (Optional[Dict[str, Any]]) – Used only with search or getAll types. If you pass in a serialized version of a search result object, the search will return results from objects after that object, and if an offset is specified, it will be ignored. This does not work if there are multiple identical objects because it compares the object values, and is slightly slower than specifying an offset, but it works fine even if new objects are added during the search.

  • end_before (Optional[Dict[str, Any]]) – Used only with search or getAll types. If you pass in a serialized version of a search result object, the search will return results from the object before that one, and any offset or startAfter specified will be ignored. This does not work if there are multiple identical objects because it compares the object values, and is slightly slower than specifying an offset, but it works fine even if new objects are added during the search.

  • rename_before (Optional[str]) – Use rename type only. The old variable name when querying for a rename.

  • rename_after (Optional[str]) – Use rename type only. The new name of the variable when querying for a rename.

  • limit (Optional[int]) – Used only with search or getAll types. The maximum number of search results will be limited to this value. If specified together with offset or startAfter, limit number of objects after the specified object will be returned. If specified together with endBefore, limit number of objects before the specified object will be returned.

  • return_data (bool) – If true, return the changed objs. Not valid for clear, clearAdd and conformToTemplate.

  • must_affect_at_least_one (bool) – If true, the operation will be marked as failed if it affects 0 objects. If the operation is treated as a failure, the isSuccess flag of the returned QueryResult will be set to false.

  • serial_key (Optional[str]) – If not null, the add query will assign a unique serial number (integer value) to the specified key. This value is unique per collection. Note that only variables directly under the class can be specified as keys, not nested fields.

  • reset_serial (bool) – If true, resets the managed serial number to 0 on a clear or clearAdd query.

  • cause (Optional[Cause]) – You can add further parameters such as why this query was made and who made it. This is useful if you have high security requirements or want to run the program autonomously using artificial intelligence. By saving the entire query including this as a log, the DB history is recorded.

className: str = 'Query'
clone() Query

(en) Returns a deep copy of this object.

(ja) このオブジェクトのディープコピーを返します。

classmethod from_dict(src: Dict[str, Any]) Query

(en) Restore this object from the dictionary.

(ja) このオブジェクトを辞書から復元します。

Parameters:

src (Dict[str, Any]) – A dictionary made with to_dict of this class.

Returns:

復元されたオブジェクト

Return type:

CloneableFile

to_dict() Dict[str, Any]

(en) Convert the object to a dictionary. The returned dictionary can only contain primitive types, null, lists or maps with only primitive elements. If you want to include other classes, the target class should inherit from this class and chain calls to_dict.

(ja) このオブジェクトを辞書に変換します。 戻り値の辞書にはプリミティブ型かプリミティブ型要素のみのリスト またはマップ等、そしてNoneのみを含められます。 それ以外のクラスを含めたい場合、対象のクラスもこのクラスを継承し、 to_dictを連鎖的に呼び出すようにしてください。

version: str = '6'