From dbea7292209193f81cea6c50f25c3a67a024a19d Mon Sep 17 00:00:00 2001 From: sumit-probo <109337392+sumit1094@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:59:28 +0530 Subject: [PATCH 1/2] Update db_sync.py --- target_snowflake/db_sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target_snowflake/db_sync.py b/target_snowflake/db_sync.py index ffac46c5..c4c6eef1 100644 --- a/target_snowflake/db_sync.py +++ b/target_snowflake/db_sync.py @@ -457,7 +457,7 @@ def load_file(self, s3_key, count, size_bytes): # Insert or Update with MERGE command if primary key defined if len(self.stream_schema_message['key_properties']) > 0: try: - inserts, updates = self._load_file_merge( + inserts, updates = self._load_file_copy( s3_key=s3_key, stream=stream, columns_with_trans=columns_with_trans From 7aba1bbadec8ed3a3de84a4825e6bd9107a272f1 Mon Sep 17 00:00:00 2001 From: sumit Date: Mon, 9 Oct 2023 15:32:21 +0530 Subject: [PATCH 2/2] changes in insert mechanism --- target_snowflake/db_sync.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/target_snowflake/db_sync.py b/target_snowflake/db_sync.py index c4c6eef1..82a91150 100644 --- a/target_snowflake/db_sync.py +++ b/target_snowflake/db_sync.py @@ -455,22 +455,7 @@ def load_file(self, s3_key, count, size_bytes): updates = 0 # Insert or Update with MERGE command if primary key defined - if len(self.stream_schema_message['key_properties']) > 0: - try: - inserts, updates = self._load_file_copy( - s3_key=s3_key, - stream=stream, - columns_with_trans=columns_with_trans - ) - except Exception as ex: - self.logger.error( - 'Error while executing MERGE query for table "%s" in stream "%s"', - self.table_name(stream, False), stream - ) - raise ex - - # Insert only with COPY command if no primary key - else: + if len(self.stream_schema_message['key_properties']) >= 0: try: inserts, updates = ( self._load_file_copy(