]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement write-only colletions, typing for dynamic
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Sep 2022 18:38:44 +0000 (14:38 -0400)
committermike bayer <mike_mp@zzzcomputing.com>
Thu, 6 Oct 2022 00:36:25 +0000 (00:36 +0000)
commit276349200c486eee108471b888acfc47ea19201b
tree7441fa3219f21b18c6e532bd85b25c2bbdae86f8
parent566cccc8645be99a23811c39d43481d7248628b0
implement write-only colletions, typing for dynamic

For 2.0, we provide a truly "larger than memory collection"
implementation, a write-only collection that will never
under any circumstances implicitly load the entire
collection, even during flush.

This is essentially a much more "strict" version
of the "dynamic" loader, which in fact has a lot of
scenarios that it loads the full backing collection
into memory, mostly defeating its purpose.

Typing constructs are added that support
both the new feature WriteOnlyMapping as well as the
legacy feature DynamicMapping.  These have been
integrated with "annotion based mapping" so that
relationship() uses these annotations to configure
the loader strategy as well.

additional changes:

* the docs triggered a conflict in hybrid's
  "transformers" section, this section is hard-coded
  to Query using a pattern that doesnt seem to have
  any use and isn't part of the current select()
  interface, so just removed this section

* As the docs for WriteOnlyMapping are very long,
  collections.rst is broken up into two pages now.

Fixes: #6229
Fixes: #7123
Change-Id: I6929f3da6e441cad92285e7309030a9bac4e429d
36 files changed:
doc/build/changelog/migration_20.rst
doc/build/changelog/whatsnew_20.rst
doc/build/core/connections.rst
doc/build/orm/collection_api.rst [new file with mode: 0644]
doc/build/orm/collections.rst
doc/build/orm/extensions/asyncio.rst
doc/build/orm/large_collections.rst [new file with mode: 0644]
doc/build/orm/queryguide/relationships.rst
doc/build/orm/relationships.rst
lib/sqlalchemy/ext/hybrid.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/base.py
lib/sqlalchemy/orm/bulk_persistence.py
lib/sqlalchemy/orm/decl_base.py
lib/sqlalchemy/orm/descriptor_props.py
lib/sqlalchemy/orm/dynamic.py
lib/sqlalchemy/orm/evaluator.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/orm/writeonly.py [new file with mode: 0644]
lib/sqlalchemy/testing/assertsql.py
lib/sqlalchemy/testing/entities.py
lib/sqlalchemy/util/typing.py
test/base/test_tutorials.py
test/ext/mypy/plain_files/dynamic_rel.py [new file with mode: 0644]
test/ext/mypy/plain_files/write_only.py [new file with mode: 0644]
test/orm/declarative/test_tm_future_annotations.py
test/orm/declarative/test_typed_mapping.py
test/orm/dml/test_bulk_statements.py
test/orm/dml/test_update_delete_where.py
test/orm/test_dynamic.py