Skip to content

Commit

Permalink
Update to_sql_type
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 7, 2024
1 parent 4fd6d10 commit cdedc0f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions target_snowflake/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ def _conform_max_length(jsonschema_type): # noqa: ANN205, ANN001
jsonschema_type["maxLength"] = SNOWFLAKE_MAX_STRING_LENGTH
return jsonschema_type

@staticmethod
def to_sql_type(jsonschema_type: dict) -> sqlalchemy.types.TypeEngine:
def to_sql_type(self, jsonschema_type: dict) -> sqlalchemy.types.TypeEngine:
"""Return a JSON Schema representation of the provided type.
Uses custom Snowflake types from [snowflake-sqlalchemy](https://github.com/snowflakedb/snowflake-sqlalchemy/blob/main/src/snowflake/sqlalchemy/custom_types.py)
Expand All @@ -331,7 +330,7 @@ def to_sql_type(jsonschema_type: dict) -> sqlalchemy.types.TypeEngine:
"""
# start with default implementation
jsonschema_type = SnowflakeConnector._conform_max_length(jsonschema_type)
target_type = SQLConnector.to_sql_type(jsonschema_type)
target_type = self.to_sql_type(jsonschema_type)
# snowflake max and default varchar length
# https://docs.snowflake.com/en/sql-reference/intro-summary-data-types.html
maxlength = jsonschema_type.get("maxLength", SNOWFLAKE_MAX_STRING_LENGTH)
Expand Down

0 comments on commit cdedc0f

Please sign in to comment.