Skip to content

Commit e33d6f0

Browse files
committed
fix: mssql table schema query
1 parent 3eb8e0e commit e33d6f0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dcs_core/integrations/databases/mssql.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ def query_get_table_columns(
173173
"""
174174
schema = schema or self.schema_name
175175
database = self.quote_database(self.database)
176-
query = f"SELECT column_name, data_type, datetime_precision, numeric_precision, numeric_scale, collation_name, character_maximum_length FROM {database}.information_schema.columns WHERE table_name = '{table}' AND table_schema = '{schema}'"
177-
176+
query = (
177+
"SELECT column_name, data_type, ISNULL(datetime_precision, 0) AS datetime_precision, ISNULL(numeric_precision, 0) AS numeric_precision, ISNULL(numeric_scale, 0) AS numeric_scale, collation_name, ISNULL(character_maximum_length, 0) AS character_maximum_length "
178+
f"FROM {database}.information_schema.columns"
179+
f"WHERE table_name = '{table}' AND table_schema = '{schema}'"
180+
)
178181
rows = self.fetchall(query)
179182
if not rows:
180183
raise RuntimeError(

0 commit comments

Comments
 (0)