mysqlx.FilterableStatement¶
- class mysqlx.FilterableStatement(target: DatabaseTargetType, doc_based: bool = True, condition: str | None = None)¶
Bases:
StatementA statement to be used with filterable statements.
- Parameters:
target (object) – The target database object, it can be
mysqlx.Collectionormysqlx.Table.doc_based (Optional[bool]) – True if it is document based (default: True).
condition (Optional[str]) – Sets the search condition to filter documents or records.
- bind(*args: Any) FilterableStatement¶
Binds value(s) to a specific placeholder(s).
- Parameters:
*args – The name of the placeholder and the value to bind. A
mysqlx.DbDocobject or a JSON string representation can be used.- Returns:
FilterableStatement object.
- Return type:
- Raises:
ProgrammingError – If the number of arguments is invalid.
- property changed: bool¶
True if this statement has changes.
- Type:
bool
- property deallocate_prepare_execute: bool¶
True to deallocate + prepare + execute statement.
- Type:
bool
- property exec_counter: int¶
The number of times this statement was executed.
- Type:
int
- execute() Any¶
Execute the statement.
- Raises:
NotImplementedError – This method must be implemented.
- get_binding_map() Dict[str, Any]¶
Returns the binding map dictionary.
- Returns:
The binding map dictionary.
- Return type:
dict
- get_bindings() Dict[str, Any] | List¶
Returns the bindings list.
- Returns:
The bindings list.
- Return type:
list
- get_grouping() List[ProtobufMessageType | ProtobufMessageCextType]¶
Returns the grouping expression list.
- Returns:
The grouping expression list.
- Return type:
list
- get_having() MessageType¶
Returns the having expression.
- Returns:
The having expression.
- Return type:
object
- get_limit_offset() int¶
Returns the limit offset.
- Returns:
The limit offset.
- Return type:
int
- get_limit_row_count() int¶
Returns the limit row count.
- Returns:
The limit row count.
- Return type:
int
- get_projection_expr() List[ProtobufMessageType | ProtobufMessageCextType]¶
Returns the projection expression.
- Returns:
The projection expression.
- Return type:
object
- get_sort_expr() List[ProtobufMessageType | ProtobufMessageCextType]¶
Returns the sort expression.
- Returns:
The sort expression.
- Return type:
object
- get_where_expr() MessageType¶
Returns the where expression.
- Returns:
The where expression.
- Return type:
object
- increment_exec_counter() None¶
Increments the number of times this statement has been executed.
- is_doc_based() bool¶
Check if it is document based.
- Returns:
True if it is document based.
- Return type:
bool
- limit(row_count: int, offset: int | None = None) FilterableStatement¶
Sets the maximum number of items to be returned.
- Parameters:
row_count (int) – The maximum number of items.
- Returns:
FilterableStatement object.
- Return type:
- Raises:
ValueError – If
row_countis not a positive integer.
Changed in version 8.0.12: The usage of
offsetwas deprecated.
- offset(offset: int) FilterableStatement¶
Sets the number of items to skip.
- Parameters:
offset (int) – The number of items to skip.
- Returns:
FilterableStatement object.
- Return type:
- Raises:
ValueError – If
offsetis not a positive integer.
New in version 8.0.12.
- property prepared: bool¶
True if this statement has been prepared.
- Type:
bool
- property repeated: bool¶
True if this statement was executed more than once.
- Type:
bool
- reset_exec_counter() None¶
Resets the number of times this statement has been executed.
- property schema: SchemaType¶
The Schema object.
- Type:
- sort(*clauses: str) FilterableStatement¶
Sets the sorting criteria.
- Parameters:
*clauses – The expression strings defining the sort criteria.
- Returns:
FilterableStatement object.
- Return type:
Deprecated since version 8.0.12.
- property stmt_id: int¶
Returns this statement ID.
- Returns:
The statement ID.
- Return type:
int
- property target: DatabaseTargetType¶
The database object target.
- Type:
object
- where(condition: str) FilterableStatement¶
Sets the search condition to filter.
- Parameters:
condition (str) – Sets the search condition to filter documents or records.
- Returns:
FilterableStatement object.
- Return type:
Deprecated since version 8.0.12.