Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call _compiler_dispatch for merge_into and copy_into clauses #372

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/snowflake/sqlalchemy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,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 @@ -210,11 +213,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