Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix: Pass model to file download batch export inputs (#61882)

Tomás Farías Santana00b2d9353c60
diff --git a/products/batch_exports/backend/api/file_download.py b/products/batch_exports/backend/api/file_download.py
index 5cf7255dad5b..731f1258b95b 100644
--- a/products/batch_exports/backend/api/file_download.py
+++ b/products/batch_exports/backend/api/file_download.py
@@ -28,7 +28,11 @@ from products.batch_exports.backend.models.batch_export import (
BatchExportOnDemand,
BatchExportRun,
)
-from products.batch_exports.backend.service import cancel_running_batch_export_run, start_file_download_batch_export
+from products.batch_exports.backend.service import (
+ BatchExportModel,
+ cancel_running_batch_export_run,
+ start_file_download_batch_export,
+)
SESSION = boto3.Session()
FILE_DOWNLOAD_MAX_RANGE = dt.timedelta(weeks=1)
@@ -288,6 +292,7 @@ class FileDownloadBatchExportOnDemandViewSet(
batch_export_run_id=instance.id,
data_interval_start=instance.data_interval_start,
data_interval_end=instance.data_interval_end,
+ batch_export_model=BatchExportModel(name=instance.batch_export_on_demand.model, schema=None),
compression=instance.batch_export_on_demand.destination.config.get("compression", None),
format=instance.batch_export_on_demand.destination.config.get("format", "Parquet"),
max_size_mb=instance.batch_export_on_demand.destination.config.get("max_size_mb", 0),
diff --git a/products/batch_exports/backend/service.py b/products/batch_exports/backend/service.py
index 0eddb178e8cc..117e3010b0ad 100644
--- a/products/batch_exports/backend/service.py
+++ b/products/batch_exports/backend/service.py
@@ -932,6 +932,7 @@ def start_file_download_batch_export(
workflow_id: str,
data_interval_start: dt.datetime,
data_interval_end: dt.datetime,
+ batch_export_model: BatchExportModel,
batch_export_run_id: UUID | None = None,
compression: str | None = None,
format: str = "Parquet",
@@ -941,6 +942,7 @@ def start_file_download_batch_export(
) -> None:
inputs = FileDownloadBatchExportInputs(
batch_export_id=batch_export.id,
+ batch_export_model=batch_export_model,
batch_export_run_id=batch_export_run_id,
team_id=batch_export.team_id,
data_interval_start=data_interval_start.isoformat(),