Skip to content

Commit

Permalink
Fix: make schema type handle UNKNOWN
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed May 19, 2023
1 parent 64f596d commit bb20335
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sqlglot/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,8 @@ def _to_data_type(self, schema_type: str) -> exp.DataType:
"""
if schema_type not in self._type_mapping_cache:
try:
expression = exp.maybe_parse(schema_type, into=exp.DataType, dialect=self.dialect)
if expression is None:
raise ValueError(f"Could not parse {schema_type}")
self._type_mapping_cache[schema_type] = expression # type: ignore
expression = exp.DataType.build(schema_type, dialect=self.dialect)
self._type_mapping_cache[schema_type] = expression
except AttributeError:
raise SchemaError(f"Failed to convert type {schema_type}")

Expand Down

0 comments on commit bb20335

Please sign in to comment.