Skip to content

Commit

Permalink
fix(bigquery): improve WITH CONNECTION parsing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoldHueteG committed Feb 2, 2025
1 parent 7292c2b commit 11128a9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sqlglot/dialects/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,19 @@ def _parse_export_data(self) -> exp.Export:
options = None

if self._match_text_seq("WITH", "CONNECTION"):
with_connection = self._parse_table_parts()
parts = []
while True:
part = self._parse_var()
if not part:
break
parts.append(part.name)
if not self._match(TokenType.DOT):
break

if not parts:
self.raise_error("Expected connection name after WITH CONNECTION")

with_connection = exp.Identifier(this=".".join(parts))

if self._match_text_seq("OPTIONS"):
self._match(TokenType.L_PAREN)
Expand Down

0 comments on commit 11128a9

Please sign in to comment.