summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | Guard against wrong dataclass mappingFederico Caselli2023-02-053-0/+38
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-053-0/+145
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | disallow ORM instrumented attributes from reaching dataclassesMike Bayer2023-02-033-0/+145
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-055-129/+81
|\ \ \ \ | |_|/ / |/| | |
| * | | dont add non-server-side cols to returning for versioningMike Bayer2023-02-035-129/+81
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Add 'or' comment between code blocks (#9236)AM-ops2023-02-041-0/+3
| |/ |/|
* | Merge "Fixed regression when using from_statement in orm context." into mainFederico Caselli2023-02-033-9/+29
|\ \
| * | Fixed regression when using from_statement in orm context.Mike Bayer2023-02-033-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Use correct dialect annotationFederico Caselli2023-02-022-2/+5
| |/ |/| | | | | | | Fixes: #9222 Change-Id: Ife841a5cf5ec896405e84d8570ef63ce6176a5ec
* | improve typing issue templateFederico Caselli2023-02-011-1/+23
| | | | | | | | Change-Id: Ifa68268ddeef0de20bfe95cb1991cc5de0250962
* | Fix minor documentation glitch, replace "row" with "column" (#9215)Lele Gaifax2023-02-011-1/+1
|/
* Version 2.0.2 placeholderMike Bayer2023-02-012-1/+5
|
* - 2.0.1rel_2_0_1Mike Bayer2023-02-0115-165/+178
|
* changelog tweaksMike Bayer2023-02-012-3/+7
| | | | Change-Id: I479adc6f387a31dbaf232fa22374118c1ce94bea
* fix late-eval exampleMike Bayer2023-02-011-1/+1
| | | | | Fixes: #9209 Change-Id: Ic5bc87b25281e3cecc967843c402e96c7c2a3dbb
* Merge "Add support for typing.Literal in Mapped" into mainmike bayer2023-02-018-252/+923
|\
| * Add support for typing.Literal in MappedFrederik Aalund2023-01-318-252/+923
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-317-19/+40
|\ \
| * | Fixed typing of limit, offset and fetch to allow ``None``.Federico Caselli2023-01-317-19/+40
| | | | | | | | | | | | | | | Fixes: #9183 Change-Id: I1ac3e3698034826122ea8a0cdc9f8f55a10ed6c1
* | | Merge "Unify doc typing" into mainFederico Caselli2023-01-3119-93/+102
|\ \ \ | |_|/ |/| |
| * | Unify doc typingHarry Lees2023-01-3119-93/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### 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-317-32/+167
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | block asyncmy 0.2.6Mike Bayer2023-01-311-1/+1
|/ | | | | | | The package seems fine but the wheels on the site are bad. Change-Id: I941eacbad880102788c0f6d285a212fc9178a385 References: https://github.com/long2ice/asyncmy/issues/48
* Merge "MappedAsDataclass applies @dataclasses.dataclass unconditionally" ↵mike bayer2023-01-314-6/+210
|\ | | | | | | into main
| * MappedAsDataclass applies @dataclasses.dataclass unconditionallyMike Bayer2023-01-304-6/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-313-1/+163
|\ \
| * | add __init__ to DeclarativeBase directlyMike Bayer2023-01-283-1/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-314-3/+145
|\ \ \
| * | | derive optional for nullable from interior of pep-593 typesMike Bayer2023-01-294-3/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-306-64/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge "don't count / gather INSERT bind names inside of a CTE" into mainmike bayer2023-01-305-44/+302
|\ \ \ \ | |_|_|/ |/| | |
| * | | don't count / gather INSERT bind names inside of a CTEMike Bayer2023-01-305-44/+302
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression related to the implementation for the new "insertmanyvalues" feature where an internal ``TypeError`` would occur in arrangements where a :func:`_sql.insert` would be referred towards inside of another :func:`_sql.insert` via a CTE; made additional repairs for this use case for positional dialects such as asyncpg when using "insertmanyvalues". at the core here is a change to positional insertmanyvalues where we now get exactly the positions for the "manyvalues" within the larger list, allowing non-"manyvalues" on the left and right sides at the same time, not assuming anything about how RETURNING renders etc., since CTEs are in the mix also. Fixes: #9173 Change-Id: I5ff071fbef0d92a2d6046b9c4e609bb008438afd
* | | fix post-production typo for #9174Mike Bayer2023-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | merged in cae662a6383d3ae8f3673c70c3118ea3a1a1606e with one typo fix afterwards Fixes: #9174 Change-Id: I5a525da8a95f40c75da627fed49ce828bd498248
* | | Revert "fix post-production typo for #9174"Mike Bayer2023-01-302-5/+1
| | | | | | | | | | | | | | | | | | This reverts commit 3b60c3f53eab8ee5896b3fde525bcf31d4233658. some scratch code for isolation levels got pushed :(
* | | fix post-production typo for #9174Mike Bayer2023-01-302-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | merged in cae662a6383d3ae8f3673c70c3118ea3a1a1606e with one typo fix afterwards Fixes: #9174 Change-Id: I5a525da8a95f40c75da627fed49ce828bd498248
* | | Merge "allow single tables and entities for "of"" into mainmike bayer2023-01-304-19/+34
|\ \ \
| * | | allow single tables and entities for "of"Mike Bayer2023-01-294-19/+34
| |/ / | | | | | | | | | | | | | | | | | | | | | Opened up typing on :meth:`.Select.with_for_update.of` to also accept table and mapped class arguments, as seems to be available for the MySQL dialect. Fixes: #9174 Change-Id: I15659d7084657564bd5a2aa55ef0e4db51b91247
* | | use scalars().one() for count migrationMike Bayer2023-01-301-4/+4
|/ / | | | | | | | | | | | | so that the typed result is non-optional Fixes: #9184 Change-Id: I40e655010d08f795f3b835b9327ce50c6ec72135
* | Merge "Place DDLConstraintColumn Role in Mapped" into mainmike bayer2023-01-285-5/+18
|\ \
| * | Place DDLConstraintColumn Role in MappedMike Bayer2023-01-285-5/+18
| |/ | | | | | | | | | | | | | | | | | | 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
* | reword changelog + credit contributor for #9156Mike Bayer2023-01-281-3/+3
|/ | | | Change-Id: Ib5ab3cedd30ee0b0486c12e7c20b07aa76be1128
* Merge "Set correct type annotations for ColumnElement.cast" into mainmike bayer2023-01-283-1/+19
|\
| * Set correct type annotations for ColumnElement.castYurii Karabas2023-01-283-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <!-- Provide a general summary of your proposed changes in the Title field above --> Fixes: #9156 ### Description <!-- Describe your changes in detail --> ### 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 - [x] 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. **Have a nice day!** Closes: #9157 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9157 Pull-request-sha: 321dac184ee0d317296a689d7c8e47bf1464bcce Change-Id: I99fe759a21de910f34bae3bb919e82cd08969e81
* | Correct #7664 to include DropSchemaMike Bayer2023-01-285-3/+41
|/ | | | | | | | | | Corrected the fix for :ticket:`7664`, released in version 2.0.0, to also include :class:`.DropSchema` which was inadvertently missed in this fix, allowing stringification without a dialect. The fixes for both constructs is backported to the 1.4 series as of 1.4.47. Fixes: #7664 Change-Id: I509b7500ee496ac1e444ea2096c2a02520167e6d
* Merge "fix regression based on mis-match of set/frozenset" into mainmike bayer2023-01-283-1/+70
|\
| * fix regression based on mis-match of set/frozensetMike Bayer2023-01-273-1/+70
| | | | | | | | | | | | | | | | | | 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
* | remove redundant wheel dep from pyproject.tomlMichał Górny2023-01-271-1/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Description Remove the redundant `wheel` dependency, as it is added by the backend automatically. Listing it explicitly in the documentation was a historical mistake and has been fixed since, see: https://github.com/pypa/setuptools/commit/f7d30a9529378cf69054b5176249e5457aaf640a ### Checklist This pull request is: - [x] A misc build system change (it doesn't really fit the other categories) - [ ] 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. **Have a nice day!** Closes: #9153 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9153 Pull-request-sha: 8f2d8991f9c057b2dd1a0ca7017968e6eb35e5c8 Change-Id: I877e56819cd3068d94721a7094880366fb2abc9b
* Version 2.0.1 placeholderMike Bayer2023-01-262-1/+5
|
* - 2.0.0rel_2_0_0Mike Bayer2023-01-269-133/+147
|