Skip to content

Commit

Permalink
Fix: bigquery quoted udf project id
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Jun 29, 2023
1 parent 2d00f34 commit 0357d63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4715,12 +4715,8 @@ def _replace_columns_with_dots(self, this):
exp.replace_children(this, self._replace_columns_with_dots)
table = this.args.get("table")
this = (
self.expression(exp.Dot, this=table, expression=this.this)
if table
else self.expression(exp.Var, this=this.name)
self.expression(exp.Dot, this=table, expression=this.this) if table else this.this
)
elif isinstance(this, exp.Identifier):
this = self.expression(exp.Var, this=this.name)

return this

Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_bigquery(self):
with self.assertRaises(ParseError):
transpile("SELECT * FROM UNNEST(x) AS x(y)", read="bigquery")

self.validate_identity("SELECT `project-id`.udfs.func(call.dir)")
self.validate_identity("SELECT CAST(CURRENT_DATE AS STRING FORMAT 'DAY') AS current_day")
self.validate_identity("SAFE_CAST(encrypted_value AS STRING FORMAT 'BASE64')")
self.validate_identity("CAST(encrypted_value AS STRING FORMAT 'BASE64')")
Expand Down

0 comments on commit 0357d63

Please sign in to comment.