summaryrefslogtreecommitdiff
path: root/alembic/util/__init__.py
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2019-12-27 17:26:38 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-01-01 15:11:00 -0500
commit3ea190f843c7f246f73f91a9b79ede63d8d610fb (patch)
tree3f9109e9189189315c15c081d2d2c6e47842bba9 /alembic/util/__init__.py
parent286fbcf2408d0264500e0527c3cb9d2f41cb5b1e (diff)
downloadalembic-3ea190f843c7f246f73f91a9b79ede63d8d610fb.tar.gz
Add support for computed columns
Added support for rendering of "computed" elements on :class:`.Column` objects, supported in SQLAlchemy via the new :class:`.Computed` element introduced in version 1.3.11. Pull request courtesy Federico Caselli. Note that there is currently no support for ALTER COLUMN to add, remove, or modify the "GENERATED ALWAYS AS" element from a column; at least for PostgreSQL, it does not seem to be supported by the database. Additionally, SQLAlchemy does not currently reliably reflect the "GENERATED ALWAYS AS" phrase from an existing column, so there is also no autogenerate support for addition or removal of the :class:`.Computed` element to or from an existing column, there is only support for adding new columns that include the :class:`.Computed` element. In the case that the :class:`.Computed` element is removed from the :class:`.Column` object in the table metadata, PostgreSQL and Oracle currently reflect the "GENERATED ALWAYS AS" expression as the "server default" which will produce an op that tries to drop the element as a default. In order to facilitate using testing combinations with elements that are not necessarily present, the support for lambda combinations from SQLAlchemy Ia63a510f9c1d08b055eef62cf047f1f427f0450c is also ported here, as well as a vendoring in of the current sqlalchemy.testing.exclusions module where we need the additional combinations support added in I15d2839954d77a252bab5aaf6e3fd9f388c99dd5. Fixes: #624 Closes: #631 Pull-request: https://github.com/sqlalchemy/alembic/pull/631 Pull-request-sha: 9c45651295626edf5f172ec827a5ced1440818cf Change-Id: Ifd27c2f541b22fb7a78de1afaa36dbf509ff6d3f
Diffstat (limited to 'alembic/util/__init__.py')
-rw-r--r--alembic/util/__init__.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/alembic/util/__init__.py b/alembic/util/__init__.py
index 0ed9a37..5e1a513 100644
--- a/alembic/util/__init__.py
+++ b/alembic/util/__init__.py
@@ -27,6 +27,7 @@ from .sqla_compat import sqla_1115 # noqa
from .sqla_compat import sqla_120 # noqa
from .sqla_compat import sqla_1216 # noqa
from .sqla_compat import sqla_13 # noqa
+from .sqla_compat import has_computed # noqa
if not sqla_110: