Skip to content

Commit

Permalink
call _compiler_dispatch for merge_into and copy_into clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
sjhewitt committed Mar 15, 2023
1 parent 63e5e20 commit e3e06ea
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/snowflake/sqlalchemy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ def visit_merge_into(self, merge_into, **kw):
clauses = " ".join(
clause._compiler_dispatch(self, **kw) for clause in merge_into.clauses
)
target = merge_into.target._compiler_dispatch(self, asfrom=True, **kw)
source = merge_into.source._compiler_dispatch(self, asfrom=True, **kw)
on = merge_into.on._compiler_dispatch(self, **kw)
return (
f"MERGE INTO {merge_into.target} USING {merge_into.source} ON {merge_into.on}"
f"MERGE INTO {target} USING {source} ON {on}"
+ (" " + clauses if clauses else "")
)

Expand Down Expand Up @@ -207,11 +210,7 @@ def visit_copy_into(self, copy_into, **kw):
formatter = copy_into.formatter._compiler_dispatch(self, **kw)
else:
formatter = ""
into = (
copy_into.into
if isinstance(copy_into.into, Table)
else copy_into.into._compiler_dispatch(self, **kw)
)
into = copy_into.into._compiler_dispatch(self, asfrom=True, **kw)
from_ = None
if isinstance(copy_into.from_, Table):
from_ = copy_into.from_
Expand Down

0 comments on commit e3e06ea

Please sign in to comment.