summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-04-30 18:27:24 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2023-05-09 20:23:48 -0400
commit60b31198311eedfa3814e7098c94d3aa29338fdd (patch)
tree5fe3a55ef67ab14fa63a0a3122a1326b830ceb72 /lib/sqlalchemy/orm/query.py
parent228490ead7048f2e558c25b0f055bdb952272ec4 (diff)
downloadsqlalchemy-60b31198311eedfa3814e7098c94d3aa29338fdd.tar.gz
fix test suite warnings
fix a handful of warnings that were emitting but not raising, usually because they were inside an "expect_warnings" block. modify "expect_warnings" to always use "raise_on_any_unexpected" behavior; remove this parameter. Fixed issue in semi-private ``await_only()`` and ``await_fallback()`` concurrency functions where the given awaitable would remain un-awaited if the function threw a ``GreenletError``, which could cause "was not awaited" warnings later on if the program continued. In this case, the given awaitable is now cancelled before the exception is thrown. Change-Id: I33668c5e8c670454a3d879e559096fb873b57244
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r--lib/sqlalchemy/orm/query.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 5cd7cc117..e6381bee1 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -1436,7 +1436,13 @@ class Query(
to the given list of columns
"""
+ return self._values_no_warn(*columns)
+ _values = values
+
+ def _values_no_warn(
+ self, *columns: _ColumnsClauseArgument[Any]
+ ) -> Iterable[Any]:
if not columns:
return iter(())
q = self._clone().enable_eagerloads(False)
@@ -1445,8 +1451,6 @@ class Query(
q.load_options += {"_yield_per": 10}
return iter(q) # type: ignore
- _values = values
-
@util.deprecated(
"1.4",
":meth:`_query.Query.value` "
@@ -1460,7 +1464,7 @@ class Query(
"""
try:
- return next(self.values(column))[0] # type: ignore
+ return next(self._values_no_warn(column))[0] # type: ignore
except StopIteration:
return None
@@ -3332,7 +3336,7 @@ class AliasOption(interfaces.LoaderOption):
@util.deprecated(
"1.4",
- "The :class:`.AliasOption` is not necessary "
+ "The :class:`.AliasOption` object is not necessary "
"for entities to be matched up to a query that is established "
"via :meth:`.Query.from_statement` and now does nothing.",
)