summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* Documentation improvementsFederico Caselli2021-07-204-6/+24
| | | | | | | | | | | | | | Also remove deprecated usage: - load_only does not accept strings - case.whens is positional only Ref #6712 Ref #5994 Ref #6121 Ref #6785 Ref https://groups.google.com/g/sqlalchemy/c/-cnhThEu3kk Change-Id: I5db49a075b9d3d332518b9d189a24b13b502e2af
* Merge "Add additional support to honor _proxy_key in Core selects"mike bayer2021-07-093-7/+25
|\
| * Add additional support to honor _proxy_key in Core selectsMike Bayer2021-07-053-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed ORM regression where ad-hoc label names generated for hybrid properties and potentially other similar types of ORM-enabled expressions would usually be propagated outwards through subqueries, allowing the name to be retained in the final keys of the result set even when selecting from subqueries. Additional state is now tracked in this case that isn't lost when a hybrid is selected out of a Core select / subquery. as we have removed things like column.label() from ORM, since we now have to export the cols with the same names as what we will render, experiment with giving a greater role to the _proxy_key annotation so that a desired name can be carried through more transarently. Fixes: #6718 Change-Id: Icb313244c13ea1a8f58d3e05d07aa3e1039e15bf
* | Replace all http:// links to https://Federico Caselli2021-07-04200-301/+302
|/ | | | | | Also replace http://pypi.python.org/pypi with https://pypi.org/project Change-Id: I84b5005c39969a82140706472989f2a30b0c7685
* Modernize testsGord Thompson2021-07-032-4/+4
| | | | | | Eliminate engine.execute() and engine.scalar() Change-Id: I99f76d0e615ddebab2da4fd07a40a0a2796995c7
* Merge "Update link for mysql case sensitivity"mike bayer2021-07-031-1/+1
|\
| * Update link for mysql case sensitivityGord Thompson2021-07-031-1/+1
| | | | | | | | Change-Id: Ia4ff3e86d944bd5cfaa0ae2086b1d20fa027ba14
* | Merge "Modernize tests - Connection.connect"mike bayer2021-07-031-1/+0
|\ \
| * | Modernize tests - Connection.connectGord Thompson2021-06-261-1/+0
| | | | | | | | | | | | Change-Id: I61639dc2d7e7bcae6c53e2a15680b11fce3efa5d
* | | clear new Query._memoized_select_entities in _from_selectableMike Bayer2021-06-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression caused in 1.4.19 due to #6503 and related involving :meth:`_orm.Query.with_entities` where the new structure used would be inappropriately transferred to an enclosing :class:`_orm.Query` when making use of set operations such as :meth:`_orm.Query.union`, causing the JOIN instructions within to be applied to the outside query as well. Fixes: #6698 Change-Id: Ia9f294215ebc01330d142a0a3e5be9d02be9380f
* | | Ensure compiler uses quote_schema hook for translates rendersMike Bayer2021-06-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the special dotted-schema name handling for the SQL Server dialect would not function correctly if the dotted schema name were used within the ``schema_translate_map`` feature. Fixes: #6697 Change-Id: Idb610755cbf8122e71223d5dd0a17fcb61b1b98d
* | | apply quoting to "ON CONSTRAINT" symbolMike Bayer2021-06-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and :meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique constraint passed as the ``constraint`` parameter would not be properly quoted if it contained characters which required quoting. Fixes: #6696 Change-Id: I4ffca9b8c72cef4ed39e2de96831ccc11a620422
* | | Version 1.4.21 placeholderMike Bayer2021-06-281-1/+1
| | |
* | | Be less fiscal regarding validators functionsMiłosz Stypiński2021-06-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted the check in the mapper for a callable object that is used as a ``@validates`` validator function or a ``@reconstructor`` reconstruction function, to check for "callable" more liberally such as to accommodate objects based on fundamental attributes like ``__func__`` and ``__call___``, rather than testing for ``MethodType`` / ``FunctionType``, allowing things like cython functions to work properly. Pull request courtesy Miłosz Stypiński. Fixes: #6538 Closes: #6539 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6539 Pull-request-sha: ed1d7fe5c9386bab0416ff32095afc777c26b6ca Change-Id: I8350558bc9a9ba58f43e48e12ce25a0b30e4d767
* | | Merge "Fix missing None handling of Table.prefixes"mike bayer2021-06-281-1/+1
|\ \ \
| * | | Fix missing None handling of Table.prefixesKai Mueller2021-06-281-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where passing ``None`` for the value of :paramref:`_schema.Table.prefixes` would not store an empty list, but rather the constant ``None``, which may be unexpected by third party dialects. The issue is revealed by a usage in recent versions of Alembic that are passing ``None`` for this value. Pull request courtesy Kai Mueller. Fixes: #6685 Closes: #6672 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6672 Pull-request-sha: b79aca0ee4011b244978b35fed4c687ffbe56dc9 Change-Id: I758641c6fbde6f2607d074fecea7efa6728aeea0
* | | Don't require space after MySQL pk commentDaniël van Eeden2021-06-281-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made a small adjustment in the table reflection feature of the MySQL dialect to accommodate for alternate MySQL-oriented databases such as TiDB which include their own "comment" directives at the end of a constraint directive within "CREATE TABLE" where the format doesn't have the additional space character after the comment, in this case the TiDB "clustered index" feature. Pull request courtesy Daniël van Eeden. Fixes: #6659 Closes: #6660 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6660 Pull-request-sha: 98791a441b2e3d26aa7cef9d3e2907fac113e30f Change-Id: I20d206e0cdb809e4c6997b87159edf41249f7cd9
* | Merge "ensure with poly entities are also reconstituted for GC'ed AC"mike bayer2021-06-261-0/+9
|\ \ | |/ |/|
| * ensure with poly entities are also reconstituted for GC'ed ACMike Bayer2021-06-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | Fixed regression in ORM regarding an internal reconstitution step for the func:`_orm.with_polymorphic` construct, when the user-facing object is garbage collected as the query is processed. The reconstitution was not ensuring the sub-entities for the "polymorphic" case were handled, leading to an ``AttributeError``. Fixes: #6680 Change-Id: Id35b16d0f2aadb50b5a7385a21fa81b9d8a8325f
* | set _render_for_subquery for legacy set opsMike Bayer2021-06-261-1/+7
|/ | | | | | | | | | | | | | | Adjusted :meth:`_orm.Query.union` and similar set operations to be correctly compatible with the new capabilities just added in :ticket:`6661`, with SQLAlchemy 1.4.19, such that the SELECT statements rendered as elements of the UNION or other set operation will include directly mapped columns that are mapped as deferred; this both fixes a regression involving unions with multiple levels of nesting that would produce a column mismatch, and also allows the :func:`_orm.undefer` option to be used at the top level of such a :class:`_orm.Query` without having to apply the option to each of the elements within the UNION. Fixes: #6678 Change-Id: Iba97ce7fd8a965499853256fd2eb7f61512db60f
* Merge "turn pg provision error into a warning"mike bayer2021-06-263-5/+18
|\
| * turn pg provision error into a warningMike Bayer2021-06-263-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | We haven't had any real cases of the PG "cant drop tables" condition since this error was first introduced; instead we seem to get it for a non-critical query during pool reconnect tests, and I have not been able to isolate what is causing it. Therefore turn the error into a new class of warning that can emit within the test suite without failing the test, so that if we do get a real PG drop timeout, the warning will be there to show us what the query was in which it was stuck. Change-Id: I1a9b3c4f7a25b7b9c1af722a721fc44ad5575b0f
* | have automap suppress overlaps warning for mapped secondaryMike Bayer2021-06-252-0/+17
|/ | | | | | | | | | | | | | | | Fixed regression in :mod:`sqlalchemy.ext.automap` extension such that the use case of creating an explicit mapped class to a table that is also the :paramref:`_orm.relationship.secondary` element of a :func:`_orm.relationship` that automap will be generating would emit the "overlaps" warnings introduced in 1.4 and discussed at :ref:`error_qzyx`. While generating this case from automap is still subject to the same caveats that the "overlaps" warning refers towards, as automap is intended for more ad-hoc use cases, the condition which produces the warning is disabled when a many-to-many relationship with this particular pattern is generated. Fixes: #6679 Change-Id: Ib3a53982b076ed4999b0d3235f84008b9e2f1cce
* Add "impl" parameter to PickleTypejason3gb2021-06-241-1/+15
| | | | | | | | | | | | | Add a impl parameter to :class:`_types.PickleType` constructor, allowing any arbitary type to be used in place of the default implementation of :class:`_types.LargeBinary`. Pull request courtesy jason3gb. Fixes: #6646 Closes: #6657 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6657 Pull-request-sha: e49bcd368d1f71dba92225d8d6e3af2bbe7142f7 Change-Id: Ib79f3b0ebbc94393f673f5a5ba6558260083d0cf
* Merge "Fix typo in _warn_for_legacy_exec_format"mike bayer2021-06-241-1/+1
|\
| * Fix typo in _warn_for_legacy_exec_formatgordthompson2021-06-241-1/+1
| | | | | | | | Change-Id: Idc24b5ab4b5a25fcfb7115c5d7be4c2ece520674
* | Merge "Use Py_TPFLAGS_HAVE_GC for Row"mike bayer2021-06-241-7/+21
|\ \ | |/ |/|
| * Use Py_TPFLAGS_HAVE_GC for RowMike Bayer2021-06-241-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | Fixed an issue in the C extension for the :class:`_result.Row` class which could lead to a memory leak in the unlikely case of a :class:`_result.Row` object which referred to an ORM object that then was mutated to refer back to the ``Row`` itself, creating a cycle. The Python C APIs for tracking GC cycles has been added to the native :class:`_result.Row` implementation to accommodate for this case. Fixes: #5348 Change-Id: I3ac32012f29fbb59f8921cf2a124fa3a7ac5f0d1
* | Merge "Add Executable to DefaultGenerator"mike bayer2021-06-242-3/+4
|\ \ | |/ |/|
| * Add Executable to DefaultGeneratorMike Bayer2021-06-232-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed the class hierarchy for the :class:`_schema.Sequence` and the more general :class:`_schema.DefaultGenerator` base, as these are "executable" as statements they need to include :class:`_sql.Executable` in their hierarchy, not just :class:`_roles.StatementRole` as was applied arbitrarily to :class:`_schema.Sequence` previously. The fix allows :class:`_schema.Sequence` to work in all ``.execute()`` methods including with :meth:`_orm.Session.execute` which was not working in the case that a ``do_orm_execute()`` handler was also established. Fixes: #6668 Change-Id: I0d192258c7cbd1bce2552f9e748e8fdd680dc45f
* | Merge "consider "*" col as textual ordered"mike bayer2021-06-231-1/+1
|\ \
| * | consider "*" col as textual orderedMike Bayer2021-06-231-1/+1
| |/ | | | | | | | | | | | | | | | | Fixed old issue where a :func:`_sql.select()` made against the token "*", which then yielded exactly one column, would fail to correctly organize the ``cursor.description`` column name into the keys of the result object. Fixes: #6665 Change-Id: Ie8c00f62998972ad4a19a750d2642d00fde006f6
* | Version 1.4.20 placeholderMike Bayer2021-06-221-1/+1
|/
* Merge "apply render_schema_translates to identity insert directives"mike bayer2021-06-231-2/+10
|\
| * apply render_schema_translates to identity insert directivesMike Bayer2021-06-211-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where the "schema_translate_map" feature would fail to function correctly in conjunction with an INSERT into a table that has an IDENTITY column, where the value of the IDENTITY column were specified in the values of the INSERT thus triggering SQLAlchemy's feature of setting IDENTITY INSERT to "on"; it's in this directive where the schema translate map would fail to be honored. Fixes: #6658 Change-Id: I8235aa639dd465d038a2ad48e7a669f3e5c5c37c
* | Merge "Add impl property to PostgreSQL / Oracle INTERVAL class"mike bayer2021-06-222-0/+6
|\ \
| * | Add impl property to PostgreSQL / Oracle INTERVAL classMajorDallas2021-06-222-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue where the ``INTERVAL`` datatype on PostgreSQL and Oracle would produce an ``AttributeError`` when used in the context of a comparison operation against a ``timedelta()`` object. Pull request courtesy MajorDallas. Fixes: #6649 Closes: #6650 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6650 Pull-request-sha: dd217a975e5f0d3157e81c731791225b6a32889f Change-Id: I773caf2673294fdb3c92b42895ad714e944d1bf8
* | | Merge "Export deferred columns but not col props; fix CTE labeling"mike bayer2021-06-228-70/+58
|\ \ \ | |/ / |/| |
| * | Export deferred columns but not col props; fix CTE labelingMike Bayer2021-06-228-70/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refined the behavior of ORM subquery rendering with regards to deferred columns and column properties to be more compatible with that of 1.3 while also providing for 1.4's newer features. As a subquery in 1.4 does not make use of loader options, including :func:`_orm.deferred`, a subquery that is against an ORM entity with deferred attributes will now render those deferred attributes that refer directly to mapped table columns, as these are needed in the outer SELECT if that outer SELECT makes use of these columns; however a deferred attribute that refers to a composed SQL expression as we normally do with :func:`_orm.column_property` will not be part of the subquery, as these can be selected explicitly if needed in the subquery. If the entity is being SELECTed from this subquery, the column expression can still render on "the outside" in terms of the derived subquery columns. This produces essentially the same behavior as when working with 1.3. However in this case the fix has to also make sure that the ``.selected_columns`` collection of an ORM-enabled :func:`_sql.select` also follows these rules, which in particular allows recursive CTEs to render correctly in this scenario, which were previously failing to render correctly due to this issue. As part of this change the _exported_columns_iterator() method has been removed and logic simplified to use ._all_selected_columns from any SelectBase object where _exported_columns_iterator() was used before. Additionally sets up UpdateBase to include ReturnsRows in its hierarchy; the literal point of ReturnsRows was to be a common base for UpdateBase and SelectBase so it was kind of weird it wasn't there. Fixes: #6661 Fixed issue in CTE constructs mostly relevant to ORM use cases where a recursive CTE against "anonymous" labels such as those seen in ORM ``column_property()`` mappings would render in the ``WITH RECURSIVE xyz(...)`` section as their raw internal label and not a cleanly anonymized name. Fixes: #6663 Change-Id: I26219d4d8e6c0915b641426e9885540f74fae4d2
* | | Improve regexp used by pymssql to parse db versionFederico Caselli2021-06-211-1/+1
|/ / | | | | | | | | | | | | | | | | Made improvements to the server version regexp used by the pymssql dialect to prevent a regexp overflow in case of an invalid version string. Fixes: #5557 Change-Id: Ia3e95a9f11f5a121d84474c97f6b122cf8d9c9cf
* | Implement MySQL-specific MATCHAnton Kovalevich2021-06-214-4/+208
|/ | | | | | | | | | | | | Added new construct :class:`_mysql.match`, which provides for the full range of MySQL's MATCH operator including multiple column support and modifiers. Pull request courtesy Anton Kovalevich. Fixes: #6132 Closes: #6133 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6133 Pull-request-sha: dc6842f13688849a848e2ecbb81600e6edf8b3a9 Change-Id: I66bbfd7947aa2e43a031772e9b5ae238d94e5223
* accommodate no cls info found in _scan_declarativeMike Bayer2021-06-212-1/+6
| | | | | | | | | Fixed issue in mypy plugin where class info for a custom declarative base would not be handled correctly on a cached mypy pass, leading to an AssertionError being raised. Fixes: #6476 Change-Id: If78340673e6a4d16d8f7cf787ce3bdb02c8bd47b
* ensure greenlet_spawn propagates BaseExceptionMike Bayer2021-06-181-1/+3
| | | | | | | | | | | Fixed bug in asyncio implementation where the greenlet adaptation system failed to propagate ``BaseException`` subclasses, most notably including ``asyncio.CancelledError``, to the exception handling logic used by the engine to invalidate and clean up the connection, thus preventing connections from being correctly disposed when a task was cancelled. Fixes: #6652 Change-Id: Id3809e6c9e7bced46a7a3b5a0d1906c4168dc4fc
* Merge "memoize current options and joins w with_entities/with_only_cols"mike bayer2021-06-188-94/+322
|\
| * memoize current options and joins w with_entities/with_only_colsMike Bayer2021-06-178-94/+322
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed further regressions in the same area as that of :ticket:`6052` where loader options as well as invocations of methods like :meth:`_orm.Query.join` would fail if the left side of the statement for which the option/join depends upon were replaced by using the :meth:`_orm.Query.with_entities` method, or when using 2.0 style queries when using the :meth:`_sql.Select.with_only_columns` method. A new set of state has been added to the objects which tracks the "left" entities that the options / join were made against which is memoized when the lead entities are changed. Fixes: #6503 Fixes: #6253 Change-Id: I211b2af98b0b20d1263fb15dc513884dcc5de6a4
* | Implement async_scoped_sessionjason3gb2021-06-163-47/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented :class:`_asyncio.async_scoped_session` to address some asyncio-related incompatibilities between :class:`_orm.scoped_session` and :class:`_asyncio.AsyncSession`, in which some methods (notably the :meth:`_asyncio.async_scoped_session.remove` method) should be used with the ``await`` keyword. Fixes: #6583 Closes: #6603 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/6603 Pull-request-sha: 0e8ef87dc824dcd83dca01641441afc453c8e07a Change-Id: I9bfe56f8670302ff0015d9dc56c1e3ac5b92b118
* | Merge "set autocommit for psycopg2 pre-ping"mike bayer2021-06-151-0/+19
|\ \ | |/ |/|
| * set autocommit for psycopg2 pre-pingMike Bayer2021-06-111-0/+19
| | | | | | | | | | | | | | | | | | Fixed issue where the pool "pre ping" feature would implicitly start a transaction, which would then interfere with custom transactional flags such as PostgreSQL's "read only" mode when used with the psycopg2 driver. Fixes: #6621 Change-Id: I29117c393e50c090cc2587efcccfe1e986738928
* | pg 13 is in CIMike Bayer2021-06-151-1/+1
| | | | | | | | | | Change-Id: I9fc638995a7c49a3ca3bf3c439428cae95d3c7b9 References: #6637
* | document missing ColumnCollection methodsMike Bayer2021-06-134-25/+119
| | | | | | | | | | | | | | | | add additional notes regarding the methods that are on this object. Fixes: #6629 Change-Id: I68446cb16cbfcef9af9c2998687b3b536607cf0d