summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Merge "change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql ↵mike bayer2021-11-0934-286/+361
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | quoting" into main
| * | | | change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql quotingMike Bayer2021-11-0934-286/+361
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted the compiler's generation of "post compile" symbols including those used for "expanding IN" as well as for the "schema translate map" to not be based directly on plain bracketed strings with underscores, as this conflicts directly with SQL Server's quoting format of also using brackets, which produces false matches when the compiler replaces "post compile" and "schema translate" symbols. The issue created easy to reproduce examples both with the :meth:`.Inspector.get_schema_names` method when used in conjunction with the :paramref:`_engine.Connection.execution_options.schema_translate_map` feature, as well in the unlikely case that a symbol overlapping with the internal name "POSTCOMPILE" would be used with a feature like "expanding in". Fixes: #7300 Change-Id: I6255c850b140522a4aba95085216d0bca18ce230
* | | | Merge "Fixes: #7295" into mainmike bayer2021-11-093-8/+42
|\ \ \ \ | |_|/ / |/| | |
| * | | Fixes: #7295jonathan vanasco2021-11-063-8/+42
| | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in ``Table``` object where: param:`implicit_returning` was not compatible with: param:`extend_existing`. Change-Id: I16f4ab585d82f5691a3fed9eba04b84730a8a59e
* | | | revert mis-commit from aa026c302c6b188a7e28508f9ecb603809b9e03fMike Bayer2021-11-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A scratch line from #7269 was inadvertently committed here. this needs to be in its own commit w/ tests. Change-Id: I62796e18b05bbbd3b6225e9f27e1e63ab98cf24c
* | | | De-emphasize notion of "default driver" (DBAPI)Gord Thompson2021-11-0942-148/+193
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #6960 Even though a default driver still exists for each dialect, remove most usages of `dialect://` to encourage users to explicitly specify `dialect+driver://` Change-Id: I0ad42167582df509138fca64996bbb53e379b1af
* | | connection doc updates for futureMike Bayer2021-11-081-247/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove autocommit section, missed in future engine merge * remove implicit execution section, also missed * rewrite "transactions" section to fully discuss "commit as you go" vs. "begin once", remove all references to "future" * fix up "understanding DBAPI autocommit" to be a little more clear Pushing this straight up, we can attend to remaining typos / edits ad hoc Change-Id: I687c89a515e5a5cdce69700b039bb7c10d90159a
* | | Merge "fully implement future engine and remove legacy" into mainmike bayer2021-11-0762-5416/+1782
|\ \ \
| * | | fully implement future engine and remove legacyMike Bayer2021-11-0762-5416/+1782
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The major action here is to lift and move future.Connection and future.Engine fully into sqlalchemy.engine.base. This removes lots of engine concepts, including: * autocommit * Connection running without a transaction, autobegin is now present in all cases * most "autorollback" is obsolete * Core-level subtransactions (i.e. MarkerTransaction) * "branched" connections, copies of connections * execution_options() returns self, not a new connection * old argument formats, distill_params(), simplifies calling scheme between engine methods * before/after_execute() events (oriented towards compiled constructs) don't emit for exec_driver_sql(). before/after_cursor_execute() is still included for this * old helper methods superseded by context managers, connection.transaction(), engine.transaction() engine.run_callable() * ancient engine-level reflection methods has_table(), table_names() * sqlalchemy.testing.engines.proxying_engine References: #7257 Change-Id: Ib20ed816642d873b84221378a9ec34480e01e82c
* | | | Merge "use tuple expansion if type._is_tuple, test for Sequence if no type" ↵mike bayer2021-11-059-9/+182
|\ \ \ \ | |_|/ / |/| | | | | | | into main
| * | | use tuple expansion if type._is_tuple, test for Sequence if no typeMike Bayer2021-11-059-9/+182
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the row objects returned for ORM queries, which are now the normal :class:`_sql.Row` objects, would not be interpreted by the :meth:`_sql.ColumnOperators.in_` operator as tuple values to be broken out into individual bound parameters, and would instead pass them as single values to the driver leading to failures. The change to the "expanding IN" system now accommodates for the expression already being of type :class:`.TupleType` and treats values accordingly if so. In the uncommon case of using "tuple-in" with an untyped statement such as a textual statement with no typing information, a tuple value is detected for values that implement ``collections.abc.Sequence``, but that are not ``str`` or ``bytes``, as always when testing for ``Sequence``. Added :class:`.TupleType` to the top level ``sqlalchemy`` import namespace. Fixes: #7292 Change-Id: I8286387e3b3c3752b3bd4ae3560d4f31172acc22
* | | fix typo in changelog.Federico Caselli2021-11-051-1/+1
|/ / | | | | | | Change-Id: Ic78a9ce9032ab759fc796d3218b64352dde6155b
* | Check for Mapping explicitly in 2.0 paramsMike Bayer2021-11-043-3/+115
| | | | | | | | | | | | | | | | | | | | Fixed issue in future :class:`_future.Connection` object where the :meth:`_future.Connection.execute` method would not accept a non-dict mapping object, such as SQLAlchemy's own :class:`.RowMapping` or other ``abc.collections.Mapping`` object as a parameter dictionary. Fixes: #7291 Change-Id: I819f079d86d19d1d81c570e0680f987e51e34b84
* | Update "transaction has already begun" languageMike Bayer2021-11-043-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As future connections will now be autobeginning, there will be more cases where begin() can't be called as well as where isolation level can't be set, which will be surprising as this is a behavioral change for 2.0; additionally, when DBAPI autocommit is set, there isn't actually a DBAPI level transaction in effect even though Connection has a Transaction object. Clarify the language in these two error messages to make it clear that begin() and autobegin are tracking a SQLAlchemy-level Transaction() object, whether or not the DBAPI has actually started a transaction, and that this is the reason rollback() or commit() is required before performing the requsted operation. Additionally make sure the error message mentions "autobegin" as a likely reason this error is being encountered along with what Connection needs the user to do in order to resolve. Change-Id: If8763939eeabc46aa9d9209a56d05ad82b892c5c
* | Merge "simplify and publicize the asyncpg JSON(B) codec registrsation" into mainmike bayer2021-11-043-29/+88
|\ \
| * | simplify and publicize the asyncpg JSON(B) codec registrsationMike Bayer2021-11-033-29/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added overridable methods ``PGDialect_asyncpg.setup_asyncpg_json_codec`` and ``PGDialect_asyncpg.setup_asyncpg_jsonb_codec`` codec, which handle the required task of registering JSON/JSONB codecs for these datatypes when using asyncpg. The change is that methods are broken out as individual, overridable methods to support third party dialects that need to alter or disable how these particular codecs are set up. Fixes: #7284 Change-Id: I3eac258fea61f3975bd03c428747f788813ce45e
* | | use ExpressionElementRole for case targets in case()Mike Bayer2021-11-034-37/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the :func:`_sql.text` construct would no longer be accepted as a target case in the "whens" list within a :func:`_sql.case` construct. The regression appears related to an attempt to guard against some forms of literal values that were considered to be ambiguous when passed here; however, there's no reason the target cases shouldn't be interpreted as open-ended SQL expressions just like anywhere else, and a literal string or tuple will be converted to a bound parameter as would be the case elsewhere. Fixes: #7287 Change-Id: I75478adfa115f3292cb1362cc5b2fdf152b0ed6f
* | | add missing info from groupby documentationFederico Caselli2021-11-031-0/+2
|/ / | | | | | | | | Change-Id: Icfaf242353c23a579fe79f9d72500a08d90fcb77 Signed-off-by: Federico Caselli <cfederico87@gmail.com>
* | Revert "Gracefully degrade unsupported types with asyncpg"mike bayer2021-11-032-40/+14
|/ | | | | | | | This reverts commit 96c294da8a50d692b3f0b8e508dbbca5d9c22f1b. I have another approach that is more obvious, easier to override explicitly and also I can test it more easily. Change-Id: I11a3be7700dbc6f25d436e450b6fb8e8f6c4fd16
* formatting updatesMike Bayer2021-11-034-5/+6
| | | | Change-Id: I7352bed0115b8fcdb4708e012d83e81d1ae494ed
* Merge "Gracefully degrade unsupported types with asyncpg" into mainmike bayer2021-11-032-14/+40
|\
| * Gracefully degrade unsupported types with asyncpgGord Thompson2021-11-022-14/+40
| | | | | | | | | | | | | | | | | | | | | | | | Fixes: #7284 Modify the on_connect() method of PGDialect_asyncpg to gracefully degrade unsupported types instead of throwing a ValueError. Useful for third-party dialects that derive from PGDialect_asyncpg but whose databases do not support all types (e.g., CockroachDB supports JSONB but not JSON). Change-Id: Ibb7cc8c3de632d27b9716a93d83956a590b2a2b0
* | Merge "Fixed issue in visit_on_duplicate_key_update within a composed ↵mike bayer2021-11-034-6/+20
|\ \ | | | | | | | | | expression" into main
| * | Fixed issue in visit_on_duplicate_key_update within a composed expressionCristian Sabaila2021-11-024-6/+20
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue in MySQL :meth:`_mysql.Insert.on_duplicate_key_update` which would render the wrong column name when an expression were used in a VALUES expression. Pull request courtesy Cristian Sabaila. Fixes: #7281 Closes: #7285 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7285 Pull-request-sha: 3e6ad6f2fecc6ae36a10a5a34b5d3d393483edbb Change-Id: I83377c20eae6358fead9e7e361127938e538a71c
* | map Float to asyncpg.FLOAT, test for infinityMike Bayer2021-11-025-0/+42
|/ | | | | Fixes: #7283 Change-Id: I5402a72617b7f9bc366d64bc5ce8669374839984
* Merge "ensure soft_close occurs for fetchmany with server side cursor" into mainmike bayer2021-11-026-10/+249
|\
| * ensure soft_close occurs for fetchmany with server side cursorMike Bayer2021-11-026-10/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed regression where the :meth:`_engine.CursorResult.fetchmany` method would fail to autoclose a server-side cursor (i.e. when ``stream_results`` or ``yield_per`` is in use, either Core or ORM oriented results) when the results were fully exhausted. All :class:`_result.Result` objects will now consistently raise :class:`_exc.ResourceClosedError` if they are used after a hard close, which includes the "hard close" that occurs after calling "single row or value" methods like :meth:`_result.Result.first` and :meth:`_result.Result.scalar`. This was already the behavior of the most common class of result objects returned for Core statement executions, i.e. those based on :class:`_engine.CursorResult`, so this behavior is not new. However, the change has been extended to properly accommodate for the ORM "filtering" result objects returned when using 2.0 style ORM queries, which would previously behave in "soft closed" style of returning empty results, or wouldn't actually "soft close" at all and would continue yielding from the underlying cursor. As part of this change, also added :meth:`_result.Result.close` to the base :class:`_result.Result` class and implemented it for the filtered result implementations that are used by the ORM, so that it is possible to call the :meth:`_engine.CursorResult.close` method on the underlying :class:`_engine.CursorResult` when the the ``yield_per`` execution option is in use to close a server side cursor before remaining ORM results have been fetched. This was again already available for Core result sets but the change makes it available for 2.0 style ORM results as well. Fixes: #7274 Change-Id: Id4acdfedbcab891582a7f8edd2e2e7d20d868e53
* | Merge "First round of removal of python 2" into mainmike bayer2021-11-0265-1088/+120
|\ \
| * | First round of removal of python 2Federico Caselli2021-11-0165-1088/+120
| | | | | | | | | | | | | | | References: #4600 Change-Id: I61e35bc93fe95610ae75b31c18a3282558cd4ffe
* | | Fixes: #7278masterjonathan vanasco2021-11-021-1/+1
| |/ |/| | | | | | | | | Correct a typo in the 1.4 changelog Change-Id: Ib7d1fc75957ad2efb348fee9d862d75b06dbafef
* | use full context manager flow for future.Engine.begin()Mike Bayer2021-11-013-21/+55
|/ | | | | | | | | | | | | | | Fixed issue in future :class:`_future.Engine` where calling upon :meth:`_future.Engine.begin` and entering the context manager would not close the connection if the actual BEGIN operation failed for some reason, such as an event handler raising an exception; this use case failed to be tested for the future version of the engine. Note that the "future" context managers which handle ``begin()`` blocks in Core and ORM don't actually run the "BEGIN" operation until the context managers are actually entered. This is different from the legacy version which runs the "BEGIN" operation up front. Fixes: #7272 Change-Id: I9667ac0861a9e007c4b3dfcf0fcf0829038a8711
* Merge "remove case_sensitive create_engine parameter" into mainmike bayer2021-11-015-188/+20
|\
| * remove case_sensitive create_engine parameterMike Bayer2021-11-015-188/+20
| | | | | | | | | | | | | | | | | | | | | | | | Removed the previously deprecated ``case_sensitive`` parameter from :func:`_sa.create_engine`, which would impact only the lookup of string column names in Core-only result set rows; it had no effect on the behavior of the ORM. The effective behavior of what ``case_sensitive`` refers towards remains at its default value of ``True``, meaning that string names looked up in ``row._mapping`` will match case-sensitively, just like any other Python mapping. Change-Id: I0dc4be3fac37d30202b1603db26fa10a110b618d
* | de-link LegacyRow, LegacyCursorResultMike Bayer2021-11-014-23/+17
|/ | | | Change-Id: I4a9d210c3cb07fc1d59643463acef95f9cc9b12e
* Merge "Update psycopg2 dialect to use the DBAPI interface to execute two ↵mike bayer2021-11-013-10/+48
|\ | | | | | | phase transactions" into main
| * Update psycopg2 dialect to use the DBAPI interface to executeFederico Caselli2021-10-313-10/+48
| | | | | | | | | | | | | | two phase transactions Fixes: #7238 Change-Id: Ie4f5cf59d29b5bfc142ec2dfdecffb896ee7d708
* | Revise "literal parameters" FAQ sectionMike Bayer2021-11-012-37/+241
| | | | | | | | | | | | | | | | | | | | based on feedback in #7271, the emphasis on TypeDecorator as a solution to this problem is not very practical. illustrate a series of quick recipes that are useful for debugging purposes to print out a repr() or simple stringify of a parameter without the need to construct custom dialects or types. Change-Id: I788ce1b5ea01d88dd0a22d03d06f35aabff5e5c8
* | Merge "2.0 removals: LegacyRow, connectionless execution, close_with_result" ↵mike bayer2021-10-3127-2512/+621
|\ \ | |/ |/| | | into main
| * 2.0 removals: LegacyRow, connectionless execution, close_with_resultMike Bayer2021-10-3127-2512/+621
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in order to remove LegacyRow / LegacyResult, we have to also lose close_with_result, which connectionless execution relies upon. also includes a new profiles.txt file that's all against py310, as that's what CI is on now. some result counts changed by one function call which was enough to fail the low-count result tests. Replaces Connectable as the common interface between Connection and Engine with EngineEventsTarget. Engine is no longer Connectable. Connection and MockConnection still are. References: #7257 Change-Id: Iad5eba0313836d347e65490349a22b061356896a
* | Merge "Remove deprecated dialects and drivers" into mainmike bayer2021-10-3163-4255/+108
|\ \
| * | Remove deprecated dialects and driversFederico Caselli2021-10-3163-4255/+108
| | | | | | | | | | | | | | | Fixes: #7258 Change-Id: I3577f665eca04f2632b69bcb090f0a4ec9271db9
* | | The ``has_table`` method now also checks viewsFederico Caselli2021-10-316-7/+64
| |/ |/| | | | | | | | | | | | | | | | | | | | | The :meth:`_engine.Inspector.has_table` method will now consistently check for views of the given name as well as tables. Previously this behavior was dialect dependent, with PostgreSQL, MySQL/MariaDB and SQLite supporting it, and Oracle and SQL Server not supporting it. Third party dialects should also seek to ensure their :meth:`_engine.Inspector.has_table` method searches for views as well as tables for the given name. Fixes: #7161 Change-Id: I9e523c76741b19596c81ef577dc6f0823e44183b
* | remove ORM autocommit and public-facing subtransactions conceptMike Bayer2021-10-3019-1093/+158
| | | | | | | | | | | | | | | | | | In order to do LegacyRow we have to do Connection, which means we lose close_with_result (hooray) which then means we have to get rid of ORM session autocommit which relies on it, so let's do that first. Change-Id: I115f614733b1d0ba19f320ffa9a49f0d762db094
* | Merge "initial 2.0 setup" into mainmike bayer2021-10-3015-4962/+69
|\ \ | |/ |/|
| * initial 2.0 setupMike Bayer2021-10-3015-4962/+69
| | | | | | | | | | | | | | Adapted from 55e64f857daeb6057b85ff67297a774b when we previously started a 2.0 branch. Change-Id: Ib5af75df94b23104eebe0e918adcf979d798ea3b
* | remove python2 from workflowsFederico Caselli2021-10-303-57/+2
|/ | | | Change-Id: Ib2da811acbad291dc9bbe798c84f2309f5d0f21e
* warnings removal, merge_resultMike Bayer2021-10-296-95/+131
| | | | | | | | | | | this is the last warning to remove. Also fixes some mistakes I made with the new Base20DeprecationWarning and LegacyAPIWarning classes created, where functions in deprecations.py were still hardcoded to RemovedIn20Warning. Change-Id: I9a6045ac9b813fd2f9668c4bc518c46a7774c6ef
* Merge "warnings: session.autocommit, subtransactions" into mainmike bayer2021-10-2911-411/+110
|\
| * warnings: session.autocommit, subtransactionsMike Bayer2021-10-2911-420/+618
| | | | | | | | Change-Id: I7eb7c87c9656f8043ea90d53897958afad2b8fe9
* | clarify order_by(None) for Core; improve wordingMike Bayer2021-10-292-4/+19
| | | | | | | | | | | | | | the order_by(None) convention was documented for orm.Query but not Core select. Change-Id: I0c1ad76c3eefba1cb54b1649cfd09169c17e2bba