]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Support for generated columns
authorCaselIT <cfederico87@gmail.com>
Mon, 4 Nov 2019 22:11:21 +0000 (17:11 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 8 Nov 2019 20:41:10 +0000 (15:41 -0500)
commit16eb92ea0905196c88f4db19f83cd2ca02a57c5b
treeacc993344f814f5f19e52e20f68360b8f752df35
parent307c4c4c5cbdd59e075bbe8f45274635cdd34e9b
Support for generated columns

Added DDL support for "computed columns"; these are DDL column
specifications for columns that have a server-computed value, either upon
SELECT (known as "virtual") or at the point of which they are INSERTed or
UPDATEd (known as "stored").  Support is established for Postgresql, MySQL,
Oracle SQL Server and Firebird. Thanks to Federico Caselli for lots of work
on this one.

ORM round trip tests included.  The ORM makes use of existing
FetchedValue support and no additional ORM logic is present for
the basic feature.

It has been observed that Oracle RETURNING does not return the
new value of a computed column upon UPDATE; it returns the
prior value.  As this is very dangerous, a warning is emitted
if a computed column is rendered into the RETURNING clause
of an UPDATE statement.

Fixes: #4894
Closes: #4928
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4928
Pull-request-sha: d39c521d5ac6ebfb4fb5b53846451de79752e64c

Change-Id: I2610b2999a5b1b127ed927dcdaeee98b769643ce
(cherry picked from commit 602d1e6dfd538980bb8d513867b17dbc2b4b92dd)
26 files changed:
doc/build/changelog/unreleased_13/4894.rst [new file with mode: 0644]
doc/build/core/defaults.rst
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/firebird/base.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/requirements.py
lib/sqlalchemy/testing/suite/test_select.py
test/dialect/mssql/test_compiler.py
test/dialect/mysql/test_compiler.py
test/dialect/oracle/test_compiler.py
test/dialect/oracle/test_dialect.py
test/dialect/postgresql/test_compiler.py
test/dialect/test_firebird.py
test/dialect/test_sqlite.py
test/orm/test_defaults.py
test/requirements.py
test/sql/test_computed.py [new file with mode: 0644]
test/sql/test_metadata.py