diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/orm/query.py | 60 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 18 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 34 |
4 files changed, 7 insertions, 109 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 0da7d08a4..617bba315 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1622,39 +1622,6 @@ class Query(Generative): self._execution_options = self._execution_options.union(kwargs) @_generative - @util.deprecated( - "0.9", - "The :meth:`.Query.with_lockmode` method is deprecated and will " - "be removed in a future release. Please refer to " - ":meth:`.Query.with_for_update`. ", - ) - def with_lockmode(self, mode): - """Return a new :class:`.Query` object with the specified "locking mode", - which essentially refers to the ``FOR UPDATE`` clause. - - :param mode: a string representing the desired locking mode. - Valid values are: - - * ``None`` - translates to no lockmode - - * ``'update'`` - translates to ``FOR UPDATE`` - (standard SQL, supported by most dialects) - - * ``'update_nowait'`` - translates to ``FOR UPDATE NOWAIT`` - (supported by Oracle, PostgreSQL 8.1 upwards) - - * ``'read'`` - translates to ``LOCK IN SHARE MODE`` (for MySQL), - and ``FOR SHARE`` (for PostgreSQL) - - .. seealso:: - - :meth:`.Query.with_for_update` - improved API for - specifying the ``FOR UPDATE`` clause. - - """ - self._for_update_arg = LockmodeArg.parse_legacy_query(mode) - - @_generative def with_for_update( self, read=False, @@ -1681,16 +1648,13 @@ class Query(Generative): SELECT users.id AS users_id FROM users FOR UPDATE OF users NOWAIT - .. versionadded:: 0.9.0 :meth:`.Query.with_for_update` supersedes - the :meth:`.Query.with_lockmode` method. - .. seealso:: :meth:`.GenerativeSelect.with_for_update` - Core level method with full argument and behavioral description. """ - self._for_update_arg = LockmodeArg( + self._for_update_arg = ForUpdateArg( read=read, nowait=nowait, of=of, @@ -4098,28 +4062,6 @@ class Query(Generative): ) -class LockmodeArg(ForUpdateArg): - @classmethod - def parse_legacy_query(cls, mode): - if mode in (None, False): - return None - - if mode == "read": - read = True - nowait = False - elif mode == "update": - read = nowait = False - elif mode == "update_nowait": - nowait = True - read = False - else: - raise sa_exc.ArgumentError( - "Unknown with_lockmode argument: %r" % mode - ) - - return LockmodeArg(read=read, nowait=nowait) - - class _QueryEntity(object): """represent an entity column returned within a Query result.""" diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index fefdd4ef1..c773aeb08 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1664,11 +1664,7 @@ class Session(_SessionClassMethods): util.raise_(e, with_traceback=sys.exc_info()[2]) def refresh( - self, - instance, - attribute_names=None, - with_for_update=None, - lockmode=None, + self, instance, attribute_names=None, with_for_update=None, ): """Expire and refresh the attributes on the given instance. @@ -1701,10 +1697,6 @@ class Session(_SessionClassMethods): .. versionadded:: 1.2 - :param lockmode: Passed to the :class:`~sqlalchemy.orm.query.Query` - as used by :meth:`~sqlalchemy.orm.query.Query.with_lockmode`. - Superseded by :paramref:`.Session.refresh.with_for_update`. - .. seealso:: :ref:`session_expire` - introductory material @@ -1730,13 +1722,11 @@ class Session(_SessionClassMethods): "A blank dictionary is ambiguous." ) - if lockmode: - with_for_update = query.LockmodeArg.parse_legacy_query(lockmode) - elif with_for_update is not None: + if with_for_update is not None: if with_for_update is True: - with_for_update = query.LockmodeArg() + with_for_update = query.ForUpdateArg() elif with_for_update: - with_for_update = query.LockmodeArg(**with_for_update) + with_for_update = query.ForUpdateArg(**with_for_update) else: with_for_update = None diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 843732f67..5a10611ad 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -1535,9 +1535,7 @@ class TextClause( ), ) @_document_text_coercion("text", ":func:`.text`", ":paramref:`.text.text`") - def _create_text( - self, text, bind=None, bindparams=None, typemap=None, - ): + def _create_text(self, text, bind=None, bindparams=None, typemap=None): r"""Construct a new :class:`.TextClause` clause, representing a textual SQL string directly. diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 45b9e7f9d..3c23704c5 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -833,22 +833,8 @@ class Join(FromClause): return self._join_condition(left, right, a_subset=left_right) @classmethod - @util.deprecated_params( - ignore_nonexistent_tables=( - "0.9", - "The :paramref:`.join_condition.ignore_nonexistent_tables` " - "parameter is deprecated and will be removed in a future " - "release. Tables outside of the two tables being handled " - "are no longer considered.", - ) - ) def _join_condition( - cls, - a, - b, - ignore_nonexistent_tables=False, - a_subset=None, - consider_as_foreign_keys=None, + cls, a, b, a_subset=None, consider_as_foreign_keys=None ): """create a join condition between two tables or selectables. @@ -864,9 +850,6 @@ class Join(FromClause): between the two selectables. If there are multiple ways to join, or no way to join, an error is raised. - :param ignore_nonexistent_tables: unused - tables outside of the - two tables being handled are not considered. - :param a_subset: An optional expression that is a sub-component of ``a``. An attempt will be made to join to just this sub-component first before looking at the full ``a`` construct, and if found @@ -1115,10 +1098,6 @@ class Join(FromClause): argument as a no-op, so that the argument can be passed to the ``alias()`` method of any selectable. - .. versionadded:: 0.9.0 Added the ``flat=True`` option to create - "aliases" of joins without enclosing inside of a SELECT - subquery. - :param name: name given to the alias. :param flat: if True, produce an alias of the left and right @@ -1126,8 +1105,6 @@ class Join(FromClause): two selectables. This produces join expression that does not include an enclosing SELECT. - .. versionadded:: 0.9.0 - .. seealso:: :ref:`core_tutorial_aliases` @@ -1333,8 +1310,6 @@ class Alias(AliasedReturnsRows): is an instance of :class:`.Join` - see :meth:`.Join.alias` for details. - .. versionadded:: 0.9.0 - """ return coercions.expect( roles.FromClauseRole, selectable, allow_select=True @@ -2021,8 +1996,6 @@ class ForUpdateArg(ClauseElement): ): """Represents arguments specified to :meth:`.Select.for_update`. - .. versionadded:: 0.9.0 - """ self.nowait = nowait @@ -2386,11 +2359,6 @@ class GenerativeSelect(DeprecatedSelectBaseGenerations, SelectBase): represents a fixed textual string which cannot be altered at this level, only wrapped as a subquery. - .. versionadded:: 0.9.0 :class:`.GenerativeSelect` was added to - provide functionality specific to :class:`.Select` and - :class:`.CompoundSelect` while allowing :class:`.SelectBase` to be - used for other SELECT-like objects, e.g. :class:`.TextualSelect`. - """ _order_by_clauses = () |