Skip to content

Commit

Permalink
fix(sql): handle parsing aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Jul 31, 2023
1 parent b6b3c2b commit 3645cf4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ibis/expr/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ def to_sqlglot(self):

def overlay(self, step):
updates = {dep.name: convert(dep, catalog=self) for dep in step.dependencies}

# handle scan aliases: FROM foo AS bar
source = getattr(step, "source", None)
alias = getattr(source, "args", {}).get("alias")
if alias is not None and (source_name := self.get(source.name)) is not None:
self[alias.name] = source_name

return Catalog({**self, **updates})


Expand Down

0 comments on commit 3645cf4

Please sign in to comment.