Skip to content

Commit

Permalink
fix(data-warehouse): Pop the incremental value when changing to/from …
Browse files Browse the repository at this point in the history
…incremental (#27086)
  • Loading branch information
Gilbert09 authored Dec 20, 2024
1 parent 5d7fb8b commit 571e20b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def import_data_activity_sync(inputs: ImportDataActivityInputs):
schema.sync_type_config.get("incremental_field_type"),
)

if schema.is_incremental:
logger.debug(f"Incremental last value being used is: {processed_incremental_last_value}")

source = None
if model.pipeline.source_type == ExternalDataSource.Type.STRIPE:
from posthog.temporal.data_imports.pipelines.stripe import stripe_source
Expand Down
4 changes: 4 additions & 0 deletions posthog/warehouse/api/external_data_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,16 @@ def update(self, instance: ExternalDataSchema, validated_data: dict[str, Any]) -
payload = instance.sync_type_config
payload["incremental_field"] = data.get("incremental_field")
payload["incremental_field_type"] = data.get("incremental_field_type")
payload["incremental_field_last_value"] = None
payload["incremental_field_last_value_v2"] = None

validated_data["sync_type_config"] = payload
else:
payload = instance.sync_type_config
payload.pop("incremental_field", None)
payload.pop("incremental_field_type", None)
payload.pop("incremental_field_last_value", None)
payload.pop("incremental_field_last_value_v2", None)

validated_data["sync_type_config"] = payload

Expand Down

0 comments on commit 571e20b

Please sign in to comment.