summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
Commit message (Collapse)AuthorAgeFilesLines
* add notes to all mapper flush events that these are only for flushMike Bayer2023-02-211-0/+36
| | | | | Fixes: #9339 Change-Id: I44542166417776733245e2ba39cd5de89b6d748b
* Fix the docstring of AppenerQuery.append() (#9336)Grey Li2023-02-201-2/+2
|
* consider column.name directly when evaluating use_existing_columnMike Bayer2023-02-181-1/+2
| | | | | | | | | | | Fixed issue where new :paramref:`_orm.mapped_column.use_existing_column` feature would not work if the two same-named columns were mapped under attribute names that were differently-named from the explicit name given to the column itself. The attribute names can now be differently named when using this parameter. Fixes: #9332 Change-Id: I43716b8ca2b089e54a2b078db28b6c4770468bdd
* Allow custom sorting of column in the ORM.Federico Caselli2023-02-165-17/+45
| | | | | | | | | | | | | | | To accommodate a change in column ordering used by ORM Declarative in SQLAlchemy 2.0, a new parameter :paramref:`_orm.mapped_column.sort_order` has been added that can be used to control the order of the columns defined in the table by the ORM, for common use cases such as mixins with primary key columns that should appear first in tables. The change notes at :ref:`change_9297` illustrate the default change in ordering behavior (which is part of all SQLAlchemy 2.0 releases) as well as use of the :paramref:`_orm.mapped_column.sort_order` to control column ordering when using mixins and multiple classes (new in 2.0.4). Fixes: #9297 Change-Id: Ic7163d64efdc0eccb53d6ae0dd89ec83427fb675
* Merge "rename EvaluatorCompiler to _EvaluatorCompiler" into mainmike bayer2023-02-162-3/+29
|\
| * rename EvaluatorCompiler to _EvaluatorCompilerMike Bayer2023-02-162-3/+29
| | | | | | | | | | | | | | | | This is a private class, mark as such as some users may have used this class directly in end-user code. Change-Id: I2657eff1f9f11b59c0483922ac67d6420a082906 References: #9299
* | Merge "add dataclasses callable and apply annotations more strictly" into mainmike bayer2023-02-162-13/+82
|\ \
| * | add dataclasses callable and apply annotations more strictlyMike Bayer2023-02-162-13/+82
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new parameter ``dataclasses_callable`` to both the :class:`_orm.MappedAsDataclass` class as well as the :meth:`_orm.registry.mapped_as_dataclass` method which allows an alternative callable to Python ``dataclasses.dataclass`` to be used in order to produce dataclasses. The use case here is to drop in Pydantic's dataclass function instead. Adjustments have been made to the mixin support added for :ticket:`9179` in version 2.0.1 so that the ``__annotations__`` collection of the mixin is rewritten to not include the :class:`_orm.Mapped` container, in the same way as occurs with mapped classes, so that the Pydantic dataclasses constructor is not exposed to unknown types. Fixes: #9266 Change-Id: Ia0fab6f20b93a5cb853799dcf1b70a0386837c14
* | immediateload lazy relationships named in refresh.attribute_namesMike Bayer2023-02-165-28/+78
|/ | | | | | | | | | | | | | | | | | The :meth:`_orm.Session.refresh` method will now immediately load a relationship-bound attribute that is explicitly named within the :paramref:`_orm.Session.refresh.attribute_names` collection even if it is currently linked to the "select" loader, which normally is a "lazy" loader that does not fire off during a refresh. The "lazy loader" strategy will now detect that the operation is specifically a user-initiated :meth:`_orm.Session.refresh` operation which named this attribute explicitly, and will then call upon the "immediateload" strategy to actually emit SQL to load the attribute. This should be helpful in particular for some asyncio situations where the loading of an unloaded lazy-loaded attribute must be forced, without using the actual lazy-loading attribute pattern not supported in asyncio. Fixes: #9298 Change-Id: I9b50f339bdf06cdb2ec98f8e5efca2b690895dd7
* fix typo "Annotation" -> "Annotated" and use typing_extensionsMike Bayer2023-02-141-2/+2
| | | | | Fixes: #9305 Change-Id: I9f0ab24f609f6f557b5780209a85f0abe82b363e
* Fix docs for `case` expression to match new syntax (#9279)Abdulhaq Emhemmed2023-02-101-2/+2
| | | | | | | | | * Fix docs for `case` expression to match new syntax Previously (before v1.4), the `whens` arg (when `value` is *not* used) used to be a list of conditions (a 2 item-tuple of condition + value). From v1.4, these are passed as positional args and the old syntax is not supported anymore. * Fix long lines
* generalize adapt_on_names to expect non-named elementsMike Bayer2023-02-102-5/+13
| | | | | | | | | | | | | | | | | | | | The fix in #9217 opened up adapt_on_names to more kinds of expressions than it was prepared for; adjust that logic and also refine in the ORM where we are using it, as we dont need it (yet) for the DML RETURNING use case. Fixed regression introduced in version 2.0.2 due to :ticket:`9217` where using DML RETURNING statements, as well as :meth:`_sql.Select.from_statement` constructs as was "fixed" in :ticket:`9217`, in conjunction with ORM mapped classes that used expressions such as with :func:`_orm.column_property`, would lead to an internal error within Core where it would attempt to match the expression by name. The fix repairs the Core issue, and also adjusts the fix in :ticket:`9217` to not take effect for the DML RETURNING use case, where it adds unnecessary overhead. Fixes: #9273 Change-Id: Ie0344efb12ff7df48f21e71e62dc598c76a6a0de
* Remove `typing.Self` workaroundYurii Karabas2023-02-084-147/+102
| | | | | | | | | | | | Remove ``typing.Self`` workaround, now using :pep:`673` for most methods that return ``Self``. Pull request courtesy Yurii Karabas. Fixes: #9254 Closes: #9255 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9255 Pull-request-sha: 2947df8ada79f5c3afe9c838e65993302199c2f7 Change-Id: Ic32015ad52e95a61f3913d43ea436aa9402804df
* Merge "port history meta to 2.0" into mainmike bayer2023-02-062-20/+71
|\
| * port history meta to 2.0Mike Bayer2023-02-062-20/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | first change: Reworked the :ref:`examples_versioned_history` to work with version 2.0, while at the same time improving the overall working of this example to use newer APIs, including a newly added hook :meth:`_orm.MapperEvents.after_mapper_constructed`. second change: Added new event hook :meth:`_orm.MapperEvents.after_mapper_constructed`, which supplies an event hook to take place right as the :class:`_orm.Mapper` object has been fully constructed, but before the :meth:`_orm.registry.configure` call has been called. This allows code that can create additional mappings and table structures based on the initial configuration of a :class:`_orm.Mapper`, which also integrates within Declarative configuration. Previously, when using Declarative, where the :class:`_orm.Mapper` object is created within the class creation process, there was no documented means of running code at this point. The change is to immediately benefit custom mapping schemes such as that of the :ref:`examples_versioned_history` example, which generate additional mappers and tables in response to the creation of mapped classes. third change: The infrequently used :attr:`_orm.Mapper.iterate_properties` attribute and :meth:`_orm.Mapper.get_property` method, which are primarily used internally, no longer implicitly invoke the :meth:`_orm.registry.configure` process. Public access to these methods is extremely rare and the only benefit to having :meth:`_orm.registry.configure` would have been allowing "backref" properties be present in these collections. In order to support the new :meth:`_orm.MapperEvents.after_mapper_constructed` event, iteration and access to the internal :class:`_orm.MapperProperty` objects is now possible without triggering an implicit configure of the mapper itself. The more-public facing route to iteration of all mapper attributes, the :attr:`_orm.Mapper.attrs` collection and similar, will still implicitly invoke the :meth:`_orm.registry.configure` step thus making backref attributes available. In all cases, the :meth:`_orm.registry.configure` is always available to be called directly. fourth change: Fixed obscure ORM inheritance issue caused by :ticket:`8705` where some scenarios of inheriting mappers that indicated groups of columns from the local table and the inheriting table together under a :func:`_orm.column_property` would nonetheless warn that properties of the same name were being combined implicitly. Fixes: #9220 Fixes: #9232 Change-Id: Id335b8e8071c8ea509c057c389df9dcd2059437d
* | check for superclasses of user defined initMike Bayer2023-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression caused by the fix for :ticket:`9171`, which itself was fixing a regression, involving the mechanics of ``__init__()`` on classes that extend from :class:`_orm.DeclarativeBase`. The change made it such that ``__init__()`` was applied to the user-defined base if there were no ``__init__()`` method directly on the class. This has been adjusted so that ``__init__()`` is applied only if no other class in the hierarchy of the user-defined base has an ``__init__()`` method. This again allows user-defined base classes based on :class:`_orm.DeclarativeBase` to include mixins that themselves include a custom ``__init__()`` method. Fixes: #9249 Change-Id: I78f32590ce9ffe245eccb4bd5bd7c884d4e015d5
* | Merge "coerce elements in mapper.primary_key, process in __mapper_args__" ↵mike bayer2023-02-052-5/+56
|\ \ | | | | | | | | | into main
| * | coerce elements in mapper.primary_key, process in __mapper_args__Mike Bayer2023-02-052-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Repaired ORM Declarative mappings to allow for the :paramref:`_orm.Mapper.primary_key` parameter to be specified within ``__mapper_args__`` when using :func:`_orm.mapped_column`. Despite this usage being directly in the 2.0 documentation, the :class:`_orm.Mapper` was not accepting the :func:`_orm.mapped_column` construct in this context. Ths feature was already working for the :paramref:`_orm.Mapper.version_id_col` and :paramref:`_orm.Mapper.polymorphic_on` parameters. As part of this change, the ``__mapper_args__`` attribute may be specified without using :func:`_orm.declared_attr` on a non-mapped mixin class, including a ``"primary_key"`` entry that refers to :class:`_schema.Column` or :func:`_orm.mapped_column` objects locally present on the mixin; Declarative will also translate these columns into the correct ones for a particular mapped class. This again was working already for the :paramref:`_orm.Mapper.version_id_col` and :paramref:`_orm.Mapper.polymorphic_on` parameters. Additionally, elements within ``"primary_key"`` may be indicated as string names of existing mapped properties. Fixes: #9240 Change-Id: Ie2000273289fa23e0af21ef9c6feb3962a8b848c
* | | Merge "Guard against wrong dataclass mapping" into mainFederico Caselli2023-02-051-0/+11
|\ \ \
| * | | Guard against wrong dataclass mappingFederico Caselli2023-02-051-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that the decorator style @registry.mapped_as_dataclass and MappedAsDataclass are not mixed. Fixes: #9211 Change-Id: I5cd94cae862122e4f627d0d051495b3789cf6de5
* | | | Merge "disallow ORM instrumented attributes from reaching dataclasses" into mainFederico Caselli2023-02-051-0/+11
|\ \ \ \ | |_|_|/ |/| | |
| * | | disallow ORM instrumented attributes from reaching dataclassesMike Bayer2023-02-031-0/+11
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More adjustments to ORM Declarative Dataclasses mappings, building on the improved support for mixins with dataclasses added in 2.0.1 via :ticket:`9179`, where a combination of using mixins plus ORM inheritance would mis-classify fields in some cases leading to their dataclass arguments such as ``init=False`` being lost. Fixes: #9226 Change-Id: Ia36f413e23e91dfbdb900f5ff3f8cdd3d5847064
* | | Merge "dont add non-server-side cols to returning for versioning" into mainmike bayer2023-02-052-6/+27
|\ \ \ | |_|/ |/| |
| * | dont add non-server-side cols to returning for versioningMike Bayer2023-02-032-6/+27
| |/ | | | | | | | | | | | | | | | | | | | | Fixed regression where using the :paramref:`_orm.Mapper.version_id_col` feature with a regular Python-side incrementing column would fail to work for SQLite and other databases that don't support "rowcount" with "RETURNING", as "RETURNING" would be assumed for such columns even though that's not what actually takes place. Fixes: #9228 Change-Id: I6a1a7fa4d63e183fe4ef0fbfd3cb5cac03b26d78
* | Fixed regression when using from_statement in orm context.Mike Bayer2023-02-031-9/+3
|/ | | | | | | | | | | | Fixed regression when using :meth:`_sql.Select.from_statement` in an ORM context, where matching of columns to SQL labels based on name alone was disabled for ORM-statements that weren't fully textual. This would prevent arbitrary SQL expressions with column-name labels from matching up to the entity to be loaded, which previously would work within the 1.4 and previous series, so the previous behavior has been restored. Fixes: #9217 Change-Id: I5f7ab9710a96a98241388883365e56d308b4daf2
* Merge "Add support for typing.Literal in Mapped" into mainmike bayer2023-02-012-3/+14
|\
| * Add support for typing.Literal in MappedFrederik Aalund2023-01-312-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for :pep:`586` ``Literal`` to be used in the :paramref:`_orm.registry.type_annotation_map` as well as within :class:`.Mapped` constructs. To use custom types such as these, they must appear explicitly within the :paramref:`_orm.registry.type_annotation_map` to be mapped. Pull request courtesy Frederik Aalund. As part of this change, the support for :class:`.sqltypes.Enum` in the :paramref:`_orm.registry.type_annotation_map` has been expanded to include support for ``Literal[]`` types consisting of string values to be used, in addition to ``enum.Enum`` datatypes. If a ``Literal[]`` datatype is used within ``Mapped[]`` that is not linked in :paramref:`_orm.registry.type_annotation_map` to a specific datatype, a :class:`.sqltypes.Enum` will be used by default. Fixed issue involving the use of :class:`.sqltypes.Enum` within the :paramref:`_orm.registry.type_annotation_map` where the :paramref:`_sqltypes.Enum.native_enum` parameter would not be correctly copied to the mapped column datatype, if it were overridden as stated in the documentation to set this parameter to False. Fixes: #9187 Fixes: #9200 Closes: #9191 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9191 Pull-request-sha: 7d13f705307bf62560fc831f6f049a425d411374 Change-Id: Ife3ba2655f4897f806d6a9cf0041c69fd4f39e9d
* | Merge "Fixed typing of limit, offset and fetch to allow ``None``." into mainFederico Caselli2023-01-311-6/+3
|\ \
| * | Fixed typing of limit, offset and fetch to allow ``None``.Federico Caselli2023-01-311-6/+3
| | | | | | | | | | | | | | | Fixes: #9183 Change-Id: I1ac3e3698034826122ea8a0cdc9f8f55a10ed6c1
* | | Merge "Unify doc typing" into mainFederico Caselli2023-01-311-1/+1
|\ \ \ | |_|/ |/| |
| * | Unify doc typingHarry Lees2023-01-311-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Description <!-- Describe your changes in detail --> Fixes #9168 This PR replaces common occurrences of [PEP 585](https://peps.python.org/pep-0585/) style type annotations with annotations compatible with older versions of Python. I searched for instances of the following supported types from the PEP and replaced with their legacy typing couterparts. * tuple # typing.Tuple * list # typing.List * dict # typing.Dict * set # typing.Set * frozenset # typing.FrozenSet * type # typing.Type ``` grep -r "list\[.*\]" ./build --exclude-dir="./build/venv/*" --exclude-dir="./build/output/*" --exclude="changelog_[0-9]*\.rst" ``` I excluded changelog files from being altered, I think some of these could be changed if necessary but others are likely to require manual checking as the change may target the new typing style specifically. For any examples that included imports, I tried to ensure that the correct typing imports were included and properly ordered. ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [x] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. Closes: #9198 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9198 Pull-request-sha: 05ad4651b57c6275b29433e5e76e166344ba6c4c Change-Id: I41b93b3dee85f9fe00cfbb3d3eb011212795de29
* | support NewType in type_annotation_mapMike Bayer2023-01-311-9/+22
|/ | | | | | | | | | | | | | | | | Added support for :pep:`484` ``NewType`` to be used in the :paramref:`_orm.registry.type_annotation_map` as well as within :class:`.Mapped` constructs. These types will behave in the same way as custom subclasses of types right now; they must appear explicitly within the :paramref:`_orm.registry.type_annotation_map` to be mapped. Within this change, the lookup between decl_api._resolve_type and TypeEngine._resolve_for_python_type is streamlined to not inspect the given type multiple times, instead passing in from decl_api to TypeEngine the already "flattened" version of a Generic or NewType type. Fixes: #9175 Change-Id: I227cf84b4b88e4567fa2d1d7da0c05b54e00c562
* Merge "MappedAsDataclass applies @dataclasses.dataclass unconditionally" ↵mike bayer2023-01-312-4/+22
|\ | | | | | | into main
| * MappedAsDataclass applies @dataclasses.dataclass unconditionallyMike Bayer2023-01-302-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using the :class:`.MappedAsDataclass` superclass, all classes within the hierarchy that are subclasses of this class will now be run through the ``@dataclasses.dataclass`` function whether or not they are actually mapped, so that non-ORM fields declared on non-mapped classes within the hierarchy will be used when mapped subclasses are turned into dataclasses. This behavior applies both to intermediary classes mapped with ``__abstract__ = True`` as well as to the user-defined declarative base itself, assuming :class:`.MappedAsDataclass` is present as a superclass for these classes. This allows non-mapped attributes such as ``InitVar`` declarations on superclasses to be used, without the need to run the ``@dataclasses.dataclass`` decorator explicitly on each non-mapped class. The new behavior is considered as correct as this is what the :pep:`681` implementation expects when using a superclass to indicate dataclass behavior. Fixes: #9179 Change-Id: Ia01fa9806a27f7c1121bf7eaddf2847cf6dc5313
* | consolidate warning re: selectinload.recursion_depthMike Bayer2023-01-311-2/+3
| | | | | | | | | | Change-Id: I527c5ba52451cd8a926ddea8e5469b9390cfcb27 References: #9199
* | Merge "add __init__ to DeclarativeBase directly" into mainmike bayer2023-01-311-1/+50
|\ \
| * | add __init__ to DeclarativeBase directlyMike Bayer2023-01-281-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression in :class:`.DeclarativeBase` class where the registry's default constructor would not be applied to the base itself, which is different from how the previous :func:`_orm.declarative_base` construct works. This would prevent a mapped class with its own ``__init__()`` method from calling ``super().__init__()`` in order to access the registry's default constructor and automatically populate attributes, instead hitting ``object.__init__()`` which would raise a ``TypeError`` on any arguments. This is a very simple change in code, however explaining it is very complicated. Fixes: #9171 Change-Id: I4baecdf671861a8198d835e286fe19a51ecda126
* | | Merge "derive optional for nullable from interior of pep-593 types" into mainmike bayer2023-01-311-3/+12
|\ \ \
| * | | derive optional for nullable from interior of pep-593 typesMike Bayer2023-01-291-3/+12
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improved the ruleset used to interpret :pep:`593` ``Annotated`` types when used with Annotated Declarative mapping, the inner type will be checked for "Optional" in all cases which will be added to the criteria by which the column is set as "nullable" or not; if the type within the ``Annotated`` container is optional (or unioned with ``None``), the column will be considered nullable if there are no explicit :paramref:`_orm.mapped_column.nullable` parameters overriding it. Fixes: #9177 Change-Id: I4b1240da198e35b93006fd90f6cb259c9d2cbf30
* | | apply of_type error message to load.options() as wellMike Bayer2023-01-301-30/+41
|/ / | | | | | | | | | | | | | | | | | | | | | | Improved the error reporting when linking strategy options from a base class to another attribute that's off a subclass, where ``of_type()`` should be used. Previously, when :meth:`.Load.options` is used, the message would lack informative detail that ``of_type()`` should be used, which was not the case when linking the options directly. The informative detail now emits even if :meth:`.Load.options` is used. Fixes: #9182 Change-Id: Ibc14923d0cbca9114316cb7db2b30f091dc28af8
* | Place DDLConstraintColumn Role in MappedMike Bayer2023-01-283-3/+2
|/ | | | | | | | | | Fixed typing issue where :func:`_orm.mapped_column` objects typed as :class:`_orm.Mapped` wouldn't be accepted in schema constraints such as :class:`_schema.ForeignKey`, :class:`_schema.UniqueConstraint` or :class:`_schema.Index`. Fixes: #9170 Change-Id: I41c76d224a1fa2377de151d2a713ba3f43bd245c
* fix regression based on mis-match of set/frozensetMike Bayer2023-01-271-1/+5
| | | | | | | | | Fixed regression where ORM models that used joined table inheritance with a composite foreign key would encounter an internal error in the mapper internals. Fixes: #9164 Change-Id: I8fdcdf6d72f3304bee191498d5554555b0ab7855
* add hooks/docs for automap w/ multiple schemasMike Bayer2023-01-261-3/+28
| | | | | | | | | | | Added new feature to :class:`.Automap` for autoload of classes across multiple schemas which may have overlapping names, by providing both a :paramref:`.Automap.prepare.modulename_for_class` parameter as well as a new collection :attr:`.AutomapBase.by_module`, which stores a dot-separated namespace of module names linked to classes. Fixes: #5145 Change-Id: I735fecaacdfc267f1f901d76c2b3880e48f5969d
* add Mapped to _ORMColCollectionElementMike Bayer2023-01-261-1/+1
| | | | | | | | | Fixed issue where using the :paramref:`_orm.relationship.remote_side` and similar parameters, passing an annotated declarative object typed as :class:`_orm.Mapped`, would not be accepted by the type checker. Fixes: #9150 Change-Id: I5770c17ee4ad8c54661354da9582ec3c4706ffcc
* Merge "add context for warnings emitted from configure_mappers(), ↵mike bayer2023-01-262-0/+12
|\ | | | | | | autoflush()" into main
| * add context for warnings emitted from configure_mappers(), autoflush()jonathan vanasco2023-01-242-0/+12
| | | | | | | | | | | | | | | | | | | | | | Improved the notification of warnings that are emitted within the configure mappers or flush process, which are often invoked as part of a different operation, to add additional context to the message that indicates one of these operations as the source of the warning within operations that may not be obviously related. Fixes: #7305 Change-Id: I79da7a6a5d4cf67d57615d0ffc2b8d8454011c84
* | add set_shard_id() loader option for horizontal shardMike Bayer2023-01-252-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new option to horizontal sharding API :class:`_horizontal.set_shard_id` which sets the effective shard identifier to query against, for both the primary query as well as for all secondary loaders including relationship eager loaders as well as relationship and column lazy loaders. Modernize sharding examples with new-style mappings, add new asyncio example. Fixes: #7226 Fixes: #7028 Change-Id: Ie69248060c305e8de04f75a529949777944ad511
* | Merge "Add public protocol for mapped class" into mainmike bayer2023-01-252-28/+52
|\ \ | |/ |/|
| * Add public protocol for mapped classFederico Caselli2023-01-252-28/+52
| | | | | | | | | | Fixes: #8624 Change-Id: Ia7a66ae9ba534ed7152f95dfd0f7d05b9d00165a
* | Type annotations for sqlalchemy.orm.mapped_collectionMaksim Latysh2023-01-241-39/+97
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <!-- Provide a general summary of your proposed changes in the Title field above --> ### Description <!-- Describe your changes in detail --> An attempt to annotate lib/sqlalchemy/orm/mapped_collection.py with type hints (issue https://github.com/sqlalchemy/sqlalchemy/issues/6810) ### Checklist <!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once) --> This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #<issue number>` in the commit message - please include tests. Closes: #9140 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9140 Pull-request-sha: facb4717134943dd651905f7c72618eb66a9eca5 Change-Id: I0fb80e2ea7ed2247c494487fb6c8d72efb4e9802