MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / Query

Class Query

lib/sqlalchemy/orm/query.py:165–3432  ·  view source on GitHub ↗

ORM-level SQL construction object. .. legacy:: The ORM :class:`.Query` object is a legacy construct as of SQLAlchemy 2.0. See the notes at the top of :ref:`query_api_toplevel` for an overview, including links to migration documentation. :class:`_query.Query` objects

Source from the content-addressed store, hash-verified

163@inspection._self_inspects
164@log.class_logger
165class Query(
166 _SelectFromElements,
167 SupportsCloneAnnotations,
168 HasPrefixes,
169 HasSuffixes,
170 HasHints,
171 EventTarget,
172 log.Identified,
173 Generative,
174 Executable,
175 Generic[_T],
176):
177 """ORM-level SQL construction object.
178
179 .. legacy:: The ORM :class:`.Query` object is a legacy construct
180 as of SQLAlchemy 2.0. See the notes at the top of
181 :ref:`query_api_toplevel` for an overview, including links to migration
182 documentation.
183
184 :class:`_query.Query` objects are normally initially generated using the
185 :meth:`~.Session.query` method of :class:`.Session`, and in
186 less common cases by instantiating the :class:`_query.Query` directly and
187 associating with a :class:`.Session` using the
188 :meth:`_query.Query.with_session`
189 method.
190
191 """
192
193 # elements that are in Core and can be cached in the same way
194 _where_criteria: Tuple[ColumnElement[Any], ...] = ()
195 _having_criteria: Tuple[ColumnElement[Any], ...] = ()
196
197 _order_by_clauses: Tuple[ColumnElement[Any], ...] = ()
198 _group_by_clauses: Tuple[ColumnElement[Any], ...] = ()
199 _limit_clause: Optional[ColumnElement[Any]] = None
200 _offset_clause: Optional[ColumnElement[Any]] = None
201
202 _distinct: bool = False
203 _distinct_on: Tuple[ColumnElement[Any], ...] = ()
204
205 _for_update_arg: Optional[ForUpdateArg] = None
206 _correlate: Tuple[FromClause, ...] = ()
207 _auto_correlate: bool = True
208 _from_obj: Tuple[FromClause, ...] = ()
209 _setup_joins: Tuple[_SetupJoinsElement, ...] = ()
210
211 _label_style: SelectLabelStyle = SelectLabelStyle.LABEL_STYLE_LEGACY_ORM
212
213 _memoized_select_entities = ()
214
215 _syntax_extensions: Tuple[SyntaxExtension, ...] = ()
216
217 _compile_options: Union[Type[CacheableOptions], CacheableOptions] = (
218 _ORMCompileState.default_compile_options
219 )
220
221 _with_options: Tuple[ExecutableOption, ...]
222 load_options = QueryContext.default_load_options + {

Callers 4

test_to_query_argsMethod · 0.90
queryMethod · 0.90
__call__Method · 0.90

Calls

no outgoing calls

Tested by 4

test_to_query_argsMethod · 0.72
queryMethod · 0.72
__call__Method · 0.72