]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Generalize RETURNING and suppor for MariaDB / SQLite
authorDaniel Black <daniel@mariadb.org>
Tue, 28 Sep 2021 18:20:06 +0000 (14:20 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 2 Jun 2022 16:51:20 +0000 (12:51 -0400)
commit466ed5b53a3af83f337c93be95715e4b3ab1255e
tree73564b3a1d08e6b8add40c66a600625dd5f733fa
parent7b6fb299bb6b47dfeb22a5650b95af7fa0b35ec2
Generalize RETURNING and suppor for MariaDB / SQLite

As almost every dialect supports RETURNING now, RETURNING
is also made more of a default assumption.

* the default compiler generates a RETURNING clause now
  when specified; CompileError is no longer raised.
* The dialect-level implicit_returning parameter now has
  no effect.   It's not fully clear if there are real world
  cases relying on the dialect-level parameter, so we will see
  once 2.0 is released.   ORM-level RETURNING can be disabled
  at the table level, and perhaps "implicit returning" should
  become an ORM-level option at some point as that's where
  it applies.
* Altered ORM update() / delete() to respect table-level
  implicit returning for fetch.
* Since MariaDB doesnt support UPDATE returning, "full_returning"
  is now split into insert_returning, update_returning, delete_returning
* Crazy new thing.  Dialects that have *both* cursor.lastrowid
  *and* returning.   so now we can pick between them for SQLite
  and mariadb.  so, we are trying to keep it on .lastrowid for
  simple inserts with an autoincrement column, this helps with
  some edge case test scenarios and i bet .lastrowid is faster
  anyway.  any return_defaults() / multiparams etc then we
  use returning
* SQLite decided they dont want to return rows that match in
  ON CONFLICT.  this is flat out wrong, but for now we need to
  work with it.

Fixes: #6195
Fixes: #7011
Closes: #7047
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7047
Pull-request-sha: d25d5ea3abe094f282c53c7dd87f5f53a9e85248

Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I9908ce0ff7bdc50bd5b27722081767c31c19a950
43 files changed:
doc/build/glossary.rst
doc/build/orm/persistence_techniques.rst
doc/build/orm/versioning.rst
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mssql/pyodbc.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/postgresql/psycopg.py
lib/sqlalchemy/dialects/postgresql/psycopg2.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/engine/create.py
lib/sqlalchemy/engine/cursor.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/ext/horizontal_shard.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/sql/dml.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/assertsql.py
lib/sqlalchemy/testing/fixtures.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_insert.py
test/dialect/oracle/test_dialect.py
test/dialect/oracle/test_types.py
test/engine/test_deprecations.py
test/orm/test_defaults.py
test/orm/test_events.py
test/orm/test_naturalpks.py
test/orm/test_unitofwork.py
test/orm/test_unitofworkv2.py
test/orm/test_update_delete.py
test/orm/test_versioning.py
test/requirements.py
test/sql/test_defaults.py
test/sql/test_insert.py
test/sql/test_insert_exec.py
test/sql/test_returning.py
test/sql/test_sequences.py
test/sql/test_type_expressions.py