Skip to content

Commit 77ca100

Browse files
Merge pull request #13 from AlexanderMann/performance/remove-command-is-redundant
Performance: REMOVEing from an internal table stage before a DROP TABLE command is redundant
2 parents 1fb4615 + 46266b3 commit 77ca100

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

target_snowflake/snowflake.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,14 @@ def perform_update(self, cur, target_table_name, temp_table_name, key_properties
413413
insert_columns=insert_columns,
414414
dedupped_columns=dedupped_columns))
415415

416-
# Clear out the associated stage for the table
417-
cur.execute('''
418-
REMOVE @{db}.{schema}.%{temp_table}
419-
'''.format(
420-
db=sql.identifier(self.connection.configured_database),
421-
schema=sql.identifier(self.connection.configured_schema),
422-
temp_table=sql.identifier(temp_table_name)
423-
))
416+
if not self.s3:
417+
# Clear out the associated stage for the table
418+
cur.execute('''
419+
REMOVE @{db}.{schema}.%{temp_table}
420+
'''.format(
421+
db=sql.identifier(self.connection.configured_database),
422+
schema=sql.identifier(self.connection.configured_schema),
423+
temp_table=sql.identifier(temp_table_name)))
424424

425425
# Drop the tmp table
426426
cur.execute('''

0 commit comments

Comments
 (0)