diff options
author | Gord Thompson <gord@gordthompson.com> | 2020-08-12 14:46:59 -0600 |
---|---|---|
committer | Gord Thompson <gord@gordthompson.com> | 2020-09-01 08:05:51 -0600 |
commit | 516131c40da9c8cd304061850e2d98e309966dd5 (patch) | |
tree | 148c91095e3021de6881fc0d328980538d3fcea0 /lib/sqlalchemy/dialects/mssql/information_schema.py | |
parent | 301c3f3579ace1ef1c28067904b57dd789620eae (diff) | |
download | sqlalchemy-516131c40da9c8cd304061850e2d98e309966dd5.tar.gz |
Improve reflection for mssql temporary tables
Fixes: #5506
Change-Id: I718474d76e3c630a1b71e07eaa20cefb104d11de
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/information_schema.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/information_schema.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/information_schema.py b/lib/sqlalchemy/dialects/mssql/information_schema.py index 6cdde8386..f80110b7d 100644 --- a/lib/sqlalchemy/dialects/mssql/information_schema.py +++ b/lib/sqlalchemy/dialects/mssql/information_schema.py @@ -5,9 +5,6 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -# TODO: should be using the sys. catalog with SQL Server, not information -# schema - from ... import cast from ... import Column from ... import MetaData @@ -93,6 +90,25 @@ columns = Table( schema="INFORMATION_SCHEMA", ) +mssql_temp_table_columns = Table( + "COLUMNS", + ischema, + Column("TABLE_SCHEMA", CoerceUnicode, key="table_schema"), + Column("TABLE_NAME", CoerceUnicode, key="table_name"), + Column("COLUMN_NAME", CoerceUnicode, key="column_name"), + Column("IS_NULLABLE", Integer, key="is_nullable"), + Column("DATA_TYPE", String, key="data_type"), + Column("ORDINAL_POSITION", Integer, key="ordinal_position"), + Column( + "CHARACTER_MAXIMUM_LENGTH", Integer, key="character_maximum_length" + ), + Column("NUMERIC_PRECISION", Integer, key="numeric_precision"), + Column("NUMERIC_SCALE", Integer, key="numeric_scale"), + Column("COLUMN_DEFAULT", Integer, key="column_default"), + Column("COLLATION_NAME", String, key="collation_name"), + schema="tempdb.INFORMATION_SCHEMA", +) + constraints = Table( "TABLE_CONSTRAINTS", ischema, |