Skip to content

Commit

Permalink
fix: Ensure table name is quoted in merge statement
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 25, 2024
1 parent 156034a commit 43a9570
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion target_snowflake/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import snowflake.sqlalchemy.custom_types as sct
import sqlalchemy
from sqlalchemy.sql import quoted_name
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from singer_sdk import typing as th
Expand Down Expand Up @@ -388,7 +389,7 @@ def _get_merge_from_stage_statement( # noqa: ANN202
dedup = f"QUALIFY ROW_NUMBER() OVER (PARTITION BY {dedup_cols} ORDER BY SEQ8() DESC) = 1"
return (
text(
f"merge into {full_table_name} d using " # noqa: ISC003
f"merge into {quoted_name(full_table_name, quote=True)} d using " # noqa: ISC003
+ f"(select {json_casting_selects} from '@~/target-snowflake/{sync_id}'" # noqa: S608
+ f"(file_format => {file_format}) {dedup}) s "
+ f"on {join_expr} "
Expand Down

0 comments on commit 43a9570

Please sign in to comment.