summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/information_schema.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-03-14 13:57:42 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2020-03-15 19:09:04 -0400
commit62b7dace0c1d03acf3224085d03a03684a969031 (patch)
tree29037c928ce0b5b728a5d7ba2eb24ac6f110664c /lib/sqlalchemy/dialects/mssql/information_schema.py
parentfcc03730c553b3fc0229e446e886d4f61dcb6291 (diff)
downloadsqlalchemy-62b7dace0c1d03acf3224085d03a03684a969031.tar.gz
Support inspection of computed column
Added support for reflection of "computed" columns, which are now returned as part of the structure returned by :meth:`.Inspector.get_columns`. When reflecting full :class:`.Table` objects, computed columns will be represented using the :class:`.Computed` construct. Also improve the documentation in :meth:`Inspector.get_columns`, correctly listing all the returned keys. Fixes: #5063 Fixes: #4051 Closes: #5064 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5064 Pull-request-sha: ba00fc321ce468f8885aad23b3dd33c789e50fbe Change-Id: I789986554fc8ac7f084270474d0b2c12046b1cc2
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/information_schema.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/information_schema.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/information_schema.py b/lib/sqlalchemy/dialects/mssql/information_schema.py
index 0b6ad137e..e9ab6f4f3 100644
--- a/lib/sqlalchemy/dialects/mssql/information_schema.py
+++ b/lib/sqlalchemy/dialects/mssql/information_schema.py
@@ -15,6 +15,7 @@ from ... import Table
from ... import util
from ...ext.compiler import compiles
from ...sql import expression
+from ...types import Boolean
from ...types import Integer
from ...types import String
from ...types import TypeDecorator
@@ -161,3 +162,14 @@ views = Table(
Column("IS_UPDATABLE", String, key="is_updatable"),
schema="INFORMATION_SCHEMA",
)
+
+computed_columns = Table(
+ "computed_columns",
+ ischema,
+ Column("object_id", Integer),
+ Column("name", CoerceUnicode),
+ Column("is_computed", Boolean),
+ Column("is_persisted", Boolean),
+ Column("definition", CoerceUnicode),
+ schema="sys",
+)