Skip to content

Commit e476267

Browse files
committed
fix: push down storage integration usage
1 parent 6ac4713 commit e476267

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

snowflake_utils/models/table.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ def _copy(
200200

201201
logging.info(f"Starting copy into `{self.fqn}` from path '{path}'")
202202
return execute(
203-
query.format(file_format=self.file_format, from_clause=from_clause)
203+
query.format(
204+
file_format=self.file_format,
205+
from_clause=from_clause,
206+
storage_integration_clause=f"STORAGE_INTEGRATION = {storage_integration}"
207+
if storage_integration and not (stage or self._stage)
208+
else "",
209+
)
204210
)
205211

206212
def copy_into(
@@ -230,7 +236,7 @@ def copy_into(
230236
copy_query = f"""
231237
COPY INTO {self.fqn} {col_str}
232238
FROM {{from_clause}}
233-
{f"STORAGE_INTEGRATION = {storage_integration}" if storage_integration and not (stage or self._stage) else ""}
239+
{{storage_integration_clause}}
234240
FILE_FORMAT = ( FORMAT_NAME ='{{file_format}}')
235241
MATCH_BY_COLUMN_NAME={match_by_column_name.value}
236242
{files_clause}

0 commit comments

Comments
 (0)