Skip to content

Commit 244e3c8

Browse files
simple remarks transforms
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 966a7aa commit 244e3c8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/databricks/sql/backend/sea/utils/metadata_mappings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MetadataColumnMappings:
2626
SCHEMA_COLUMN = ResultColumn("TABLE_SCHEM", "namespace", SqlType.STRING)
2727
TABLE_NAME_COLUMN = ResultColumn("TABLE_NAME", "tableName", SqlType.STRING)
2828
TABLE_TYPE_COLUMN = ResultColumn("TABLE_TYPE", "tableType", SqlType.STRING)
29-
REMARKS_COLUMN = ResultColumn("REMARKS", "remarks", SqlType.STRING)
29+
REMARKS_COLUMN = ResultColumn("REMARKS", "remarks", SqlType.STRING, transform_remarks)
3030
TYPE_CATALOG_COLUMN = ResultColumn("TYPE_CAT", None, SqlType.STRING)
3131
TYPE_SCHEM_COLUMN = ResultColumn("TYPE_SCHEM", None, SqlType.STRING)
3232
TYPE_NAME_COLUMN = ResultColumn("TYPE_NAME", None, SqlType.STRING)
@@ -54,7 +54,7 @@ class MetadataColumnMappings:
5454
transform_ordinal_position,
5555
)
5656

57-
NULLABLE_COLUMN = ResultColumn("NULLABLE", None, SqlType.INT, transform_nullable)
57+
NULLABLE_COLUMN = ResultColumn("NULLABLE", "isNullable", SqlType.INT, transform_nullable)
5858
COLUMN_DEF_COLUMN = ResultColumn("COLUMN_DEF", None, SqlType.STRING)
5959
SQL_DATA_TYPE_COLUMN = ResultColumn("SQL_DATA_TYPE", None, SqlType.INT)
6060
SQL_DATETIME_SUB_COLUMN = ResultColumn("SQL_DATETIME_SUB", None, SqlType.INT)

src/databricks/sql/backend/sea/utils/metadata_transforms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def transform_is_autoincrement(value):
55
"""Transform IS_AUTOINCREMENT: boolean to YES/NO string."""
6-
if isinstance(value, bool):
6+
if isinstance(value, bool) or value is None:
77
return "YES" if value else "NO"
88
return value
99

@@ -16,6 +16,10 @@ def transform_is_nullable(value):
1616
return "NO"
1717
return value
1818

19+
def transform_remarks(value):
20+
if value is None:
21+
return ""
22+
return value
1923

2024
def transform_nullable(value):
2125
"""Transform NULLABLE column: boolean/string to integer."""

0 commit comments

Comments
 (0)