diff --git a/datacontract/export/bigquery_converter.py b/datacontract/export/bigquery_converter.py index 9094a88b..a8e210aa 100644 --- a/datacontract/export/bigquery_converter.py +++ b/datacontract/export/bigquery_converter.py @@ -20,7 +20,7 @@ def to_bigquery_schema(model_name: str, model_value: Model, server: Server) -> d "description": model_value.description, "schema": { "fields": to_fields_array(model_value.fields) - } + } } def to_fields_array(fields: Dict[str, Field]) -> List[Dict[str, Field]]: diff --git a/datacontract/export/sql_type_converter.py b/datacontract/export/sql_type_converter.py index 161f2b56..af1a347d 100644 --- a/datacontract/export/sql_type_converter.py +++ b/datacontract/export/sql_type_converter.py @@ -59,6 +59,9 @@ def convert_to_snowflake(field: Field) -> None | str: # https://www.postgresql.org/docs/current/datatype.html # Using the name whenever possible def convert_type_to_postgres(field: Field) -> None | str: + if field.config and field.config["postgresType"] is not None: + return field.config["postgresType"] + type = field.type if type is None: return None @@ -101,6 +104,9 @@ def convert_type_to_postgres(field: Field) -> None | str: # databricks data types: # https://docs.databricks.com/en/sql/language-manual/sql-ref-datatypes.html def convert_to_databricks(field) -> None | str: + if field.config and field.config["databricksType"] is not None: + return field.config["databricksType"] + type = field.type if type is None: return None