diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-25 22:31:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-31 13:44:53 -0400 |
commit | 654b462d668a2ced4e87077b9babb2590acbf983 (patch) | |
tree | 8b6023480423e990c9bbca7c280cb1cb58e012fc /lib/sqlalchemy/util/deprecations.py | |
parent | 841eb216644202567ebddfc0badc51a3a35e98c3 (diff) | |
download | sqlalchemy-review/mike_bayer/tutorial20.tar.gz |
tutorial 2.0 WIPreview/mike_bayer/tutorial20
Add SelectBase.exists() method as it seems strange this is
not available already. The Exists construct itself does
not provide full SELECT-building capabilities so it makes
sense this should be used more like a scalar_subquery.
Make sure stream_results is getting set up when yield_per
is used, for 2.0 style statements as well. this was
hardcoded inside of Query.yield_per() and is now moved
to take place within QueryContext.
Change-Id: Icafcd4fd9b708772343d56edf40995c9e8f835d6
Diffstat (limited to 'lib/sqlalchemy/util/deprecations.py')
-rw-r--r-- | lib/sqlalchemy/util/deprecations.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/sqlalchemy/util/deprecations.py b/lib/sqlalchemy/util/deprecations.py index 9f0ca0b1a..f46374601 100644 --- a/lib/sqlalchemy/util/deprecations.py +++ b/lib/sqlalchemy/util/deprecations.py @@ -81,10 +81,18 @@ def deprecated_cls(version, message, constructor="__init__"): return decorate -def deprecated_20_cls(clsname, alternative=None, constructor="__init__"): +def deprecated_20_cls( + clsname, alternative=None, constructor="__init__", becomes_legacy=False +): message = ( ".. deprecated:: 1.4 The %s class is considered legacy as of the " - "1.x series of SQLAlchemy and will be removed in 2.0." % clsname + "1.x series of SQLAlchemy and %s in 2.0." + % ( + clsname, + "will be removed" + if not becomes_legacy + else "becomes a legacy construct", + ) ) if alternative: @@ -161,7 +169,7 @@ def moved_20(message, **kw): ) -def deprecated_20(api_name, alternative=None, **kw): +def deprecated_20(api_name, alternative=None, becomes_legacy=False, **kw): type_reg = re.match("^:(attr|func|meth):", api_name) if type_reg: type_ = {"attr": "attribute", "func": "function", "meth": "method"}[ @@ -171,8 +179,14 @@ def deprecated_20(api_name, alternative=None, **kw): type_ = "construct" message = ( "The %s %s is considered legacy as of the " - "1.x series of SQLAlchemy and will be removed in 2.0." - % (api_name, type_) + "1.x series of SQLAlchemy and %s in 2.0." + % ( + api_name, + type_, + "will be removed" + if not becomes_legacy + else "becomes a legacy construct", + ) ) if alternative: |