Skip to content

Commit 8b34b0b

Browse files
committed
fix: tests
1 parent 4b200f4 commit 8b34b0b

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

snowflake_utils/models/table.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,19 @@ def _copy(
189189

190190
if sync_tags and self.table_structure:
191191
self.sync_tags(cursor)
192+
193+
# Determine the FROM clause based on whether we're using a stage or direct path
194+
if stage:
195+
from_clause = f"@{stage}/{path}"
196+
elif storage_integration:
197+
from_clause = f"@{self.stage}"
198+
else:
199+
from_clause = f"'{path}'"
200+
192201
logging.info(f"Starting copy into `{self.fqn}` from path '{path}'")
193-
return execute(query.format(file_format=self.file_format))
202+
return execute(
203+
query.format(file_format=self.file_format, from_clause=from_clause)
204+
)
194205

195206
def copy_into(
196207
self,
@@ -216,17 +227,9 @@ def copy_into(
216227
files_str = "', '".join(files)
217228
files_clause = f"FILES = ('{files_str}')"
218229

219-
# Determine the FROM clause based on whether we're using a stage or direct path
220-
if stage:
221-
from_clause = f"@{stage}/{path}"
222-
elif storage_integration:
223-
from_clause = f"@{self.stage}"
224-
else:
225-
from_clause = f"'{path}'"
226-
227230
copy_query = f"""
228231
COPY INTO {self.fqn} {col_str}
229-
FROM {from_clause}
232+
FROM {{from_clause}}
230233
{f"STORAGE_INTEGRATION = {storage_integration}" if storage_integration and not stage else ""}
231234
FILE_FORMAT = ( FORMAT_NAME ='{{file_format}}')
232235
MATCH_BY_COLUMN_NAME={match_by_column_name.value}

0 commit comments

Comments
 (0)