class ShardedQuery(Query):
Undocumented
Method | set_shard |
Return a new query, limited to a single shard ID. |
Method | __init__ |
Construct a _query.Query directly. |
Instance Variable | _shard_id |
Undocumented |
Instance Variable | execute_chooser |
Undocumented |
Instance Variable | id_chooser |
Undocumented |
Instance Variable | query_chooser |
Undocumented |
Inherited from Query
:
Method | __clause_element__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | _clone |
Undocumented |
Method | _compile_context |
Undocumented |
Method | _compile_state |
Create an out-of-compiler ORMCompileState object. |
Method | _entity_from_pre_ent_zero |
Undocumented |
Method | _filter_by_zero |
for the filter_by() method, return the target entity for which we will attempt to derive an expression from based on string name. |
Method | _final_statement |
Return the 'final' SELECT statement for this .Query . |
Method | _from_selectable |
Undocumented |
Method | _from_self |
Undocumented |
Method | _get_bind_args |
Undocumented |
Method | _get_condition |
Undocumented |
Method | _get_existing_condition |
Undocumented |
Method | _get_impl |
Undocumented |
Method | _get_options |
Undocumented |
Method | _iter |
Undocumented |
Method | _next_aliased_generation |
Undocumented |
Method | _no_clauseelement_condition |
Undocumented |
Method | _no_criterion_assertion |
Undocumented |
Method | _no_criterion_condition |
Undocumented |
Method | _no_limit_offset |
Undocumented |
Method | _no_statement_condition |
Undocumented |
Method | _only_full_mapper_zero |
Undocumented |
Method | _set_enable_single_crit |
Undocumented |
Method | _set_entities |
Undocumented |
Method | _set_lazyload_from |
Undocumented |
Method | _set_op |
Undocumented |
Method | _set_propagate_attrs |
Undocumented |
Method | _set_select_from |
Undocumented |
Method | _statement_20 |
Undocumented |
Method | _with_compile_options |
Undocumented |
Method | _with_current_path |
indicate that this query applies to objects loaded within a certain path. |
Method | _with_invoke_all_eagers |
Set the 'invoke all eagers' flag which causes joined- and subquery loaders to traverse into already-loaded related objects and collections. |
Method | add_column |
Add a column expression to the list of result columns to be returned. |
Method | add_columns |
Add one or more column expressions to the list of result columns to be returned. |
Method | add_entity |
add a mapped entity to the list of result columns to be returned. |
Method | all |
Return the results represented by this _query.Query as a list. |
Method | as_scalar |
Return the full SELECT statement represented by this _query.Query , converted to a scalar subquery. |
Method | autoflush |
Return a Query with a specific 'autoflush' setting. |
Method | correlate |
Return a .Query construct which will correlate the given FROM clauses to that of an enclosing .Query or ~.expression.select . |
Method | count |
Return a count of rows this the SQL formed by this Query would return. |
Method | cte |
Return the full SELECT statement represented by this _query.Query represented as a common table expression (CTE). |
Method | delete |
Perform a DELETE with an arbitrary WHERE clause. |
Method | distinct |
Apply a DISTINCT to the query and return the newly resulting Query. |
Method | enable_assertions |
Control whether assertions are generated. |
Method | enable_eagerloads |
Control whether or not eager joins and subqueries are rendered. |
Method | except_ |
Produce an EXCEPT of this Query against one or more queries. |
Method | except_all |
Produce an EXCEPT ALL of this Query against one or more queries. |
Method | execution_options |
Set non-SQL options which take effect during execution. |
Method | exists |
A convenience method that turns a query into an EXISTS subquery of the form EXISTS (SELECT 1 FROM ... WHERE ...). |
Method | filter |
Apply the given filtering criterion to a copy of this _query.Query , using SQL expressions. |
Method | filter_by |
Apply the given filtering criterion to a copy of this _query.Query , using keyword expressions. |
Method | first |
Return the first result of this Query or None if the result doesn't contain any row. |
Method | from_self |
return a Query that selects from this Query's SELECT statement. |
Method | from_statement |
Execute the given SELECT statement and return results. |
Method | get |
Return an instance based on the given primary key identifier, or None if not found. |
Method | get_execution_options |
Get the non-SQL options which will take effect during execution. |
Method | group_by |
Apply one or more GROUP BY criterion to the query and return the newly resulting _query.Query . |
Method | having |
Apply a HAVING criterion to the query and return the newly resulting _query.Query . |
Method | instances |
Return an ORM result given a _engine.CursorResult and .QueryContext . |
Method | intersect |
Produce an INTERSECT of this Query against one or more queries. |
Method | intersect_all |
Produce an INTERSECT ALL of this Query against one or more queries. |
Method | join |
No summary |
Method | label |
Return the full SELECT statement represented by this _query.Query , converted to a scalar subquery with a label of the given name. |
Method | limit |
Apply a LIMIT to the query and return the newly resulting Query. |
Method | merge_result |
Merge a result into this _query.Query object's Session. |
Method | offset |
Apply an OFFSET to the query and return the newly resulting Query. |
Method | one |
Return exactly one result or raise an exception. |
Method | one_or_none |
Return at most one result or raise an exception. |
Method | only_return_tuples |
When set to True, the query results will always be a tuple. |
Method | options |
Return a new _query.Query object, applying the given list of mapper options. |
Method | order_by |
Apply one or more ORDER BY criteria to the query and return the newly resulting _query.Query . |
Method | outerjoin |
Create a left outer join against this Query object's criterion and apply generatively, returning the newly resulting Query. |
Method | params |
Add values for bind parameters which may have been specified in filter(). |
Method | populate_existing |
Return a _query.Query that will expire and refresh all instances as they are loaded, or reused from the current .Session . |
Method | reset_joinpoint |
Return a new .Query , where the "join point" has been reset back to the base FROM entities of the query. |
Method | scalar |
Return the first element of the first result or None if no rows present. If multiple rows are returned, raises MultipleResultsFound. |
Method | scalar_subquery |
Return the full SELECT statement represented by this _query.Query , converted to a scalar subquery. |
Method | select_entity_from |
Set the FROM clause of this _query.Query to a core selectable, applying it as a replacement FROM clause for corresponding mapped entities. |
Method | select_from |
Set the FROM clause of this .Query explicitly. |
Method | set_label_style |
Apply column labels to the return value of Query.statement. |
Method | slice |
Computes the "slice" of the _query.Query represented by the given indices and returns the resulting _query.Query . |
Method | subquery |
Return the full SELECT statement represented by this _query.Query , embedded within an _expression.Alias . |
Method | union |
Produce a UNION of this Query against one or more queries. |
Method | union_all |
Produce a UNION ALL of this Query against one or more queries. |
Method | update |
Perform an UPDATE with an arbitrary WHERE clause. |
Method | value |
Return a scalar result corresponding to the given column expression. |
Method | values |
Return an iterator yielding result tuples corresponding to the given list of columns |
Method | where |
A synonym for .Query.filter . |
Method | with_entities |
Return a new _query.Query replacing the SELECT list with the given entities. |
Method | with_for_update |
return a new _query.Query with the specified options for the FOR UPDATE clause. |
Method | with_labels |
Undocumented |
Method | with_parent |
No summary |
Method | with_polymorphic |
Load columns for inheriting classes. |
Method | with_session |
Return a _query.Query that will use the given .Session . |
Method | with_transformation |
Return a new _query.Query object transformed by the given function. |
Method | yield_per |
Yield only count rows at a time. |
Class Variable | _having_criteria |
Undocumented |
Class Variable | _memoized_select_entities |
Undocumented |
Class Variable | _setup_joins |
Undocumented |
Class Variable | load_options |
Undocumented |
Instance Variable | _aliased_generation |
Undocumented |
Instance Variable | _aliased_generation_counter |
Undocumented |
Instance Variable | _auto_correlate |
Undocumented |
Instance Variable | _compile_options |
Undocumented |
Instance Variable | _correlate |
Undocumented |
Instance Variable | _distinct |
Undocumented |
Instance Variable | _distinct_on |
Undocumented |
Instance Variable | _enable_assertions |
Undocumented |
Instance Variable | _execution_options |
Undocumented |
Instance Variable | _for_update_arg |
Undocumented |
Instance Variable | _from_obj |
Undocumented |
Instance Variable | _group_by_clauses |
Undocumented |
Instance Variable | _label_style |
Undocumented |
Instance Variable | _last_joined_entity |
Undocumented |
Instance Variable | _legacy_setup_joins |
Undocumented |
Instance Variable | _limit_clause |
Undocumented |
Instance Variable | _offset_clause |
Undocumented |
Instance Variable | _order_by_clauses |
Undocumented |
Instance Variable | _params |
Undocumented |
Instance Variable | _propagate_attrs |
Undocumented |
Instance Variable | _raw_columns |
Undocumented |
Instance Variable | _statement |
Undocumented |
Instance Variable | _where_criteria |
Undocumented |
Instance Variable | session |
Undocumented |
Property | _current_path |
Undocumented |
Property | _has_row_limiting_clause |
Undocumented |
Property | column_descriptions |
Return metadata about the columns which would be returned by this _query.Query . |
Property | get_label_style |
Retrieve the current label style. |
Property | is_single_entity |
Indicates if this _query.Query returns tuples or single entities. |
Property | lazy_loaded_from |
An .InstanceState that is using this _query.Query for a lazy load operation. |
Property | selectable |
Return the _expression.Select object emitted by this _query.Query . |
Property | statement |
The full SELECT statement represented by this Query. |
Property | whereclause |
A readonly attribute which returns the current WHERE criterion for this Query. |
Inherited from _SelectFromElements
(via Query
):
Method | _iterate_from_elements |
Undocumented |
Inherited from SupportsCloneAnnotations
(via Query
):
Method | _annotate |
return a copy of this ClauseElement with annotations updated by the given dictionary. |
Method | _deannotate |
return a copy of this _expression.ClauseElement with annotations removed. |
Method | _with_annotations |
return a copy of this ClauseElement with annotations replaced by the given dictionary. |
Class Variable | _clone_annotations_traverse_internals |
Undocumented |
Inherited from SupportsAnnotations
(via Query
, SupportsCloneAnnotations
):
Property | _annotations_cache_key |
Undocumented |
Inherited from HasPrefixes
(via Query
):
Method | _setup_prefixes |
Undocumented |
Method | prefix_with |
Add one or more expressions following the statement keyword, i.e. SELECT, INSERT, UPDATE, or DELETE. Generative. |
Class Variable | _has_prefixes_traverse_internals |
Undocumented |
Instance Variable | _prefixes |
Undocumented |
Inherited from HasSuffixes
(via Query
):
Method | _setup_suffixes |
Undocumented |
Method | suffix_with |
Add one or more expressions following the statement as a whole. |
Class Variable | _has_suffixes_traverse_internals |
Undocumented |
Instance Variable | _suffixes |
Undocumented |
Inherited from HasHints
(via Query
):
Method | with_hint |
Add an indexing or other executional context hint for the given selectable to this _expression.Select or other selectable object. |
Method | with_statement_hint |
Add a statement hint to this _expression.Select or other selectable object. |
Class Variable | _has_hints_traverse_internals |
Undocumented |
Class Variable | _hints |
Undocumented |
Class Variable | _statement_hints |
Undocumented |
Inherited from Executable
(via Query
):
Method | _add_context_option |
Add a context option to this statement. |
Method | _set_compile_options |
Assign the compile options to a new value. |
Method | _update_compile_options |
update the _compile_options with new keys. |
Method | execute |
Compile and execute this .Executable . |
Class Variable | _bind |
Undocumented |
Class Variable | _executable_traverse_internals |
Undocumented |
Class Variable | _with_context_options |
Undocumented |
Class Variable | _with_options |
Undocumented |
Class Variable | is_delete |
Undocumented |
Class Variable | is_dml |
Undocumented |
Class Variable | is_insert |
Undocumented |
Class Variable | is_select |
Undocumented |
Class Variable | is_text |
Undocumented |
Class Variable | is_update |
Undocumented |
Class Variable | supports_execution |
Undocumented |
Property | _effective_plugin_target |
Undocumented |
Property | bind |
Returns the _engine.Engine or _engine.Connection to which this .Executable is bound, or None if none found. |
Inherited from StatementRole
(via Query
, Executable
):
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via Query
, Executable
, StatementRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from Generative
(via Query
, Executable
):
Method | _generate |
Undocumented |
Return a new query, limited to a single shard ID.
All subsequent operations with the returned query will be against the single shard regardless of other state.
The shard_id can be passed for a 2.0 style execution to the
bind_arguments dictionary of .Session.execute
:
results = session.execute( stmt, bind_arguments={"shard_id": "my_shard"} )
sqlalchemy.orm.query.Query.__init__
Construct a _query.Query
directly.
E.g.:
q = Query([User, Address], session=some_session)
The above is equivalent to:
q = some_session.query(User, Address)
See Also
.Session.query
_query.Query.with_session
Parameters | |
*args | Undocumented |
**kwargs | Undocumented |
entities | a sequence of entities and/or SQL expressions. |
session | a .Session with which the
_query.Query
will be associated. Optional; a _query.Query
can be associated
with a .Session generatively via the
_query.Query.with_session method as well. |