diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-10-20 12:50:53 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-10-25 12:09:41 -0400 |
commit | 92aa35e7fc737de58c25d6c22bf1c48f6c4c714b (patch) | |
tree | f3c46d6d198441bb7f8ca7e8a7b2322b26491782 /lib/sqlalchemy/orm | |
parent | 605d0d905855684bfe4409532af98f336ae38f82 (diff) | |
download | sqlalchemy-92aa35e7fc737de58c25d6c22bf1c48f6c4c714b.tar.gz |
deprecation warnings: strings in loader options, join, with_parent
Repairs one in-library deprecation warning regarding
mapper propagation of options
raises maxfail to 250, as 25 is too low when we are trying
to address many errors at once. the 25 was originally
due to the fact that our fixtures would be broken after
that many failures in most cases, which today should not
be the case nearly as often.
Change-Id: I26affddf42e2cae2aaf9561633e9b8cd431eb189
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 10 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/strategy_options.py | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 1aa6666a5..4de12b88c 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -3111,14 +3111,20 @@ class Mapper( # "enable" options, to turn on the properties that we want to # load by default (subject to options from the query) enable_opt.set_generic_strategy( - (prop.key,), dict(prop.strategy_key) + # convert string name to an attribute before passing + # to loader strategy + (getattr(entity.entity_namespace, prop.key),), + dict(prop.strategy_key), ) else: # "disable" options, to turn off the properties from the # superclass that we *don't* want to load, applied after # the options from the query to override them disable_opt.set_generic_strategy( - (prop.key,), {"do_nothing": True} + # convert string name to an attribute before passing + # to loader strategy + (getattr(entity.entity_namespace, prop.key),), + {"do_nothing": True}, ) primary_key = [ diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py index b7ed4e89b..675c7218b 100644 --- a/lib/sqlalchemy/orm/strategy_options.py +++ b/lib/sqlalchemy/orm/strategy_options.py @@ -301,6 +301,7 @@ class Load(Generative, LoaderOption): ) if isinstance(attr, util.string_types): + default_token = attr.endswith(_DEFAULT_TOKEN) attr_str_name = attr if attr.endswith(_WILDCARD_TOKEN) or default_token: @@ -328,7 +329,7 @@ class Load(Generative, LoaderOption): "Using strings to indicate column or " "relationship paths in loader options is deprecated " "and will be removed in SQLAlchemy 2.0. Please use " - "the class-bound attribute directly." + "the class-bound attribute directly.", ) try: # use getattr on the class to work around |