fix: string type as get system datatype (#20922)

This commit is contained in:
Keshav Mohta 2025-04-24 15:40:58 +05:30 committed by Keshav Mohta
parent 4731d6be77
commit 1eb83c2bde
No known key found for this signature in database
GPG Key ID: 9481AB99C36FAE9C

View File

@ -154,6 +154,18 @@ def _array_sys_data_type_repr(col_type):
)
def get_system_data_type(col_type):
"""
Get the system data type for the column type
"""
if isinstance(col_type, String):
return "string"
if str(col_type) == "ARRAY":
return _array_sys_data_type_repr(col_type)
return str(col_type)
def get_columns(bq_schema):
"""
get_columns method overwritten to include tag details
@ -170,11 +182,7 @@ def get_columns(bq_schema):
"precision": field.precision,
"scale": field.scale,
"max_length": field.max_length,
"system_data_type": (
_array_sys_data_type_repr(col_type)
if str(col_type) == "ARRAY"
else str(col_type)
),
"system_data_type": get_system_data_type(col_type),
"is_complex": is_complex_type(str(col_type)),
"policy_tags": None,
}