diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-08-20 10:28:16 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-08-20 11:27:47 -0400 |
| commit | 680baea6b83c497e862f3f0ade28e11940cfd895 (patch) | |
| tree | c38f17898e5fa30f19bf4881f21b934cbd6bb316 /lib/sqlalchemy/engine | |
| parent | 5c4a74fc13ca28983706a76ab02ffe09d89d1dbf (diff) | |
| download | sqlalchemy-680baea6b83c497e862f3f0ade28e11940cfd895.tar.gz | |
heads up that execute(query).first() can't apply LIMIT 1
Fixes: #6914
Change-Id: I5de9843dd3723c017b94b705fc009b883737ede1
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/result.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index 60474c0ed..3c2e682be 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -1054,6 +1054,17 @@ class Result(_WithKeys, ResultInternal): column of the first row, use the :meth:`.Result.scalar` method, or combine :meth:`.Result.scalars` and :meth:`.Result.first`. + Additionally, in contrast to the behavior of the legacy ORM + :meth:`_orm.Query.first` method, **no limit is applied** to the + SQL query which was invoked to produce this :class:`_engine.Result`; + for a DBAPI driver that buffers results in memory before yielding + rows, all rows will be sent to the Python process and all but + the first row will be discarded. + + .. seealso:: + + :ref:`migration_20_unify_select` + :return: a :class:`.Row` object, or None if no rows remain. |
