summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-05-20 13:41:44 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-05-21 14:16:03 -0400
commit4550983e0ce2f35b3585e53894c941c23693e71d (patch)
tree3928e6e333c2b9bb6e23a4de079565a387d309ae /lib/sqlalchemy/sql/selectable.py
parent3d55263c92ee29a0257d823124c353a35246cf31 (diff)
downloadsqlalchemy-4550983e0ce2f35b3585e53894c941c23693e71d.tar.gz
Performance fixes for new result set
A few small mistakes led to huge callcounts. Additionally, the warn-on-get behavior which is attempting to warn for deprecated access in SQLAlchemy 2.0 is very expensive; it's not clear if its feasible to have this warning or to somehow alter how it works. Fixes: #5340 Change-Id: I73bdd2d7b6f1b25cc0222accabd585cf761a5af4
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r--lib/sqlalchemy/sql/selectable.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index bcab46d84..cc82c509b 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -3527,12 +3527,14 @@ class Select(
@classmethod
def _create_select_from_fromclause(cls, target, entities, *arg, **kw):
if arg or kw:
- util.warn_deprecated_20(
- "Passing arguments to %s.select() is deprecated and "
- "will be removed in SQLAlchemy 2.0. Please use generative "
- "methods such as select().where(), etc."
- % (target.__class__.__name__,)
- )
+ if util.SQLALCHEMY_WARN_20:
+ util.warn_deprecated_20(
+ "Passing arguments to %s.select() is deprecated and "
+ "will be removed in SQLAlchemy 2.0. "
+ "Please use generative "
+ "methods such as select().where(), etc."
+ % (target.__class__.__name__,)
+ )
return Select(entities, *arg, **kw)
else:
return Select._create_select(*entities)
@@ -3744,13 +3746,14 @@ class Select(
:meth:`_expression.Select.apply_labels`
"""
- util.warn_deprecated_20(
- "The select() function in SQLAlchemy 2.0 will accept a "
- "series of columns / tables and other entities only, "
- "passed positionally. For forwards compatibility, use the "
- "sqlalchemy.future.select() construct.",
- stacklevel=4,
- )
+ if util.SQLALCHEMY_WARN_20:
+ util.warn_deprecated_20(
+ "The select() function in SQLAlchemy 2.0 will accept a "
+ "series of columns / tables and other entities only, "
+ "passed positionally. For forwards compatibility, use the "
+ "sqlalchemy.future.select() construct.",
+ stacklevel=4,
+ )
self._auto_correlate = correlate