diff options
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index cedaad3ef..2c06063bc 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -450,7 +450,7 @@ class Query(object): """Return the full SELECT statement represented by this :class:`.Query` represented as a common table expression (CTE). - The :meth:`.Query.cte` method is new in 0.7.6. + .. versionadded:: 0.7.6 Parameters and usage are the same as those of the :meth:`._SelectBase.cte` method; see that method for @@ -508,7 +508,7 @@ class Query(object): Analogous to :meth:`sqlalchemy.sql._SelectBaseMixin.label`. - New in 0.6.5. + .. versionadded:: 0.6.5 """ @@ -521,7 +521,7 @@ class Query(object): Analogous to :meth:`sqlalchemy.sql._SelectBaseMixin.as_scalar`. - New in 0.6.5. + .. versionadded:: 0.6.5 """ @@ -629,12 +629,13 @@ class Query(object): See the documentation section :ref:`with_polymorphic` for details on how this method is used. - As of 0.8, a new and more flexible function - :func:`.orm.with_polymorphic` supersedes - :meth:`.Query.with_polymorphic`, as it can apply the equivalent - functionality to any set of columns or classes in the - :class:`.Query`, not just the "zero mapper". See that - function for a description of arguments. + .. versionchanged:: 0.8 + A new and more flexible function + :func:`.orm.with_polymorphic` supersedes + :meth:`.Query.with_polymorphic`, as it can apply the equivalent + functionality to any set of columns or classes in the + :class:`.Query`, not just the "zero mapper". See that + function for a description of arguments. """ @@ -970,7 +971,7 @@ class Query(object): q = q.join((subq, subq.c.email < Address.email)).\\ limit(1) - New in 0.6.5. + .. versionadded:: 0.6.5 """ self._set_entities(entities) @@ -1047,7 +1048,7 @@ class Query(object): This allows ad-hoc recipes to be created for :class:`.Query` objects. See the example at :ref:`hybrid_transformers`. - :meth:`~.Query.with_transformation` is new in SQLAlchemy 0.7.4. + .. versionadded:: 0.7.4 """ return fn(self) @@ -1104,7 +1105,8 @@ class Query(object): ``'read_nowait'`` - passes ``for_update='read_nowait'``, which translates to ``FOR SHARE NOWAIT`` (supported by PostgreSQL). - New in 0.7.7: ``FOR SHARE`` and ``FOR SHARE NOWAIT`` (PostgreSQL) + .. versionadded:: 0.7.7 + ``FOR SHARE`` and ``FOR SHARE NOWAIT`` (PostgreSQL). """ self._lockmode = mode @@ -1138,7 +1140,7 @@ class Query(object): session.query(MyClass).filter(MyClass.name == 'some name') - Multiple criteria are joined together by AND (new in 0.7.5):: + Multiple criteria are joined together by AND:: session.query(MyClass).\\ filter(MyClass.name == 'some name', MyClass.id > 5) @@ -1147,6 +1149,9 @@ class Query(object): WHERE clause of a select. String expressions are coerced into SQL expression constructs via the :func:`.text` construct. + .. versionchanged:: 0.7.5 + Multiple criteria joined by AND. + See also: :meth:`.Query.filter_by` - filter on keyword expressions. @@ -1470,18 +1475,15 @@ class Query(object): q = session.query(User).join(Address, User.id==Address.user_id) - .. note:: - - In SQLAlchemy 0.6 and earlier, the two argument form of - :meth:`~.Query.join` requires the usage of a tuple:: - - query(User).join((Address, User.id==Address.user_id)) - - This calling form is accepted in 0.7 and further, though - is not necessary unless multiple join conditions are passed to - a single :meth:`~.Query.join` call, which itself is also not - generally necessary as it is now equivalent to multiple - calls (this wasn't always the case). + .. versionchanged:: 0.7 + In SQLAlchemy 0.6 and earlier, the two argument form of + :meth:`~.Query.join` requires the usage of a tuple: + ``query(User).join((Address, User.id==Address.user_id))``\ . + This calling form is accepted in 0.7 and further, though + is not necessary unless multiple join conditions are passed to + a single :meth:`~.Query.join` call, which itself is also not + generally necessary as it is now equivalent to multiple + calls (this wasn't always the case). **Advanced Join Targeting and Adaption** @@ -2086,7 +2088,7 @@ class Query(object): SELECT HIGH_PRIORITY SQL_SMALL_RESULT ALL users.name AS users_name FROM users - New in 0.7.7. + .. versionadded:: 0.7.7 """ if self._prefixes: @@ -2162,9 +2164,11 @@ class Query(object): unique entity or entities - this is a successful result for one(). Calling ``one()`` results in an execution of the underlying query. - As of 0.6, ``one()`` fully fetches all results instead of applying - any kind of limit, so that the "unique"-ing of entities does not - conceal multiple object identities. + + .. versionchanged:: 0.6 + ``one()`` fully fetches all results instead of applying + any kind of limit, so that the "unique"-ing of entities does not + conceal multiple object identities. """ ret = list(self) @@ -2526,8 +2530,8 @@ class Query(object): SELECT <rest of query follows...> ) AS anon_1 - Note the above scheme is newly refined in 0.7 - (as of 0.7b3). + .. versionchanged:: 0.7 + The above scheme is newly refined as of 0.7b3. For fine grained control over specific columns to count, to skip the usage of a subquery or |
