summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Improve orm event docsFederico Caselli2023-02-272-9/+17
| | | | | | | | | | | | | | | | Change-Id: Ia4f8ce497565c9d5e8df4ef7cc3c3e645f995ff3
* | | | ensure single import per lineMike Bayer2023-02-2827-120/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the very small plugin flake8-import-single which will prevent us from having an import with more than one symbol on a line. Flake8 by itself prevents this pattern with E401: import collections, os, sys However does not do anything with this: from sqlalchemy import Column, text Both statements have the same issues generating merge artifacts as well as presenting a manual decision to be made. While zimports generally cleans up such imports at the top level, we don't enforce zimports / pre-commit use. the plugin finds the same issue for imports that are inside of test methods. We shouldn't usually have imports in test methods so most of them here are moved to be top level. The version is pinned at 0.1.5; the project seems to have no activity since 2019, however there are three 0.1.6dev releases on pypi which stopped in September 2019, they seem to be experiments with packaging. The source for 0.1.5 is extremely simple and only reveals one method to flake8 (the run() method). Change-Id: Icea894e43bad9c0b5d4feb5f49c6c666d6ea6aa1
* | | | Improve exclude constraint docs and tests.Federico Caselli2023-02-272-11/+28
| |/ / |/| | | | | | | | | | | | | | Follow up of 71693c94d52612a5e88128575ff308ee4a923c00 Change-Id: Icc9d9942bda92171581dec82cf0cacbd3e3e4162
* | | Merge "Add separate version notes for scalars" into mainmike bayer2023-02-274-4/+14
|\ \ \
| * | | Add separate version notes for scalarsGrey Li2023-02-265-5/+15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add separate 1.4.24 and 1.4.26 version notes for the .scalars method; this covers Session, scoped_session, AsyncSession, async_scoped_session as the "scoped" versions did not have the method added until 1.4.26 as part of :ticket:`7103`. Also indicate scoped_session as ``sqlalchemy.orm.scoped_session`` in docs rather than ``sqlalchemy.orm.scoping.scoped_session``. This is also happening in I77da54891860095edcb1f0625ead99fee89bd76f separately, as both changesets refer to scoped_session without using ".scoping". References: #7103 Closes: #9371 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9371 Pull-request-sha: 61132230cc6e897ab61beff25d98b19a4c0aefd0 Change-Id: I84c8b1aad752db124cfee6bc8516f6eed7ba2faf
* | | Merge "include columns from superclasses that indicate "selectin"" into mainmike bayer2023-02-274-15/+360
|\ \ \
| * | | include columns from superclasses that indicate "selectin"Mike Bayer2023-02-274-15/+360
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for the :paramref:`_orm.Mapper.polymorphic_load` parameter to be applied to each mapper in an inheritance hierarchy more than one level deep, allowing columns to load for all classes in the hierarchy that indicate ``"selectin"`` using a single statement, rather than ignoring elements on those intermediary classes that nonetheless indicate they also would participate in ``"selectin"`` loading and were not part of the base-most SELECT statement. Fixes: #9373 Change-Id: If8dcba0f0191f6c2818ecd15870bccfdf5ce1112
* | | Merge "fix with_polymorphic" into mainmike bayer2023-02-274-2/+71
|\ \ \
| * | | fix with_polymorphicMike Bayer2023-02-264-2/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed typing issue where :func:`_orm.with_polymorphic` would not record the class type correctly. Fixes: #9340 Change-Id: I535ad9aede9b60475231028adb8dc270e55738a4
* | | | remove reveal_type importMike Bayer2023-02-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | this is not really a thing until python 3.11 Change-Id: I4807fb01b718aa1b76dd70c561143acb22ff7b6c
* | | | Merge "Create public QueryPropertyDescriptor type for query_property" into mainmike bayer2023-02-276-9/+65
|\ \ \ \
| * | | | Create public QueryPropertyDescriptor type for query_propertyFederico Caselli2023-02-266-9/+65
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exported the type returned by :meth:`_orm.scoped_session.query_property` using a new public type :class:`.orm.QueryPropertyDescriptor`. Also stated ``scoped_session()`` from ``sqlalchemy.orm`` in the documentation rather than from ``sqlalchemy.orm.scoping``. Fixes: #9338 Change-Id: I77da54891860095edcb1f0625ead99fee89bd76f
* | | | Merge "Declare KEY_OBJECTS_ONLY as cdef variable" into mainmike bayer2023-02-272-2/+11
|\ \ \ \
| * | | | Declare KEY_OBJECTS_ONLY as cdef variableMatus Valo2023-02-262-2/+11
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small optimization to the Cython implementation of :class:`.ResultProxy` using a cdef for a particular int value to avoid Python overhead. Pull request courtesy Matus Valo. Fixes: #9343 Closes: #9344 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9344 Pull-request-sha: fc6a97debe45497ef502f3861611b021a5885b63 Change-Id: I231d4fb292decfe9bccdf54f2851ce6f69d5d6c7
* | | | Merge "apply a fixed locals w/ Mapped to all de-stringify" into mainmike bayer2023-02-278-14/+160
|\ \ \ \
| * | | | apply a fixed locals w/ Mapped to all de-stringifyMike Bayer2023-02-268-14/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continued the fix for :ticket:`8853`, allowing the :class:`_orm.Mapped` name to be fully qualified regardless of whether or not ``from __annotations__ import future`` were present. This issue first fixed in 2.0.0b3 confirmed that this case worked via the test suite, however the test suite apparently was not testing the behavior for the name ``Mapped`` not being locally present at all; string resolution has been updated to ensure the ``Mapped`` symbol is locatable as applies to how the ORM uses these functions. Fixes: #8853 Fixes: #9335 Change-Id: Id82d09aee906165a4d77c7da6a0b4177dd675c10
* | | | | Merge "use read-only Mapping for values dictionary type" into mainmike bayer2023-02-274-1/+49
|\ \ \ \ \
| * | | | | use read-only Mapping for values dictionary typeMike Bayer2023-02-264-1/+49
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improved typing for the mapping passed to :meth:`.UpdateBase.values` to be more open-ended about collection type, by indicating read-only ``Mapping`` instead of writeable ``Dict``, the latter of which would error out under typing tools on too limited of a key type. Fixes: #9376 Change-Id: Ib7fdbba05ca7e1082409e1b5616e6a010262f032
* | | | | Merge "locate automap base in hierarchy directly" into mainmike bayer2023-02-273-5/+38
|\ \ \ \ \
| * | | | | locate automap base in hierarchy directlyMike Bayer2023-02-243-5/+38
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in automap where calling ``.prepare()`` from one of the mapped classes would not use the correct base class when automap detected new tables, instead using the given class, leading to mappers trying to configure inheritance. While one should normally call ``.prepare()`` from the base in any case, it shouldn't misbehave that badly when called from a subclass. Fixes: #9367 Change-Id: I705d4d939d45af52bc58a74e65994205ab791634
* | | | | Merge "ExcludeConstraint literal_compile" into mainmike bayer2023-02-274-11/+32
|\ \ \ \ \ | |_|/ / / |/| | | |
| * | | | ExcludeConstraint literal_compileFederico Caselli2023-02-224-11/+32
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | ExcludeConstraint correctly uses literal compile when compiling expression ddl. Fixes: #9349 Change-Id: I11a994ac46556a972afc696a2baad7ddbdd3de97
* | | | update case statement to v2 syntaxFederico Caselli2023-02-243-16/+10
| |/ / |/| | | | | | | | | | | | | | Change-Id: If278ea170e0a17b1e8ace2d470fb2fbdb7a6e9c1 References: #9370 References: #9365
* | | use Column for legacy dataclasses mappingMike Bayer2023-02-231-45/+33
|/ / | | | | | | | | Fixes: #9361 Change-Id: I9c433960664aa2b75cd03925d9dcf2e1ff27d8ce
* | add notes to all mapper flush events that these are only for flushMike Bayer2023-02-212-9/+53
|/ | | | | Fixes: #9339 Change-Id: I44542166417776733245e2ba39cd5de89b6d748b
* Fix the docstring of AppenerQuery.append() (#9336)Grey Li2023-02-201-2/+2
|
* Fix a syntax error in `AsyncConnection.stream_scalars()` example. (#9334)Vytautas Liuolia2023-02-191-1/+1
|
* Update dialect documentation about CrateDB (#9322)Andreas Motl2023-02-191-1/+1
| | | The `crate-0.30.0` package offers compatibility with SQLAlchemy 2.0.
* Fix grammatical error in intro.rst (#9316)Maxwell D. Dorliea2023-02-191-1/+1
|
* consider column.name directly when evaluating use_existing_columnMike Bayer2023-02-183-47/+116
| | | | | | | | | | | 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
* fix sphinx command got stuck in outputMike Bayer2023-02-171-2/+1
| | | | Change-Id: Idf68d2c5e40a3b072ad1cd479638f9eb364ba15f
* more editsMike Bayer2023-02-171-2/+2
| | | | | | | I can only see issues in the docs when they're live on the site, sorry Change-Id: I948b7c8e37657ca85d02843211cbfdb03aa5da75
* typo, captionsMike Bayer2023-02-171-1/+5
| | | | Change-Id: I547e66b60f5a7b2901a76ebc59469bce018e05ff
* Version 2.0.5 placeholderMike Bayer2023-02-172-1/+5
|
* - 2.0.4rel_2_0_4Mike Bayer2023-02-1711-122/+131
|
* changelog updatesMike Bayer2023-02-172-3/+5
| | | | Change-Id: Id28c5ae101cf462609740a698a1b188cce01bc5a
* rework hybrid docs furtherMike Bayer2023-02-172-89/+128
| | | | | | | we have a very complicated story to tell and we need to keep it within "reference doc" mode as much as we can Change-Id: I873b7d95aea7b5a1d04de0c78a4e88651c908b35
* Allow custom sorting of column in the ORM.Federico Caselli2023-02-1611-59/+136
| | | | | | | | | | | | | | | 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 "modernize hybrids and apply typing" into mainmike bayer2023-02-1710-231/+861
|\
| * modernize hybrids and apply typingMike Bayer2023-02-1610-231/+861
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improved the typing support for the :ref:`hybrids_toplevel` extension, updated all documentation to use ORM Annotated Declarative mappings, and added a new modifier called :attr:`.hybrid_property.inplace`. This modifier provides a way to alter the state of a :class:`.hybrid_property` **in place**, which is essentially what very early versions of hybrids did, before SQLAlchemy version 1.2.0 :ticket:`3912` changed this to remove in-place mutation. This in-place mutation is now restored on an **opt-in** basis to allow a single hybrid to have multiple methods set up, without the need to name all the methods the same and without the need to carefully "chain" differently-named methods in order to maintain the composition. Typing tools such as Mypy and Pyright do not allow same-named methods on a class, so with this change a succinct method of setting up hybrids with typing support is restored. Change-Id: Iea88025f023428f9f006846d09fbb4be391f5ebb References: #9321
* | Merge "Fix coercion issue for tuple bindparams" into mainmike bayer2023-02-165-4/+48
|\ \ | |/ |/|
| * Fix coercion issue for tuple bindparamsmike bayer2023-02-155-4/+48
| | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where element types of a tuple value would be hardcoded to take on the types from a compared-to tuple, when the comparison were using the :meth:`.ColumnOperators.in_` operator. This was inconsistent with the usual way that types are determined for a binary expression, which is that the actual element type on the right side is considered first before applying the left-hand-side type. Fixes: #9313 Change-Id: Ia8874c09682a6512fcf4084cf14481024959c461
* | Merge "rename EvaluatorCompiler to _EvaluatorCompiler" into mainmike bayer2023-02-165-6/+53
|\ \
| * | rename EvaluatorCompiler to _EvaluatorCompilerMike Bayer2023-02-165-6/+53
| |/ | | | | | | | | | | | | | | 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-165-31/+288
|\ \
| * | add dataclasses callable and apply annotations more strictlyMike Bayer2023-02-165-31/+288
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-169-32/+152
|/ | | | | | | | | | | | | | | | | | 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
* prevent float tests from running on asyncmyMike Bayer2023-02-154-4/+22
| | | | | | | | asyncmy 0.2.7 has had a loss in float precision for even very low numbers of significant digits. Change-Id: Iec6d2650943eeaa8e854f21990f6565d73331f8c References: https://github.com/long2ice/asyncmy/issues/56
* mention mypy>=1 is required to type check the libraryFederico Caselli2023-02-151-1/+3
| | | | Change-Id: Ie514c76b4f6b3241bba5083219a3eae19c2b7aae
* Merge "Improve ``oracledb`` thick mode flag." into mainmike bayer2023-02-154-12/+27
|\