Skip to content

Commit

Permalink
Support config type
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed May 18, 2024
1 parent 8f787ac commit b6bd8fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datacontract/export/bigquery_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
6 changes: 6 additions & 0 deletions datacontract/export/sql_type_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6bd8fb

Please sign in to comment.