Skip to content

Commit

Permalink
chore(data-warehouse): Commented out data deletion (#22460)
Browse files Browse the repository at this point in the history
Commented out data deletion
  • Loading branch information
Gilbert09 authored and Bianca Yang committed May 24, 2024
1 parent 18d4275 commit 919ced5
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions posthog/warehouse/data_load/validate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
)

from posthog.warehouse.models import (
get_latest_run_if_exists,
get_or_create_datawarehouse_credential,
DataWarehouseTable,
DataWarehouseCredential,
Expand Down Expand Up @@ -115,7 +114,6 @@ async def validate_schema_and_update_table(
logger = await bind_temporal_worker_logger(team_id=team_id)

job: ExternalDataJob = await get_external_data_job(job_id=run_id)
last_successful_job: ExternalDataJob | None = await get_latest_run_if_exists(team_id, job.pipeline_id)

credential: DataWarehouseCredential = await get_or_create_datawarehouse_credential(
team_id=team_id,
Expand Down Expand Up @@ -197,21 +195,27 @@ async def validate_schema_and_update_table(
f"Data Warehouse: No data for schema {_schema_name} for external data job {job.pk}",
exc_info=err,
)
else:
logger.exception(
f"Data Warehouse: Unknown ServerException {job.pk}",
exc_info=err,
)
except Exception as e:
# TODO: handle other exceptions here
logger.exception(
f"Data Warehouse: Could not validate schema for external data job {job.pk}",
exc_info=e,
)

if (
last_successful_job
and _schema_name not in PIPELINE_TYPE_INCREMENTAL_ENDPOINTS_MAPPING[job.pipeline.source_type]
):
try:
last_successful_job.delete_data_in_bucket()
except Exception as e:
logger.exception(
f"Data Warehouse: Could not delete deprecated data source {last_successful_job.pk}",
exc_info=e,
)
# TODO: figure out data deletes - currently borked right now
# if (
# last_successful_job
# and _schema_name not in PIPELINE_TYPE_INCREMENTAL_ENDPOINTS_MAPPING[job.pipeline.source_type]
# ):
# try:
# last_successful_job.delete_data_in_bucket()
# except Exception as e:
# logger.exception(
# f"Data Warehouse: Could not delete deprecated data source {last_successful_job.pk}",
# exc_info=e,
# )

0 comments on commit 919ced5

Please sign in to comment.