Skip to content

Commit

Permalink
Fix/hgi 4620 (#13)
Browse files Browse the repository at this point in the history
* Fixes table truncate

* Fixes truncate

* Adds self.truncate back

* Resets truncate, assigning it to new variable and doing boolean operation

* Resets the instance_increment variable on every iteration
  • Loading branch information
vmesel authored Nov 22, 2023
1 parent 62d9f09 commit 0ae8964
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions target_bigquery/processhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,8 @@ def _do_temp_table_based_load(self, rows):
instance_truncate = self.truncate or self.table_configs.get(stream, {}).get("truncate", False)
if instance_truncate:
self.logger.info(f"Truncating dataset: {stream}")

self.incremental = self.incremental if not self.truncate else False
if self.incremental:
instance_increment = self.incremental if not instance_truncate else False
if instance_increment:
self.logger.info(f"Copy {tmp_table_name} to {self.tables[stream]} by INCREMENTAL")
self.logger.warning(f"INCREMENTAL replication method (MERGE SQL statement) is not recommended. It might result in loss of production data, because historical records get updated during the sync operation. Instead, we recommend using the APPEND replication method, which will preserve historical data.")
table_id = f"{self.project_id}.{self.dataset.dataset_id}.{self.tables[stream]}"
Expand Down

0 comments on commit 0ae8964

Please sign in to comment.