FIX #19232 - Correct array type mapping in ORM converter (#19241)

This commit is contained in:
Pere Miquel Brull 2025-01-07 07:02:36 +01:00
parent 87de0df9d8
commit c37944a088
2 changed files with 9 additions and 1 deletions

View File

@ -94,6 +94,12 @@ class SqlColumnHandlerMixin:
parsed_string["name"] = column["name"]
else:
col_type = ColumnTypeParser.get_column_type(column["type"])
# For arrays, we'll get the item type if possible, or parse the string representation of the column
# if SQLAlchemy does not provide any further information
if col_type == "ARRAY" and getattr(column["type"], "item_type"):
arr_data_type = ColumnTypeParser.get_column_type(
column["type"].item_type
)
if col_type == "ARRAY" and re.match(
r"(?:\w*)(?:\()(\w*)(?:.*)", str(column["type"])
):

View File

@ -76,7 +76,9 @@ class CommonMapTypes:
"""returns an ORM type"""
if col.arrayDataType:
return self._TYPE_MAP.get(col.dataType)(item_type=col.arrayDataType)
return self._TYPE_MAP.get(col.dataType)(
item_type=self._TYPE_MAP.get(col.arrayDataType)
)
return self.return_custom_type(col, table_service_type)
def return_custom_type(self, col: Column, _):