Skip to content

Commit

Permalink
Fix: table name with dots
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Jun 28, 2023
1 parent 9d178c4 commit ebe04bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,12 @@ class Table(Expression):
"system_time": False,
}

@property
def name(self) -> str:
if isinstance(self.this, Func):
return ""
return self.this.name

@property
def db(self) -> str:
return self.text("db")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_qualify_columns(self):
),
dialect="bigquery",
).sql(),
'WITH "x" AS (SELECT "y"."a" AS "a" FROM "DB"."Y" AS "y" CROSS JOIN "a"."b"."INFORMATION_SCHEMA"."COLUMNS" AS "_q_0") SELECT "x"."a" AS "a" FROM "x"',
'WITH "x" AS (SELECT "y"."a" AS "a" FROM "DB"."Y" AS "y" CROSS JOIN "a"."b"."INFORMATION_SCHEMA"."COLUMNS" AS "columns") SELECT "x"."a" AS "a" FROM "x"',
)

self.check_file("qualify_columns", qualify_columns, execute=True, schema=self.schema)
Expand Down

0 comments on commit ebe04bb

Please sign in to comment.