diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2020-05-06 14:21:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-05-06 14:21:53 +0000 |
commit | 00928a1cf041762e846c4cb2bde4f0650d79ee5c (patch) | |
tree | 5edb859a3a27b8c8aa8b6c41af04f28b7bf4a8a8 /lib/sqlalchemy/orm/util.py | |
parent | 3ab5e3781b9f44d458cb6213e89f50d01ea167dd (diff) | |
parent | f554209ebd676fd7c30e4c494a42a049d8afd3f0 (diff) | |
download | sqlalchemy-00928a1cf041762e846c4cb2bde4f0650d79ee5c.tar.gz |
Merge "fixes #4212 raise an error if selectable and flat/aliased are sent to with_polymorphic simultaenously"
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r-- | lib/sqlalchemy/orm/util.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 8513374a8..b78f8824e 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -944,6 +944,13 @@ def with_polymorphic( only be specified if querying for one specific subtype only """ primary_mapper = _class_to_mapper(base) + + if selectable not in (None, False) and flat: + raise sa_exc.ArgumentError( + "the 'flat' and 'selectable' arguments cannot be passed " + "simultaneously to with_polymorphic()" + ) + if _existing_alias: assert _existing_alias.mapper is primary_mapper classes = util.to_set(classes) |