Skip to content

Commit e3e06ea

Browse files
committed
call _compiler_dispatch for merge_into and copy_into clauses
1 parent 63e5e20 commit e3e06ea

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/snowflake/sqlalchemy/base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def visit_merge_into(self, merge_into, **kw):
158158
clauses = " ".join(
159159
clause._compiler_dispatch(self, **kw) for clause in merge_into.clauses
160160
)
161+
target = merge_into.target._compiler_dispatch(self, asfrom=True, **kw)
162+
source = merge_into.source._compiler_dispatch(self, asfrom=True, **kw)
163+
on = merge_into.on._compiler_dispatch(self, **kw)
161164
return (
162-
f"MERGE INTO {merge_into.target} USING {merge_into.source} ON {merge_into.on}"
165+
f"MERGE INTO {target} USING {source} ON {on}"
163166
+ (" " + clauses if clauses else "")
164167
)
165168

@@ -207,11 +210,7 @@ def visit_copy_into(self, copy_into, **kw):
207210
formatter = copy_into.formatter._compiler_dispatch(self, **kw)
208211
else:
209212
formatter = ""
210-
into = (
211-
copy_into.into
212-
if isinstance(copy_into.into, Table)
213-
else copy_into.into._compiler_dispatch(self, **kw)
214-
)
213+
into = copy_into.into._compiler_dispatch(self, asfrom=True, **kw)
215214
from_ = None
216215
if isinstance(copy_into.from_, Table):
217216
from_ = copy_into.from_

0 commit comments

Comments
 (0)