summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
...
* | favor fast_executemany over insertmanyvalues when setMike Bayer2023-04-022-5/+13
|/ | | | | | | | | | | | | | | | | | | | | | | Changed the bulk INSERT strategy used for SQL Server "executemany" with pyodbc when ``fast_executemany`` is set to ``True`` by using ``fast_executemany`` / ``cursor.executemany()`` for bulk INSERT that does not include RETURNING, restoring the same behavior as was used in SQLAlchemy 1.4 when this parameter is set. For INSERT statements that use RETURNING, the "insertmanyvalues" strategy continues to be used as it is the only current strategy that supports RETURNING with bulk INSERT. Previously, SQLAlchemy 2.0 would use "insertmanyvalues" for all INSERT statements when ``use_insertmanyvalues`` was left at its default of ``False``, ignoring if ``fast_executemany`` was set. New performance details from end users have shown that ``fast_executemany`` is still much faster for very large datasets as it uses ODBC commands that can receive all rows in a single round trip, allowing for much larger datasizes than the batches that can be sent by the current "insertmanyvalues" strategy. Fixes: #9586 Change-Id: I85955a10ba77c26cdc0c22e362a827d7aaef2852
* Version 2.0.9 placeholderMike Bayer2023-03-311-1/+1
|
* Wrap dataclass exceptions clarifying originFederico Caselli2023-03-311-0/+8
| | | | | | | | | | | | | Exceptions such as ``TypeError`` and ``ValueError`` raised by Python dataclasses when making use of the :class:`_orm.MappedAsDataclass` mixin class or :meth:`_orm.registry.mapped_as_dataclass` decorator are now wrapped within an :class:`.InvalidRequestError` wrapper along with informative context about the error message, referring to the Python dataclasses documentation as the authoritative source of background information on the cause of the exception. Fixes: #9563 Change-Id: I25652485b91c4ee8cf112b91aae8f9041061a8bd
* Merge "skip anno-only mixin columns that are overridden on subclasses" into mainmike bayer2023-03-311-2/+16
|\
| * skip anno-only mixin columns that are overridden on subclassesMike Bayer2023-03-301-2/+16
| | | | | | | | | | | | | | | | | | | | | | Fixed issue where an annotation-only :class:`_orm.Mapped` directive could not be used in a Declarative mixin class, without that attribute attempting to take effect for single- or joined-inheritance subclasses of mapped classes that had already mapped that attribute on a superclass, producing conflicting column errors and/or warnings. Fixes: #9564 Change-Id: I0f92be2ae98a8c45afce3e06d0a7cc61c19a96f4
* | Merge "copy deferred attributes for mapped_column" into mainmike bayer2023-03-311-0/+2
|\ \
| * | copy deferred attributes for mapped_columnMike Bayer2023-03-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the :func:`_orm.mapped_column` construct would raise an internal error if used on a Declarative mixin and included the :paramref:`_orm.mapped_column.deferred` parameter. Fixes: #9550 Change-Id: I0cc5ec4910656abc9a3fb7b7b60880256cd7c61e
* | | Merge "Add missing methods to OrderedSet." into mainmike bayer2023-03-312-38/+64
|\ \ \
| * | | Add missing methods to OrderedSet.Federico Caselli2023-03-302-38/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented missing method ``copy`` and ``pop`` in OrderedSet class. Fixes: #9487 Change-Id: I1d2278b64939b44422e9d5857ec7d345fff53997
* | | | Merge "warn for DC mixin / abstract fields that are not on a dataclass" into ↵mike bayer2023-03-311-11/+52
|\ \ \ \ | | | | | | | | | | | | | | | main
| * | | | warn for DC mixin / abstract fields that are not on a dataclassMike Bayer2023-03-301-11/+52
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fields that are declared on Declarative Mixins and then combined with classes that make use of :class:`_orm.MappedAsDataclass`, where those mixin fields are not themselves part of a dataclass, now emit a deprecation warning as these fields will be ignored in a future release, as Python dataclasses behavior is to ignore these fields. Type checkers will not see these fields under pep-681. Fixes: #9350 Change-Id: Ie0a0ac0f0bb58d1c2aae13b4a8dcd0439a4f5477
* | | | clarify the Uuid datatype handles Python uuid objects by defaultMike Bayer2023-03-311-0/+30
| |/ / |/| | | | | | | | | | | Change-Id: I28147bfb4eb0762e9482d4f38bc1d89355152ad4 References: #9573
* | | Merge "assign correct typing to deferred(), query_property()" into mainmike bayer2023-03-301-5/+4
|\ \ \
| * | | assign correct typing to deferred(), query_property()Mike Bayer2023-03-301-5/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | Fixed typing for :func:`_orm.deferred` and :func:`_orm.query_expression` to work correctly with 2.0 style mappings. Fixes: #9536 Change-Id: Idb88c0a11b7896093234b3cc31595f64b552cba0
* | | Merge "Minor improvements in collections.pyx" into mainmike bayer2023-03-301-8/+12
|\ \ \ | |/ / |/| |
| * | Minor improvements in collections.pyxMatus Valo2023-03-141-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Description This PR introduces minor improvements to collections.pyx: * Adds missed type annotations yielding slightly more optimised code * Adds missed `cpdef` methods used internally * Marks private methods with `@cython.final` Fixes #9477 ### 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: #9478 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9478 Pull-request-sha: c006c76c2c50491ea1be9c723c278da16c151397 Change-Id: I74b3df2bc790db49e331b8f8085c797249364b07
* | | Merge "warn for all unmapped expressions" into mainmike bayer2023-03-301-3/+6
|\ \ \ | |_|/ |/| |
| * | warn for all unmapped expressionsMike Bayer2023-03-241-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expanded the warning emitted when a plain :func:`_sql.column` object is present in a Declarative mapping to include any arbitrary SQL expression that is not declared within an appropriate property type such as :func:`_orm.column_property`, :func:`_orm.deferred`, etc. These attributes are otherwise not mapped at all and remain unchanged within the class dictionary. As it seems likely that such an expression is usually not what's intended, this case now warns for all such otherwise ignored expressions, rather than just the :func:`_sql.column` case. Fixes: #9537 Change-Id: Ic4ca7a071a28adf4ea8680690025d927522a0805
* | | Merge "disable raise sql for the delete cascade" into mainmike bayer2023-03-291-1/+1
|\ \ \
| * | | disable raise sql for the delete cascadeMike Bayer2023-03-281-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Towards maintaining consistency with unit-of-work changes made for :ticket:`5984` and :ticket:`8862`, both of which disable "lazy='raise'" handling within :class:`_orm.Session` processes that aren't triggered by attribute access, the :meth:`_orm.Session.delete` method will now also disable "lazy='raise'" handling when it traverses relationship paths in order to process the "delete" and "delete-orphan" cascade rules. Previously, there was no easy way to generically call :meth:`_orm.Session.delete` on an object that had "lazy='raise'" set up such that only the necessary relationships would be loaded. As "lazy='raise'" is primarily intended to catch SQL loading that emits on attribute access, :meth:`_orm.Session.delete` is now made to behave like other :class:`_orm.Session` methods including :meth:`_orm.Session.merge` as well as :meth:`_orm.Session.flush` along with autoflush. Fixes: #9549 Change-Id: Ie049e66ce2bd35900eae4af0e9b795633303ca63
* | | Merge "Improve from_select typing" into mainmike bayer2023-03-281-4/+6
|\ \ \
| * | | Improve from_select typingFederico Caselli2023-03-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properly type :paramref:`_dml.Insert.from_select.names` to accept a list of string or columns or mapped attributes. Fixes: #9514 Change-Id: I2a3396454e79bd2113fc3d57d1252a2e6d141310
* | | | Merge "check for recursion with container types" into mainmike bayer2023-03-271-8/+22
|\ \ \ \
| * | | | check for recursion with container typesMike Bayer2023-03-271-8/+22
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in ORM Annotated Declarative where using a recursive type (e.g. using a nested Dict type) would result in a recursion overflow in the ORM's annotation resolution logic, even if this datatype were not necessary to map the column. Fixes: #9553 Change-Id: Ied99dc0d47276c6e9c23fa9df5fc65f7736d65cf
* | | | Fix creating zero length char with MySQL dialectJ. Nick Koston2023-03-271-6/+6
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where string datatypes such as :class:`.CHAR`, :class:`.VARCHAR`, :class:`.TEXT`, as well as binary :class:`.BLOB`, could not be produced with an explicit length of zero, which has special meaning for MySQL. Pull request courtesy J. Nick Koston. Fixes: #9544 Closes: #9543 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9543 Pull-request-sha: dc17fc3e93f0ba90881c4efb06016ddf83c7af8b Change-Id: I96925d45f16887f5dfd68a5d4f9284b3abc46d25
* | | Merge "automatically provision hstore for pg13+" into mainmike bayer2023-03-251-3/+12
|\ \ \
| * | | automatically provision hstore for pg13+Federico Caselli2023-03-151-3/+12
| | | | | | | | | | | | | | | | Change-Id: I5cd7e9e9ab8a1dae2bd467a1e4299d7f26183301
* | | | Merge "use clone, not constructor, in ↵mike bayer2023-03-222-6/+7
|\ \ \ \ | | | | | | | | | | | | | | | BindParameter.render_literal_execute()" into main
| * | | | use clone, not constructor, in BindParameter.render_literal_execute()Mike Bayer2023-03-222-6/+7
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the :meth:`_sql.BindParameter.render_literal_execute` method would fail when called on a parameter that also had ORM annotations associated with it. In practice, this would be observed as a failure of SQL compilation when using some combinations of a dialect that uses "FETCH FIRST" such as Oracle along with a :class:`_sql.Select` construct that uses :meth:`_sql.Select.limit`, within some ORM contexts, including if the statement were embedded within a relationship primaryjoin expression. Fixes: #9526 Change-Id: I2f512b6760a90293d274e60b06a891f10b276ecc
* | | | return None for no parententity on ProxyMike Bayer2023-03-211-2/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where accessing the expression value of a hybrid property on a class that was either unmapped or not-yet-mapped (such as calling upon it within a :func:`_orm.declared_attr` method) would raise an internal error, as an internal fetch for the parent class' mapper would fail and an instruction for this failure to be ignored were inadvertently removed in 2.0. Fixes: #9519 Change-Id: If195d26a5ddd2312a373004eb7a1403e1d11e7a4
* | | dont render VARCHAR length for PG castsMike Bayer2023-03-192-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed critical regression in PostgreSQL dialects such as asyncpg which rely upon explicit casts in SQL in order for datatypes to be passed to the driver correctly, where a :class:`.String` datatype would be cast along with the exact column length being compared, leading to implicit truncation when comparing a ``VARCHAR`` of a smaller length to a string of greater length regardless of operator in use (e.g. LIKE, MATCH, etc.). The PostgreSQL dialect now omits the length from ``VARCHAR`` when rendering these casts. Fixes: #9511 Change-Id: If094146d8cfd989a0b780872f38e86fd41ebfec2
* | | Version 2.0.8 placeholderMike Bayer2023-03-181-1/+1
| | |
* | | implement content hashing for custom_op, not identityMike Bayer2023-03-182-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed critical SQL caching issue where use of the :meth:`_sql.Operators.op` custom operator function would not produce an appropriate cache key, leading to reduce the effectiveness of the SQL cache. Fixes: #9506 Change-Id: I3eab1ddb5e09a811ad717161a59df0884cdf70ed
* | | Merge "add explicit overload for composite -> callable" into mainmike bayer2023-03-171-0/+22
|\ \ \
| * | | add explicit overload for composite -> callableMike Bayer2023-03-171-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed typing issue where :func:`_orm.composite` would not allow an arbitrary callable as the source of the composite class. Fixes: #9502 Change-Id: I5b098b70b2fb7b48f54eaccbb7d5d3d9bdebc781
* | | | Merge "Improved wheel pipeline" into mainmike bayer2023-03-172-1/+39
|\ \ \ \ | |/ / / |/| | |
| * | | Improved wheel pipelineFederico Caselli2023-03-172-1/+39
| |/ / | | | | | | | | | | | | | | | | | | | | | - ensure that the compiled extensions are used - speed up job by parallelizing more Fixes: #9434 Change-Id: Ief750b28733ba24bb5ff8c105e1a4c9b7b928700
* | | Merge "Add override hook PGDialect.set_backslash_escapes()" into mainmike bayer2023-03-151-4/+9
|\ \ \ | |/ / |/| |
| * | Add override hook PGDialect.set_backslash_escapes()Matt del Valle2023-03-131-4/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Description Refactor out the lines in `PGDialect.initialize()` that set backslash escapes into their own method to provide an override hook for [`sqlalchemy-redshift`](https://github.com/sqlalchemy-redshift/sqlalchemy-redshift) to use. Fixes #9442 ### Checklist 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. Closes: #9475 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9475 Pull-request-sha: 5565afeac20ea3612c3f427f58efacd8487ac159 Change-Id: I9b652044243ab231c19ab55ebc8ee24534365d61
* | Implementation of CITEXT , unittest and documentationJulian David Rath2023-03-154-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | Added new PostgreSQL type :class:`_postgresql.CITEXT`. Pull request courtesy Julian David Rath. Fixes: #9416 Closes: #9417 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9417 Pull-request-sha: 23a83a342ad6d820ee5749ebccda04e54c373f7d Change-Id: I54699b9457426c20afbdc0acaa41dc57644b0536
* | remove "listeners" docstringMike Bayer2023-03-151-5/+0
| | | | | | | | | | | | | | this should have been removed with #4638. Fixes: #9492 Change-Id: If82dba7e63382e921aceb0c01d88f0977b7f5e8d
* | Document generic type parameters to FunctionElement and GenericFunction (#9079)Stephen Rosen2023-03-141-0/+18
|/ | | | | | | | | | | | | | | | * Document type parameters to FunctionElement Add a note to FunctionElement which indicates that the type is a typing.Generic class and points at GenericFunction examples for a specific example usage. A minimal reference is made to type checkers and IDEs as use-cases in order to try to contextualize this as an optional feature which supports particular use cases. Append to the GenericFunction examples a case which uses `DateTime` but also includes the generic type parameter (`datetime.datetime`). * Fix type annotated function usage example
* Version 2.0.7 placeholderMike Bayer2023-03-131-1/+1
|
* Merge "sqlite provisioning is ridiculous" into mainmike bayer2023-03-113-74/+98
|\
| * sqlite provisioning is ridiculousMike Bayer2023-03-103-74/+98
| | | | | | | | | | | | try to get file naming to be more sane for pysqlite file databases Change-Id: I68ad8c2f6c6c25930fbffdd79b8d429cd7a7dd9a
* | Merge "Fix regression when deserializing python rows into cython" into mainmike bayer2023-03-102-2/+5
|\ \
| * | Fix regression when deserializing python rows into cythonFederico Caselli2023-03-102-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression involving pickling of Python rows between the cython and pure Python implementations of :class:`.Row`, which occurred as part of refactoring code for version 2.0 with typing. A particular constant were turned into a string based ``Enum`` for the pure Python version of :class:`.Row` whereas the cython version continued to use an integer constant, leading to deserialization failures. Regression occurred in a4bb502cf95ea3523e4d383c4377e50f402d7d52 Fixes: #9423 Change-Id: Icbd85cacb2d589cef7c246de7064249926146f2e
* | | Merge "repair broken lambda patch" into mainmike bayer2023-03-101-5/+10
|\ \ \ | |_|/ |/| |
| * | repair broken lambda patchMike Bayer2023-03-101-5/+10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in I4e0b627bfa187f1780dc68ec81b94db1c78f846a the 1.4 version has more changes than the main version, which failed to get the entire change, yet the whole thing was merged. Restore the missing mutex related code to the main version. Fixed regression where the fix for :ticket:`8098`, which was released in the 1.4 series and provided a layer of concurrency-safe checks for the lambda SQL API, included additional fixes in the patch that failed to be applied to the main branch. These additional fixes have been applied. Change-Id: Id172e09c421dafa6ef1d40b383aa4371de343864 References: #8098 Fixes: #9461
* | Merge "implement active_history for composites" into mainmike bayer2023-03-101-2/+18
|\ \