Skip to content

Commit

Permalink
Fix(oracle): allow parsing of @dblink in table names (#1540)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas authored May 4, 2023
1 parent 444dd94 commit 0578d6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sqlglot/dialects/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ def xmltable_sql(self, expression: exp.XMLTable) -> str:
return f"XMLTABLE({self.sep('')}{self.indent(this + passing + by_ref + columns)}{self.seg(')', sep='')}"

class Tokenizer(tokens.Tokenizer):
VAR_SINGLE_TOKENS = {"@"}

KEYWORDS = {
**tokens.Tokenizer.KEYWORDS,
"(+)": TokenType.JOIN_MARKER,
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class TestOracle(Validator):
dialect = "oracle"

def test_oracle(self):
self.validate_identity("SELECT * FROM table_name@dblink_name.database_link_domain")
self.validate_identity("SELECT * FROM V$SESSION")
self.validate_identity(
"SELECT MIN(column_name) KEEP (DENSE_RANK FIRST ORDER BY column_name DESC) FROM table_name"
Expand Down

0 comments on commit 0578d6d

Please sign in to comment.