@@ -32,53 +32,53 @@ def __init__(
3232 def extract_table_entities_sql_query (self ) -> str :
3333 """A property to extract table entities from a SQL Server database."""
3434 return """SELECT
35- t.TABLE_NAME AS Entity,
36- t.TABLE_SCHEMA AS EntitySchema,
37- CAST(ep.value AS NVARCHAR(500)) AS Definition
38- FROM
39- INFORMATION_SCHEMA.TABLES t
40- LEFT JOIN
41- sys.extended_properties ep
42- ON ep.major_id = OBJECT_ID(t.TABLE_SCHEMA + '.' + t.TABLE_NAME)
43- AND ep.minor_id = 0
44- AND ep.class = 1
45- AND ep.name = 'MS_Description'
46- WHERE
47- t.TABLE_TYPE = 'BASE TABLE';"""
35+ t.TABLE_NAME AS Entity,
36+ t.TABLE_SCHEMA AS EntitySchema,
37+ CAST(ep.value AS NVARCHAR(500)) AS Definition
38+ FROM
39+ INFORMATION_SCHEMA.TABLES t
40+ LEFT JOIN
41+ sys.extended_properties ep
42+ ON ep.major_id = OBJECT_ID(t.TABLE_SCHEMA + '.' + t.TABLE_NAME)
43+ AND ep.minor_id = 0
44+ AND ep.class = 1
45+ AND ep.name = 'MS_Description'
46+ WHERE
47+ t.TABLE_TYPE = 'BASE TABLE';"""
4848
4949 @property
5050 def extract_view_entities_sql_query (self ) -> str :
5151 """A property to extract view entities from a SQL Server database."""
5252 return """SELECT
53- v.TABLE_NAME AS Entity,
54- v.TABLE_SCHEMA AS EntitySchema,
55- CAST(ep.value AS NVARCHAR(500)) AS Definition
56- FROM
57- INFORMATION_SCHEMA.VIEWS v
58- LEFT JOIN
59- sys.extended_properties ep
60- ON ep.major_id = OBJECT_ID(v.TABLE_SCHEMA + '.' + v.TABLE_NAME)
61- AND ep.minor_id = 0
62- AND ep.class = 1
53+ v.TABLE_NAME AS Entity,
54+ v.TABLE_SCHEMA AS EntitySchema,
55+ CAST(ep.value AS NVARCHAR(500)) AS Definition
56+ FROM
57+ INFORMATION_SCHEMA.VIEWS v
58+ LEFT JOIN
59+ sys.extended_properties ep
60+ ON ep.major_id = OBJECT_ID(v.TABLE_SCHEMA + '.' + v.TABLE_NAME)
61+ AND ep.minor_id = 0
62+ AND ep.class = 1
6363 AND ep.name = 'MS_Description';"""
6464
6565 def extract_columns_sql_query (self , entity : EntityItem ) -> str :
6666 """A property to extract column information from a SQL Server database."""
6767 return f"""SELECT
68- c.COLUMN_NAME AS Name,
69- c.DATA_TYPE AS DataType,
70- CAST(ep.value AS NVARCHAR(500)) AS Definition
71- FROM
72- INFORMATION_SCHEMA.COLUMNS c
73- LEFT JOIN
74- sys.extended_properties ep
75- ON ep.major_id = OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME)
76- AND ep.minor_id = c.ORDINAL_POSITION
77- AND ep.class = 1
78- AND ep.name = 'MS_Description'
79- WHERE
80- c.TABLE_SCHEMA = '{ entity .entity_schema } '
81- AND c.TABLE_NAME = '{ entity .name } ';"""
68+ c.COLUMN_NAME AS Name,
69+ c.DATA_TYPE AS DataType,
70+ CAST(ep.value AS NVARCHAR(500)) AS Definition
71+ FROM
72+ INFORMATION_SCHEMA.COLUMNS c
73+ LEFT JOIN
74+ sys.extended_properties ep
75+ ON ep.major_id = OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME)
76+ AND ep.minor_id = c.ORDINAL_POSITION
77+ AND ep.class = 1
78+ AND ep.name = 'MS_Description'
79+ WHERE
80+ c.TABLE_SCHEMA = '{ entity .entity_schema } '
81+ AND c.TABLE_NAME = '{ entity .name } ';"""
8282
8383 @property
8484 def extract_entity_relationships_sql_query (self ) -> str :
0 commit comments