Skip to content

Commit

Permalink
Feature: Only REMOVE when using internal stage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMann committed Aug 29, 2019
1 parent 3a37738 commit 46266b3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions target_snowflake/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ def perform_update(self, cur, target_table_name, temp_table_name, key_properties
insert_columns=insert_columns,
dedupped_columns=dedupped_columns))

if not self.s3:
# Clear out the associated stage for the table
cur.execute('''
REMOVE @{db}.{schema}.%{temp_table}
'''.format(
db=sql.identifier(self.connection.configured_database),
schema=sql.identifier(self.connection.configured_schema),
temp_table=sql.identifier(temp_table_name)))

# Drop the tmp table
cur.execute('''
DROP TABLE {temp_table};
Expand Down

0 comments on commit 46266b3

Please sign in to comment.