Skip to content

Commit

Permalink
Fix: improve schema error handling (#3663)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas authored Jun 16, 2024
1 parent a739741 commit 868f30d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlglot/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ def _normalize(self, schema: t.Dict) -> t.Dict:

if not isinstance(columns, dict):
raise SchemaError(error_msg.format(".".join(keys[:-1]), len(flattened_schema[0])))
if not columns:
raise SchemaError(f"Table {'.'.join(keys[:-1])} must have at least one column")
if isinstance(first(columns.values()), dict):
raise SchemaError(
error_msg.format(
Expand Down

0 comments on commit 868f30d

Please sign in to comment.