]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Complete deprecation of from_self()
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 18 Sep 2020 17:29:42 +0000 (13:29 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 19 Sep 2020 02:35:48 +0000 (22:35 -0400)
commitf0f08db5715e41cc08e57dbc76a85300bd68f8de
tree3d17072c461927f5a66c654d3e824a24b949905b
parentd5c89a541f5233baf6b6a7498746820caa7b407f
Complete deprecation of from_self()

For most from_self() tests, move them into
test/orm/test_deprecated.py and replace the existing
test with one that uses aliased() plus a subquery.
This then revealed a few more issues.

Related items:

* Added slice() method to GenerativeSelect, to match that
  of orm.Query and to make possible migration of one of the
  from_self() tests.  moved the utility functions used for this
  from orm/util into sql/util.

* repairs a caching issue related to subqueryload
  where information being derived from the cached path info
  was mixing up with query information based on the per-query
  state, specifically an AliasedClass that is per query.

* for the above issue, it seemed like path_registry maybe
  had to change so that it represents AliasedClass objects
  as their cache key rather than on identity, but it wasn't
  needed.  still seems like it would be more correct.

* enhances the error message raised by coercions for a case
  such as when an AliasedClass holds onto a select() object
  and not a subquery(); will name the original and resolved
  object for clarity  (although how is AliasedClass able to
  accept a Select() object in the first place?)

* Added _set_propagate_attrs() to Query so that again if
  it's passed to AliasedClass, it doesn't raise an error
  during coercion, but again maybe that should also be
  rejected up front

Fixes: #5368
Change-Id: I5912aa611d899acc87a75eb5ee9f95990592f210
18 files changed:
lib/sqlalchemy/ext/baked.py
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/util.py
lib/sqlalchemy/testing/warnings.py
test/dialect/postgresql/test_compiler.py
test/ext/test_baked.py
test/orm/test_deprecations.py
test/orm/test_froms.py
test/orm/test_joins.py
test/orm/test_query.py
test/orm/test_selectin_relations.py
test/orm/test_subquery_relations.py
test/orm/test_update_delete.py