diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2022-12-18 20:02:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-12-18 20:02:39 +0000 |
commit | ce8c0013169bdbe377ca21389f85051525814264 (patch) | |
tree | 6791d4f84a3f0d47fb2eb15aa6ff5845efad1409 /lib/sqlalchemy/orm/context.py | |
parent | ac6f98a95cf9f65fec582a93cd168ce91402f5b4 (diff) | |
parent | d480546fbcf6cafcbd166240d9c39e4b9204ccc4 (diff) | |
download | sqlalchemy-ce8c0013169bdbe377ca21389f85051525814264.tar.gz |
Merge "include pk cols in refresh() if relationships are requested" into main
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index b3c8e78b3..3bd8b02a7 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -1188,15 +1188,11 @@ class ORMSelectCompileState(ORMCompileState, SelectState): if not self.primary_columns: if self.compile_options._only_load_props: - raise sa_exc.InvalidRequestError( - "No column-based properties specified for " - "refresh operation. Use session.expire() " - "to reload collections and related items." - ) - else: - raise sa_exc.InvalidRequestError( - "Query contains no columns with which to SELECT from." - ) + assert False, "no columns were included in _only_load_props" + + raise sa_exc.InvalidRequestError( + "Query contains no columns with which to SELECT from." + ) if not self.from_clauses: self.from_clauses = list(self._fallback_from_clauses) |