summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ensure event handlers called for all do_pingticket_5648Mike Bayer2023-03-0110-51/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | The support for pool ping listeners to receive exception events via the :meth:`.ConnectionEvents.handle_error` event added in 2.0.0b1 for :ticket:`5648` failed to take into account dialect-specific ping routines such as that of MySQL and PostgreSQL. The dialect feature has been reworked so that all dialects participate within event handling. Additionally, a new boolean element :attr:`.ExceptionContext.is_pre_ping` is added which identifies if this operation is occurring within the pre-ping operation. For this release, third party dialects which implement a custom :meth:`_engine.Dialect.do_ping` method can opt in to the newly improved behavior by having their method no longer catch exceptions or check exceptions for "is_disconnect", instead just propagating all exceptions outwards. Checking the exception for "is_disconnect" is now done by an enclosing method on the default dialect, which ensures that the event hook is invoked for all exception scenarios before testing the exception as a "disconnect" exception. If an existing ``do_ping()`` method continues to catch exceptions and check "is_disconnect", it will continue to work as it did previously, but ``handle_error`` hooks will not have access to the exception if it isn't propagated outwards. Fixes: #5648 Change-Id: I6535d5cb389e1a761aad8c37cfeb332c548b876d
* 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
|\
| * Improve ``oracledb`` thick mode flag.Federico Caselli2023-02-144-12/+27
| | | | | | | | | | | | | | | | Adjusted ``oracledb`` thick mode flag to make ``thick_mode=False`` not enable thick mode. Previously only ``None`` was accepted as off value. Fixes: #9295 Change-Id: I1a8397c19d065dfc2dda597e719922fc8d31acb1
* | Merge "Add ``Table.autoincrement_column``" into mainmike bayer2023-02-153-2/+32
|\ \
| * | Add ``Table.autoincrement_column``Federico Caselli2023-02-143-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | Added public property :attr:`_sql.Table.autoincrement_column` that returns the column identified as autoincrementing in the column. Fixes: #9277 Change-Id: If60d6f92e0df94f57d00ff6d89d285c61b02f5a4
* | | Merge "test dataclasses.KW_ONLY" into mainmike bayer2023-02-151-2/+20
|\ \ \
| * | | test dataclasses.KW_ONLYMike Bayer2023-02-141-2/+20
| | |/ | |/| | | | | | | | | | | | | | | | had no test support for this, seems to work. gets grabbed in annotations and applied correctly. Change-Id: I2cd7ad7b376f38f945d2007b316a1316271f9a0f
* | | fix typo in whatsnew (#9303)Andrei Pozolotin2023-02-141-1/+1
| | | | | | | | | see #9294
* | | fix typo "Annotation" -> "Annotated" and use typing_extensionsMike Bayer2023-02-141-2/+2
|/ / | | | | | | | | Fixes: #9305 Change-Id: I9f0ab24f609f6f557b5780209a85f0abe82b363e
* | fix documentation formattingFederico Caselli2023-02-131-1/+3
| | | | | | | | Change-Id: I3307e1844237b58486dcce334eab80689e116bb8
* | completely lift-and-copy and_ / or_ documentationMike Bayer2023-02-131-0/+108
| | | | | | | | | | | | | | | | Sphinx refuses to write the correct docstring for these without placing a completely literal string with no interpolation of any kind. Current site has blank for these. Change-Id: Ie19a0b89d05b45509708585e6efca1a35f30adb5
* | note column ordering change, indicate recipe to control orderingMike Bayer2023-02-132-0/+134
| | | | | | | | | | Change-Id: I520c18ac8c84923558e2042265943b6340700788 References: #9294
* | Fix docs for `case` expression to match new syntax (#9279)Abdulhaq Emhemmed2023-02-103-7/+7
| | | | | | | | | | | | | | | | | | * 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
* | add requirement, restore test removed in ↵Federico Caselli2023-02-102-0/+3
|/ | | | | | eb0861e8e69f8ce702301c558e552e1aeb2e9eba Change-Id: I78c12a58eef59ff577a88880a8752151051fd939
* generalize adapt_on_names to expect non-named elementsMike Bayer2023-02-107-17/+130
| | | | | | | | | | | | | | | | | | | | 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
* Version 2.0.4 placeholderMike Bayer2023-02-092-1/+5
|
* - 2.0.3rel_2_0_3Mike Bayer2023-02-094-19/+21
|
* apply self_group to all elements of multi-expressionMike Bayer2023-02-093-32/+99
| | | | | | | | | | | Fixed critical regression in SQL expression formulation in the 2.0 series due to :ticket:`7744` which improved support for SQL expressions that contained many elements against the same operator repeatedly; parenthesis grouping would be lost with expression elements beyond the first two elements. Fixes: #9271 Change-Id: Ib6ed5b71efe0f6816dab75bda622297fc89e3b49
* pin sphinx-copybutton and change configMike Bayer2023-02-092-1/+7
| | | | | | | | | | | | | | | | sphinx-copybutton introduced a new feature in 0.5.1 which includes a default configuration that breaks the regexp prompt matching scheme. set copybutton_exclude to not include ".gp" as that's the class where we exactly look for the prompts we are matching. While we're there, use this new feature to exclude our sql styles, even though this is not strictly necessary in our case. pin sphinx-copybutton at 0.5.1 to avoid future problems. Change-Id: I8eaeab13995c032b9ee3afd1f08dae5929009d45 References: https://github.com/executablebooks/sphinx-copybutton/issues/185
* add test for #9268Mike Bayer2023-02-081-0/+18
| | | | Change-Id: I3075472de51b9d0d429f7f6204093f3e481fc121
* typing: fix hybrid property setter (#9269)Mehdi ABAAKOUK2023-02-081-1/+1
| | | Fixes #9268
* Merge "Remove `typing.Self` workaround" into mainmike bayer2023-02-0829-706/+382
|\
| * Remove `typing.Self` workaroundYurii Karabas2023-02-0829-706/+382
| | | | | | | | | | | | | | | | | | | | | | | | 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 "use Dict[], not dict[] in mypy test" into mainFederico Caselli2023-02-081-1/+2
|\ \ | |/ |/|