summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Rectify reference to class LambdaElement, misnamed as LamdaElement (#9037)Lele Gaifax2022-12-291-1/+1
| | | | | | Fixes #9034. (cherry picked from commit 532373b18f2e77910bb642a27a2cca3179499389)
* Version 2.0.0rc2 placeholderMike Bayer2022-12-282-1/+5
|
* - 2.0.0rc1rel_2_0_0rc1Mike Bayer2022-12-2816-280/+294
|
* note that 2.0 has behavioral changes outside of the 1.4->2.0 processMike Bayer2022-12-281-3/+21
| | | | Change-Id: I0ab9611c75f592acec73ca92271f970eae74d7ab
* changelog adjustmentsMike Bayer2022-12-289-6/+24
| | | | | | include backport markings Change-Id: I810923a641977569b8b4d9967e84b8cb684e7a52
* Merge "ensure whereclause, returning copied as tuples" into mainmike bayer2022-12-284-16/+78
|\
| * ensure whereclause, returning copied as tuplesMike Bayer2022-12-284-16/+78
| | | | | | | | | | | | | | | | | | | | Fixed issue in the internal SQL traversal for DML statements like :class:`_dml.Update` and :class:`_dml.Delete` which would cause among other potential issues, a specific issue using lambda statements with the ORM update/delete feature. Fixes: #9033 Change-Id: I76428049cb767ba302fbea89555114bf63ab8687
* | Type annotations for sqlalchemy.orm.eventsGleb Kisenkov2022-12-281-144/+352
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <!-- Provide a general summary of your proposed changes in the Title field above --> ### Description An attempt to annotate `lib/sqlalchemy/orm/events.py` with type hints (issue #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. - [x] 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: #9025 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9025 Pull-request-sha: a3fd2c0c3790164c433305ccc7ac6b73e813e037 Change-Id: I0808b6485504615fa20691dc8f4631d38bc89ab3
* Merge "rename 2.0.0b5 to 2.0.0rc1" into mainmike bayer2022-12-2818-28/+28
|\
| * rename 2.0.0b5 to 2.0.0rc1Mike Bayer2022-12-2718-28/+28
| | | | | | | | | | | | it's hoped for 2.0.0 final to be next, in early January Change-Id: If4285f0929f4a2895f2bc93d9e8336599b973bcf
* | Merge "remove errant NO_KEY symbol" into mainmike bayer2022-12-282-8/+10
|\ \ | |/ |/|
| * remove errant NO_KEY symbolMike Bayer2022-12-272-8/+10
| | | | | | | | | | | | | | | | | | | | the symbol from base is used in the event API and is passed along from attributes here. for the additional use where it's an exception case for attribute name as passed by hybrid, use a different symbol name. Change-Id: I8c5c0e71d19185ebec64f2fcbfe1e9be74e54287
* | establish explicit join transaction modesMike Bayer2022-12-276-71/+551
|/ | | | | | | | | | | | | | | | | | | | | | | | The behavior of "joining an external transaction into a Session" has been revised and improved, allowing explicit control over how the :class:`_orm.Session` will accommodate an incoming :class:`_engine.Connection` that already has a transaction and possibly a savepoint already established. The new parameter :paramref:`_orm.Session.join_transaction_mode` includes a series of option values which can accommodate the existing transaction in several ways, most importantly allowing a :class:`_orm.Session` to operate in a fully transactional style using savepoints exclusively, while leaving the externally initiated transaction non-committed and active under all circumstances, allowing test suites to rollback all changes that take place within tests. Additionally, revised the :meth:`_orm.Session.close` method to fully close out savepoints that may still be present, which also allows the "external transaction" recipe to proceed without warnings if the :class:`_orm.Session` did not explicitly end its own SAVEPOINT transactions. Fixes: #9015 Change-Id: I31c22ee0fd9372fa0eddfe057e76544aee627107
* Merge "pass more contextual information to PyWrapper param create" into mainmike bayer2022-12-276-50/+178
|\
| * pass more contextual information to PyWrapper param createMike Bayer2022-12-276-50/+178
| | | | | | | | | | | | | | | | | | | | Fixed issue in lambda SQL feature where the calculated type of a literal value would not take into account the type coercion rules of the "compared to type", leading to a lack of typing information for SQL expressions, such as comparisons to :class:`.JSON` elements and similar. Fixes: #9029 Change-Id: I381c8d7458d98ba762313dee9ec47a9c1881f74a
* | dont prefix ssl args with "ssl" in the ssl dictMike Bayer2022-12-271-3/+3
|/ | | | | Fixes: #9031 Change-Id: I9ef077e7da5b2328a345f6526a6210ce82d807f6
* Merge "reorganize pre_session_exec around do_orm_execute" into mainmike bayer2022-12-2617-206/+677
|\
| * reorganize pre_session_exec around do_orm_executeMike Bayer2022-12-2617-206/+677
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow do_orm_execute() events to both receive the complete state of bind_argments, load_options, update_delete_options as they do already, but also allow them to *change* all those things via new execution options. Options like autoflush, populate_existing etc. can now be updated within a do_orm_execute() hook and those changes will take effect all the way through. Took a few tries to get something that covers every case here, in particular horizontal sharding which is consuming those options as well as using context.invoke(), without excess complexity. The good news seems to be that a simple reorg and replacing the "reentrant" boolean with "is this before do_orm_execute is invoked" was all that was needed. As part of this we add a new "identity_token" option allowing this option to be controlled from do_orm_execute() as well as from the outside. WIP Fixes: #7837 Change-Id: I087728215edec8d1b1712322ab389e3f52ff76ba
* | Merge "expand out Index if passed to "constraint"" into mainmike bayer2022-12-233-1/+52
|\ \
| * | expand out Index if passed to "constraint"Mike Bayer2022-12-223-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where the PostgreSQL :paramref:`_postgresql.OnConflictClause.constraint` parameter would accept an :class:`.Index` object, however would not expand this index out into its individual index expressions, instead rendering its name in an ON CONFLICT ON CONSTRAINT clause, which is not accepted by PostgreSQL; the "constraint name" form only accepts unique or exclude constraint names. The parameter continues to accept the index but now expands it out into its component expressions for the render. Fixes: #9023 Change-Id: I6baf243e26bfe578bf3f193c162dd7a623b6ede9
* | | improve async_sessionmaker docsMike Bayer2022-12-232-44/+75
|/ / | | | | | | | | | | | | | | | | * illustrate patterns where the async_sessionmaker is being reused. if you are not reusing it, there is no point to making it * fix reference to async_sessionmaker * add typing Change-Id: I22a260132b6e06574b5fe37af554829e38163de6
* | check for adapt to same class in AbstractRangeMike Bayer2022-12-214-3/+74
| | | | | | | | | | | | | | | | | | Fixed regression where newly revised PostgreSQL range types such as :class:`_postgresql.INT4RANGE` could not be set up as the impl of a :class:`.TypeDecorator` custom type, instead raising a ``TypeError``. Fixes: #9020 Change-Id: Ib881c3c7f63d000f49a09185a8663659a9970aa9
* | Merge "fix optimized tests, use backend=True" into mainmike bayer2022-12-211-10/+29
|\ \
| * | fix optimized tests, use backend=TrueMike Bayer2022-12-201-10/+29
| | | | | | | | | | | | | | | | | | | | | A failure on one of these tests for older SQLite wasn't caught because we did not have non-returning backends exercised Change-Id: I4e4c96a33580942a6f82b00fc7dde83c56d4d881
* | | Merge "add joins_implicitly to column_valued()" into mainmike bayer2022-12-203-19/+61
|\ \ \ | |/ / |/| |
| * | add joins_implicitly to column_valued()Mike Bayer2022-12-203-19/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added parameter :paramref:`.FunctionElement.column_valued.joins_implicitly`, which is useful in preventing the "cartesian product" warning when making use of table-valued or column-valued functions. This parameter was already introduced for :meth:`.FunctionElement.table_valued` in :ticket:`7845`, however it failed to be added for :meth:`.FunctionElement.column_valued` as well. Fixes: #9009 Change-Id: Ifb72fbcb4f4d2998e730d6f85ec7280df3bf3d47
* | | 8393 will be backported to 1.4Mike Bayer2022-12-201-0/+1
| | | | | | | | | | | | Change-Id: I54d17e8e74824826a856180c527159e0237605d4
* | | Merge "Add MACCADDR8 for PGCompiler" into mainmike bayer2022-12-207-1/+27
|\ \ \
| * | | Add MACCADDR8 for PGCompilerasimfarooq52022-12-197-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add MACCADDR8 for PGCompiler Closes: #8393 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8393 Pull-request-sha: 837a68eba3e31e0acbb7c47ee87bca4e9def7648 Change-Id: I87e4999eb8d82662ff8ab409c98dc57edd7fd271
* | | | Merge "remove __allow_unmapped__ requirement from dataclasses" into mainmike bayer2022-12-194-22/+136
|\ \ \ \ | |_|/ / |/| | |
| * | | remove __allow_unmapped__ requirement from dataclassesMike Bayer2022-12-194-22/+136
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed the requirement that the ``__allow_unmapped__`` attribute be used on Declarative Dataclass Mapped class when non-``Mapped[]`` annotations are detected; previously, an error message that was intended to support legacy ORM typed mappings would be raised, which additionally did not mention correct patterns to use with Dataclasses specifically. This error message is now no longer raised if :meth:`_orm.registry.mapped_as_dataclass` or :class:`_orm.MappedAsDataclass` is used. Fixes: #8973 Change-Id: I887afcc2da83dd904444bcb97f31e695b9f8b443
* | | add exclusion for unusual chars in column namesMike Bayer2022-12-193-0/+22
|/ / | | | | | | | | | | | | | | | | | | | | | | Added new exclusion rule for third party dialects called ``unusual_column_name_characters``, which can be "closed" for third party dialects that don't support column names with unusual characters such as dots, slashes, or percent signs in them, even if the name is properly quoted. Fixes: #9002 Change-Id: I44b765df4c73ce5ec1907d031fd9c89761fd99d1 References: #8993
* | Merge "include pk cols in refresh() if relationships are requested" into mainmike bayer2022-12-187-88/+444
|\ \
| * | include pk cols in refresh() if relationships are requestedMike Bayer2022-12-187-88/+444
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A series of changes and improvements regarding :meth:`_orm.Session.refresh`. The overall change is that primary key attributes for an object are now included in a refresh operation unconditionally when relationship-bound attributes are to be refreshed, even if not expired and even if not specified in the refresh. * Improved :meth:`_orm.Session.refresh` so that if autoflush is enabled (as is the default for :class:`_orm.Session`), the autoflush takes place at an earlier part of the refresh process so that pending primary key changes are applied without errors being raised. Previously, this autoflush took place too late in the process and the SELECT statement would not use the correct key to locate the row and an :class:`.InvalidRequestError` would be raised. * When the above condition is present, that is, unflushed primary key changes are present on the object, but autoflush is not enabled, the refresh() method now explicitly disallows the operation to proceed, and an informative :class:`.InvalidRequestError` is raised asking that the pending primary key changes be flushed first. Previously, this use case was simply broken and :class:`.InvalidRequestError` would be raised anyway. This restriction is so that it's safe for the primary key attributes to be refreshed, as is necessary for the case of being able to refresh the object with relationship-bound secondary eagerloaders also being emitted. This rule applies in all cases to keep API behavior consistent regardless of whether or not the PK cols are actually needed in the refresh, as it is unusual to be refreshing some attributes on an object while keeping other attributes "pending" in any case. * The :meth:`_orm.Session.refresh` method has been enhanced such that attributes which are :func:`_orm.relationship`-bound and linked to an eager loader, either at mapping time or via last-used loader options, will be refreshed in all cases even when a list of attributes is passed that does not include any columns on the parent row. This builds upon the feature first implemented for non-column attributes as part of :ticket:`1763` fixed in 1.4 allowing eagerly-loaded relationship-bound attributes to participate in the :meth:`_orm.Session.refresh` operation. If the refresh operation does not indicate any columns on the parent row to be refreshed, the primary key columns will nonetheless be included in the refresh operation, which allows the load to proceed into the secondary relationship loaders indicated as it does normally. Previously an :class:`.InvalidRequestError` error would be raised for this condition (:ticket:`8703`) * Fixed issue where an unnecessary additional SELECT would be emitted in the case where :meth:`_orm.Session.refresh` were called with a combination of expired attributes, as well as an eager loader such as :func:`_orm.selectinload` that emits a "secondary" query, if the primary key attributes were also in an expired state. As the primary key attributes are now included in the refresh automatically, there is no additional load for these attributes when a relationship loader goes to select for them (:ticket:`8997`) * Fixed regression caused by :ticket:`8126` released in 2.0.0b1 where the :meth:`_orm.Session.refresh` method would fail with an ``AttributeError``, if passed both an expired column name as well as the name of a relationship-bound attribute that was linked to a "secondary" eagerloader such as the :func:`_orm.selectinload` eager loader (:ticket:`8996`) Fixes: #8703 Fixes: #8996 Fixes: #8997 Fixes: #8126 Change-Id: I88dcbc0a9a8337f6af0bc4bcc5b0261819acd1c4
* | | Merge "dont call platform.architecture()" into mainmike bayer2022-12-182-1/+10
|\ \ \
| * | | dont call platform.architecture()Mike Bayer2022-12-162-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the base compat module was calling upon ``platform.architecture()`` in order to detect some system properties, which results in an over-broad system call against the system-level ``file`` call that is unavailable under some circumstances, including within some secure environment configurations. Fixes: #8995 Change-Id: Ib6171e75aff5a60a79dab81a0be21bee2456318b
* | | | fix changelog for types, add date rendering to whatsnewMike Bayer2022-12-173-6/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this change is likely somehting people want to see so make it more prominent, also there's no "types" category in changelog so these should be "sql". Change-Id: I9104c210448f3ba0304f1e09d0613240fe8dcf4e References: #8998
* | | | Merge "ensure all visit methods accept **kw" into mainmike bayer2022-12-178-48/+107
|\ \ \ \ | |_|/ / |/| | |
| * | | ensure all visit methods accept **kwMike Bayer2022-12-168-48/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added test support to ensure that all compiler ``visit_xyz()`` methods across all :class:`.Compiler` implementations in SQLAlchemy accept a ``**kw`` parameter, so that all compilers accept additional keyword arguments under all circumstances. Fixes: #8988 Change-Id: I1cefc313e4e64a10ee7dd14400137fbe02ce9523
* | | | Merge "make bind escape lookup extensible" into mainmike bayer2022-12-164-18/+144
|\ \ \ \ | |_|/ / |/| | |
| * | | make bind escape lookup extensibleMike Bayer2022-12-164-18/+144
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To accommodate for third party dialects with different character escaping needs regarding bound parameters, the system by which SQLAlchemy "escapes" (i.e., replaces with another character in its place) special characters in bound parameter names has been made extensible for third party dialects, using the :attr:`.SQLCompiler.bindname_escape_chars` dictionary which can be overridden at the class declaration level on any :class:`.SQLCompiler` subclass. As part of this change, also added the dot ``"."`` as a default "escaped" character. Fixes: #8994 Change-Id: I52fbbfa8c64497b123f57327113df3f022bd1419
* | | Merge "add eager_defaults="auto" for inserts" into mainmike bayer2022-12-1613-166/+606
|\ \ \ | |/ / |/| |
| * | add eager_defaults="auto" for insertsMike Bayer2022-12-1513-166/+606
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new default value for the :paramref:`.Mapper.eager_defaults` parameter "auto", which will automatically fetch table default values during a unit of work flush, if the dialect supports RETURNING for the INSERT being run, as well as :ref:`insertmanyvalues <engine_insertmanyvalues>` available. Eager fetches for server-side UPDATE defaults, which are very uncommon, continue to only take place if :paramref:`.Mapper.eager_defaults` is set to ``True``, as there is no batch-RETURNING form for UPDATE statements. Fixes: #8889 Change-Id: I84b91092a37c4cd216e060513acde3eb0298abe9
* | | Merge "implement literal_binds with expanding + bind_expression" into mainmike bayer2022-12-163-26/+96
|\ \ \
| * | | implement literal_binds with expanding + bind_expressionMike Bayer2022-12-153-26/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where SQL compilation would fail to make use of :meth:`_types.TypeEngine.bind_expression` on a given type when used in the context of an "expanding" (i.e. "IN") parameter with the ``literal_binds`` compiler parameter in use. Fixes: #8989 Change-Id: Ic9fd27b46381b488117295ea5a492d8fc158e39f
* | | | Merge "add explicit REGCONFIG, pg full text functions" into mainmike bayer2022-12-1610-14/+655
|\ \ \ \
| * | | | add explicit REGCONFIG, pg full text functionsMike Bayer2022-12-1510-14/+655
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for explicit use of PG full text functions with asyncpg and psycopg (SQLAlchemy 2.0 only), with regards to the ``REGCONFIG`` type cast for the first argument, which previously would be incorrectly cast to a VARCHAR, causing failures on these dialects that rely upon explicit type casts. This includes support for :class:`_postgresql.to_tsvector`, :class:`_postgresql.to_tsquery`, :class:`_postgresql.plainto_tsquery`, :class:`_postgresql.phraseto_tsquery`, :class:`_postgresql.websearch_to_tsquery`, :class:`_postgresql.ts_headline`, each of which will determine based on number of arguments passed if the first string argument should be interpreted as a PostgreSQL "REGCONFIG" value; if so, the argument is typed using a newly added type object :class:`_postgresql.REGCONFIG` which is then explicitly cast in the SQL expression. Fixes: #8977 Change-Id: Ib36698a984fd4194bd6e0eb663105f790f3db7d3
* | | | Merge "Improved error message in orm annotated declarative" into mainmike bayer2022-12-163-7/+54
|\ \ \ \
| * | | | Improved error message in orm annotated declarativeFederico Caselli2022-12-143-7/+54
| | |_|/ | |/| | | | | | | | | | | | | | Fixes: #8980 Change-Id: I32c4cf8715ee43fa8415f0102394ddd43b1fee0a
* | | | Merge "Improve v2 documentation" into mainmike bayer2022-12-153-12/+161
|\ \ \ \