Skip to content

Commit 868f30d

Browse files
authored
Fix: improve schema error handling (#3663)
1 parent a739741 commit 868f30d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sqlglot/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def _normalize(self, schema: t.Dict) -> t.Dict:
386386

387387
if not isinstance(columns, dict):
388388
raise SchemaError(error_msg.format(".".join(keys[:-1]), len(flattened_schema[0])))
389+
if not columns:
390+
raise SchemaError(f"Table {'.'.join(keys[:-1])} must have at least one column")
389391
if isinstance(first(columns.values()), dict):
390392
raise SchemaError(
391393
error_msg.format(

0 commit comments

Comments
 (0)