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.

test(batch-exports): drop legacy S3 destination from tests and debugger (#104287)

Rosse936bc4e33be
diff --git a/nodejs/src/cdp/_tests/fixtures.ts b/nodejs/src/cdp/_tests/fixtures.ts
index 2d3876221a47..44562410d1f6 100644
--- a/nodejs/src/cdp/_tests/fixtures.ts
+++ b/nodejs/src/cdp/_tests/fixtures.ts
@@ -371,7 +371,7 @@ export const insertBatchExport = async (postgres: PostgresRouter, team_id: Team[
export const insertBatchExportDestination = async (postgres: PostgresRouter): Promise<any> => {
const res = await insertRow(postgres, 'posthog_batchexportdestination', {
id: new UUIDT().toString(),
- type: 'S3',
+ type: 'AwsS3',
config: {},
integration_id: null,
created_at: new Date().toISOString(),
diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.py
index 44f874cc2d3e..30d993588027 100644
--- a/posthog/hogql/database/schema/test/test_system_tables.py
+++ b/posthog/hogql/database/schema/test/test_system_tables.py
@@ -209,7 +209,7 @@ class TestSystemTablesTeamScoping(BaseTest):
def _create_batch_export(team: Team, label: str):
from products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestination
- destination = BatchExportDestination.objects.create(type="S3", config={})
+ destination = BatchExportDestination.objects.create(type="AwsS3", config={})
return BatchExport.objects.create(team=team, name=f"export_{label}", destination=destination, interval="hour")
@@ -230,7 +230,7 @@ def _create_batch_export_backfill(team: Team, label: str):
BatchExportDestination,
)
- destination = BatchExportDestination.objects.create(type="S3", config={})
+ destination = BatchExportDestination.objects.create(type="AwsS3", config={})
batch_export = BatchExport.objects.create(
team=team, name=f"export_for_backfill_{label}", destination=destination, interval="hour"
)
@@ -240,7 +240,7 @@ def _create_batch_export_backfill(team: Team, label: str):
def _create_batch_export_run(team: Team, label: str):
from products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestination, BatchExportRun
- destination = BatchExportDestination.objects.create(type="S3", config={})
+ destination = BatchExportDestination.objects.create(type="AwsS3", config={})
batch_export = BatchExport.objects.create(
team=team, name=f"export_for_run_{label}", destination=destination, interval="hour"
)
@@ -250,7 +250,7 @@ def _create_batch_export_run(team: Team, label: str):
def _create_batch_export_on_demand(team: Team, label: str):
from products.batch_exports.backend.models.batch_export import BatchExportDestination, BatchExportOnDemand
- destination = BatchExportDestination.objects.create(type="S3", config={})
+ destination = BatchExportDestination.objects.create(type="AwsS3", config={})
with team_scope(team.pk):
return BatchExportOnDemand.objects.create(team=team, destination=destination)
diff --git a/posthog/tasks/test/test_email.py b/posthog/tasks/test/test_email.py
index 3dcdf890bc42..76a4bea483f9 100644
--- a/posthog/tasks/test/test_email.py
+++ b/posthog/tasks/test/test_email.py
@@ -616,7 +616,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
mocked_email_messages = mock_email_messages(MockEmailMessage)
_, user = create_org_team_and_user("2022-01-02 00:00:00", "[email protected]")
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
batch_export = BatchExport.objects.create( # type: ignore
team=user.team, name="A batch export", destination=batch_export_destination
@@ -638,7 +638,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
def test_does_not_send_batch_export_run_failure_for_on_demand_export(self, MockEmailMessage: MagicMock) -> None:
mocked_email_messages = mock_email_messages(MockEmailMessage)
destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
with team_scope(team_id=self.team.pk, canonical=True):
on_demand_export = BatchExportOnDemand.objects.create(team=self.team, destination=destination)
@@ -657,7 +657,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
def test_send_batch_export_run_failure_with_settings(self, MockEmailMessage: MagicMock) -> None:
mocked_email_messages = mock_email_messages(MockEmailMessage)
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
batch_export = BatchExport.objects.create( # type: ignore
team=self.user.team, name="A batch export", destination=batch_export_destination
@@ -690,7 +690,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
def test_send_batch_export_run_failure_with_threshold(self, MockEmailMessage: MagicMock) -> None:
mocked_email_messages = mock_email_messages(MockEmailMessage)
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
batch_export = BatchExport.objects.create( # type: ignore
team=self.user.team, name="A batch export", destination=batch_export_destination
@@ -740,7 +740,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
def test_send_batch_export_run_failure_with_threshold_disabled(self, MockEmailMessage: MagicMock) -> None:
mocked_email_messages = mock_email_messages(MockEmailMessage)
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
batch_export = BatchExport.objects.create( # type: ignore
team=self.user.team, name="A batch export", destination=batch_export_destination
@@ -1353,7 +1353,7 @@ class TestEmail(APIBaseTest, ClickhouseTestMixin):
def test_send_batch_export_run_failure_per_pipeline_opt_out(self, MockEmailMessage: MagicMock) -> None:
mocked_email_messages = mock_email_messages(MockEmailMessage)
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_production_s3_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_production_s3_bucket"}
)
batch_export = BatchExport.objects.create( # type: ignore
team=self.user.team, name="A batch export", destination=batch_export_destination
diff --git a/posthog/tasks/test/test_usage_report.py b/posthog/tasks/test/test_usage_report.py
index 64f0fbb30943..174c26b59bbe 100644
--- a/posthog/tasks/test/test_usage_report.py
+++ b/posthog/tasks/test/test_usage_report.py
@@ -2739,7 +2739,7 @@ class TestExternalDataSyncUsageReport(ClickhouseDestroyTablesMixin, TestCase, Cl
self._setup_teams()
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={"bucket_name": "my_production_s3_bucket"},
)
BatchExport.objects.create(
@@ -2783,7 +2783,7 @@ class TestExternalDataSyncUsageReport(ClickhouseDestroyTablesMixin, TestCase, Cl
self._setup_teams()
batch_export_destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={"bucket_name": "test_bucket"},
)
batch_export = BatchExport.objects.create(
diff --git a/products/batch_exports/backend/debug/debugger.py b/products/batch_exports/backend/debug/debugger.py
index 3d595136d9e0..7ba089ba3103 100644
--- a/products/batch_exports/backend/debug/debugger.py
+++ b/products/batch_exports/backend/debug/debugger.py
@@ -104,6 +104,24 @@ class ColumnDebugStatistics:
TableDebugStatistics = dict[str, ColumnDebugStatistics]
+def default_fields_for_destination(destination_type: str) -> list[BatchExportField]:
+ match destination_type:
+ case BatchExportDestination.Destination.AWS_S3 | BatchExportDestination.Destination.S3_COMPATIBLE:
+ return s3_default_fields()
+ case BatchExportDestination.Destination.SNOWFLAKE:
+ return snowflake_default_fields()
+ case BatchExportDestination.Destination.BIGQUERY:
+ return bigquery_default_fields()
+ case BatchExportDestination.Destination.POSTGRES:
+ return postgres_default_fields()
+ case BatchExportDestination.Destination.REDSHIFT:
+ return redshift_default_fields()
+ case BatchExportDestination.Destination.DATABRICKS:
+ return databricks_default_fields()
+ case t:
+ raise ValueError(f"Unsupported destination: {t}")
+
+
class BatchExportsDebugger:
"""Debugger for batch exports.
@@ -461,21 +479,7 @@ class BatchExportsDebugger:
)
parameters["lookback_days"] = lookback_days
- match batch_export_run.parent.destination.type:
- case BatchExportDestination.Destination.S3:
- fields = s3_default_fields()
- case BatchExportDestination.Destination.SNOWFLAKE:
- fields = snowflake_default_fields()
- case BatchExportDestination.Destination.BIGQUERY:
- fields = bigquery_default_fields()
- case BatchExportDestination.Destination.POSTGRES:
- fields = postgres_default_fields()
- case BatchExportDestination.Destination.REDSHIFT:
- fields = redshift_default_fields()
- case BatchExportDestination.Destination.DATABRICKS:
- fields = databricks_default_fields()
- case t:
- raise ValueError(f"Unsupported destination: {t}")
+ fields = default_fields_for_destination(batch_export_run.parent.destination.type)
if "_inserted_at" not in [field["alias"] for field in fields]:
control_fields = [BatchExportField(expression="_inserted_at", alias="_inserted_at")]
diff --git a/products/batch_exports/backend/tests/api/fixtures.py b/products/batch_exports/backend/tests/api/fixtures.py
index fa8a1ab3e7a1..201929183536 100644
--- a/products/batch_exports/backend/tests/api/fixtures.py
+++ b/products/batch_exports/backend/tests/api/fixtures.py
@@ -47,7 +47,7 @@ def create_user(email: str, password: str, organization: Organization):
def create_destination() -> BatchExportDestination:
"""Create a test batch export destination."""
return BatchExportDestination.objects.create(
- type="S3",
+ type="AwsS3",
config={
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
diff --git a/products/batch_exports/backend/tests/api/test_test.py b/products/batch_exports/backend/tests/api/test_test.py
index f85f69f60b87..632b746d2973 100644
--- a/products/batch_exports/backend/tests/api/test_test.py
+++ b/products/batch_exports/backend/tests/api/test_test.py
@@ -211,7 +211,7 @@ def test_run_test_step_rejects_destination_type_change(
malicious_data = {
"name": "my-production-s3-bucket-destination",
"destination": {
- "type": "S3",
+ "type": "S3Compatible",
# Valid configuration for the submitted type, so the type change is what gets rejected.
"config": {"bucket_name": "my-bucket", "region": "us-east-1", "prefix": "events/"},
},
diff --git a/products/batch_exports/backend/tests/management/test_backfill_batch_export_runs.py b/products/batch_exports/backend/tests/management/test_backfill_batch_export_runs.py
index ec0f5c53a906..755ac4468603 100644
--- a/products/batch_exports/backend/tests/management/test_backfill_batch_export_runs.py
+++ b/products/batch_exports/backend/tests/management/test_backfill_batch_export_runs.py
@@ -39,7 +39,7 @@ def team(org):
def create_export(
- team, interval="hour", interval_offset=None, paused=False, destination_type="S3", tz="UTC", model=None
+ team, interval="hour", interval_offset=None, paused=False, destination_type="AwsS3", tz="UTC", model=None
):
destination = BatchExportDestination.objects.create(type=destination_type, config={})
return BatchExport.objects.create(
@@ -86,13 +86,13 @@ class TestGetBatchExports:
assert get_batch_exports(batch_export_id=str(export.id)) == []
def test_filter_by_destination_type(self, team):
- s3_export = create_export(team, destination_type="S3")
+ s3_export = create_export(team, destination_type="AwsS3")
create_export(team, destination_type="Databricks")
results = get_batch_exports()
assert len(results) == 2
- results = get_batch_exports(destination_type="S3")
+ results = get_batch_exports(destination_type="AwsS3")
assert len(results) == 1
assert results[0].id == s3_export.id
diff --git a/products/batch_exports/backend/tests/management/test_check_batch_export_billing_limits.py b/products/batch_exports/backend/tests/management/test_check_batch_export_billing_limits.py
index 7c247e17aeef..2617a16c110e 100644
--- a/products/batch_exports/backend/tests/management/test_check_batch_export_billing_limits.py
+++ b/products/batch_exports/backend/tests/management/test_check_batch_export_billing_limits.py
@@ -29,7 +29,7 @@ def team(organization):
return create_team(organization=organization)
-def _create_batch_export(team, destination_type="S3", paused=False, deleted=False):
+def _create_batch_export(team, destination_type="AwsS3", paused=False, deleted=False):
destination = BatchExportDestination.objects.create(type=destination_type, config={})
return BatchExport.objects.create(
name=f"{destination_type}-export",
@@ -123,7 +123,7 @@ def test_fleet_audit_lists_only_limited_teams_with_active_billable_exports(organ
assert [report["team_id"] for report in reports] == [team_billable.id]
assert reports[0]["over_billing_limit"] is True
- assert reports[0]["active_billable_exports"] == ["S3"]
+ assert reports[0]["active_billable_exports"] == ["AwsS3"]
def test_organization_id_reports_all_teams(organization):
diff --git a/products/batch_exports/backend/tests/management/test_update_batch_export_schedules.py b/products/batch_exports/backend/tests/management/test_update_batch_export_schedules.py
index 689db2c56fb8..d542811fca96 100644
--- a/products/batch_exports/backend/tests/management/test_update_batch_export_schedules.py
+++ b/products/batch_exports/backend/tests/management/test_update_batch_export_schedules.py
@@ -24,13 +24,20 @@ pytestmark = [
]
DUMMY_CONFIG = {
- "S3": {
+ "AwsS3": {
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
"prefix": "posthog-events/",
"aws_access_key_id": "abc123",
"aws_secret_access_key": "secret",
"invalid_key": "invalid_value",
+ "max_file_size_mb": "100",
+ },
+ "S3Compatible": {
+ "bucket_name": "my-production-s3-bucket",
+ "region": "us-east-1",
+ "prefix": "posthog-events/",
+ "invalid_key": "invalid_value",
"use_virtual_style_addressing": "true",
"max_file_size_mb": "100",
},
@@ -149,7 +156,7 @@ def _assert_schedule(
def test_update_batch_export_schedules_for_single_batch_export(team, timezone, paused, temporal):
"""Test the update_batch_export_schedules command updates the schedule for a batch export."""
- batch_export = _create_batch_export(team, "S3", timezone)
+ batch_export = _create_batch_export(team, "AwsS3", timezone)
# Manually update the schedule so we can check that the command updates it
_update_schedule(temporal, batch_export, dt.timedelta(hours=6))
@@ -169,8 +176,8 @@ def test_update_batch_export_schedules_for_all_batch_exports_of_a_given_destinat
"""Test the update_batch_export_schedules command updates the schedule for all batch exports of a given destination type."""
timezone = "UTC"
- batch_export_s3_1 = _create_batch_export(team, "S3", timezone)
- batch_export_s3_2 = _create_batch_export(team, "S3", timezone)
+ batch_export_s3_1 = _create_batch_export(team, "AwsS3", timezone)
+ batch_export_s3_2 = _create_batch_export(team, "AwsS3", timezone)
batch_export_snowflake = _create_batch_export(team, "Snowflake", timezone)
# Manually update the schedule so we can check that the command updates it
@@ -180,7 +187,7 @@ def test_update_batch_export_schedules_for_all_batch_exports_of_a_given_destinat
call_command(
"update_batch_export_schedules",
- f"--destination-type=S3",
+ f"--destination-type=AwsS3",
)
# check that the S3 batch exports were updated
@@ -195,9 +202,9 @@ def test_update_batch_export_schedules_for_all_batch_exports_of_a_given_team(tea
"""Test the update_batch_export_schedules command updates the schedule for all batch exports of a given team."""
timezone = "US/Pacific"
- batch_export_1 = _create_batch_export(team, "S3", timezone)
- batch_export_2 = _create_batch_export(team, "S3", timezone)
- batch_export_team_2 = _create_batch_export(team_2, "S3", timezone)
+ batch_export_1 = _create_batch_export(team, "AwsS3", timezone)
+ batch_export_2 = _create_batch_export(team, "AwsS3", timezone)
+ batch_export_team_2 = _create_batch_export(team_2, "AwsS3", timezone)
# Manually update the schedule so we can check that the command updates it
_update_schedule(temporal, batch_export_1, dt.timedelta(hours=6))
@@ -238,7 +245,7 @@ def test_update_batch_export_schedules_raises_error_if_no_batch_exports_found(te
with pytest.raises(CommandError):
call_command(
"update_batch_export_schedules",
- f"--destination-type=S3",
+ f"--destination-type=AwsS3",
)
# check that the Snowflake batch export was not updated
@@ -277,7 +284,7 @@ def test_sync_batch_export_coerces_postgres_config_types(team, temporal, has_sel
def test_sync_batch_export_coerces_s3_config_types(team, temporal):
"""S3 boolean and int config values stored as strings are coerced."""
- batch_export = _create_batch_export(team, "S3", "UTC")
+ batch_export = _create_batch_export(team, "S3Compatible", "UTC")
workflow_args = _get_workflow_args(temporal, batch_export)
assert workflow_args["use_virtual_style_addressing"] is True
diff --git a/products/batch_exports/backend/tests/temporal/backfills/test_get_backfill_info.py b/products/batch_exports/backend/tests/temporal/backfills/test_get_backfill_info.py
index faf43ff2bd0d..17925e3a7a55 100644
--- a/products/batch_exports/backend/tests/temporal/backfills/test_get_backfill_info.py
+++ b/products/batch_exports/backend/tests/temporal/backfills/test_get_backfill_info.py
@@ -93,7 +93,7 @@ class TestGetBackfillInfoForEvents:
config["include_events"] = include_events
if exclude_events:
config["exclude_events"] = exclude_events
- destination = await BatchExportDestination.objects.acreate(type="S3", config=config)
+ destination = await BatchExportDestination.objects.acreate(type="AwsS3", config=config)
return await BatchExport.objects.acreate(
team_id=ateam.pk,
name="Test Batch Export",
@@ -296,7 +296,7 @@ class TestGetBackfillInfoForPersons:
"aws_access_key_id": "key",
"aws_secret_access_key": "secret",
}
- destination = await BatchExportDestination.objects.acreate(type="S3", config=config)
+ destination = await BatchExportDestination.objects.acreate(type="AwsS3", config=config)
return await BatchExport.objects.acreate(
team_id=ateam.pk,
name="Test Batch Export",
@@ -705,7 +705,7 @@ class TestGetBackfillInfoForSessions:
"aws_access_key_id": "key",
"aws_secret_access_key": "secret",
}
- destination = await BatchExportDestination.objects.acreate(type="S3", config=config)
+ destination = await BatchExportDestination.objects.acreate(type="AwsS3", config=config)
return await BatchExport.objects.acreate(
team_id=ateam.pk,
name="Test Batch Export",
diff --git a/products/batch_exports/backend/tests/temporal/destinations/base_destination_tests.py b/products/batch_exports/backend/tests/temporal/destinations/base_destination_tests.py
index 56173d0dc02c..e6c0faf347d8 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/base_destination_tests.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/base_destination_tests.py
@@ -65,7 +65,7 @@ class BaseDestinationTest(ABC):
@property
@abstractmethod
def destination_type(self) -> str:
- """Return the destination type name (e.g., 'Databricks', 'S3', 'BigQuery')."""
+ """Return the destination type name (e.g., 'Databricks', 'AwsS3', 'BigQuery')."""
pass
@property
diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py
index 4929cfa7dccd..4e3785a118f4 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py
@@ -273,49 +273,6 @@ async def test_s3_export_workflow_with_local_object_storage_without_events(
)
[email protected]("interval", ["hour"], indirect=True)
[email protected]("compression", [None], indirect=True)
[email protected]("exclude_events", [None], indirect=True)
[email protected]("file_format", ["JSONLines"], indirect=True)
[email protected]("model", [BatchExportModel(name="events", schema=None)])
-async def test_s3_export_workflow_with_legacy_s3_destination_type(
- clickhouse_client,
- object_storage_client,
- ateam,
- s3_compatible_batch_export,
- bucket_name,
- interval,
- compression,
- exclude_events,
- file_format,
- s3_key_prefix,
- model,
- data_interval_start,
- data_interval_end,
- generate_test_data,
-):
- """Cover the legacy `S3` dispatch path through the canonical `S3BatchExportInputs`.
-
- Production rows with `type="S3"` continue to dispatch via the canonical input
- dataclass until reclassification runs.
-
- TODO: This test can be removed once we have deprecated the legacy `S3` destination type.
- """
- await run_s3_batch_export_workflow(
- model=model,
- ateam=ateam,
- batch_export_id=str(s3_compatible_batch_export.id),
- integration_id=s3_compatible_batch_export.destination.integration_id,
- s3_destination_config=s3_compatible_batch_export.destination.config,
- interval=interval,
- data_interval_start=data_interval_start,
- data_interval_end=data_interval_end,
- clickhouse_client=clickhouse_client,
- s3_client=object_storage_client,
- destination_type="S3",
- )
-
-
@pytest.mark.parametrize(
"s3_key_prefix",
[
diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py
index 92669b7aaafd..a43dd14ba56e 100644
--- a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py
+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py
@@ -5,7 +5,6 @@ import asyncio
import datetime as dt
import operator
import functools
-import dataclasses
from django.conf import settings
from django.test import override_settings
@@ -28,7 +27,6 @@ from products.batch_exports.backend.service import (
BackfillDetails,
BatchExportModel,
BatchExportSchema,
- S3BatchExportInputs,
S3CompatibleBatchExportInputs,
S3FamilyBaseInputs,
)
@@ -57,8 +55,7 @@ from products.batch_exports.backend.tests.temporal.utils.clickhouse_test_produce
from products.batch_exports.backend.tests.temporal.utils.records import get_record_batch_from_queue
from products.batch_exports.backend.tests.temporal.utils.s3 import assert_file_in_s3, assert_no_files_in_s3
-_INPUTS_BY_DESTINATION_TYPE: dict[str, type[S3BatchExportInputs] | type[S3FamilyBaseInputs]] = {
- "S3": S3BatchExportInputs,
+_INPUTS_BY_DESTINATION_TYPE: dict[str, type[S3FamilyBaseInputs]] = {
"AwsS3": AwsS3BatchExportInputs,
"S3Compatible": S3CompatibleBatchExportInputs,
}
@@ -405,19 +402,17 @@ async def run_s3_batch_export_workflow(
data_interval_end,
clickhouse_client,
s3_client,
+ destination_type: str,
backfill_details: BackfillDetails | None = None,
expect_no_data: bool = False,
- destination_type: str = "S3",
integration_id: int | None = None,
):
"""Run the S3 batch export workflow and assert it completes successfully.
This is a shared helper function used by tests for S3, GCS, and local object storage buckets.
- `destination_type` selects which input dataclass is constructed and passed
- to the workflow — exercising the per-destination → canonical-inputs adaptation
- that happens in production. Defaults to the legacy "S3" type for backwards
- compatibility with any callers that still need it.
+ `destination_type` selects which input dataclass is constructed and passed to the workflow,
+ so the test exercises the same per-destination inputs that production dispatches with.
"""
batch_export_schema: BatchExportSchema | None = None
batch_export_model: BatchExportModel | None = None
@@ -456,7 +451,6 @@ async def run_s3_batch_export_workflow(
integration_id=integration_id,
**s3_destination_config,
)
- workflow_inputs = S3BatchExportInputs(**dataclasses.asdict(per_destination_inputs))
async with await WorkflowEnvironment.start_time_skipping() as activity_environment:
async with Worker(
@@ -471,9 +465,11 @@ async def run_s3_batch_export_workflow(
],
workflow_runner=UnsandboxedWorkflowRunner(),
):
+ # Dispatch by workflow name, the way DESTINATION_WORKFLOWS does, so the worker
+ # widens the per-destination inputs to the superset the workflow declares.
await activity_environment.client.execute_workflow(
- S3BatchExportWorkflow.run,
- workflow_inputs,
+ "s3-export",
+ per_destination_inputs,
id=workflow_id,
task_queue=settings.BATCH_EXPORTS_TASK_QUEUE,
retry_policy=RetryPolicy(maximum_attempts=1),
diff --git a/products/batch_exports/backend/tests/temporal/pipeline/test_internal_stage.py b/products/batch_exports/backend/tests/temporal/pipeline/test_internal_stage.py
index bfd9f84c0ba4..145a04e4332b 100644
--- a/products/batch_exports/backend/tests/temporal/pipeline/test_internal_stage.py
+++ b/products/batch_exports/backend/tests/temporal/pipeline/test_internal_stage.py
@@ -915,7 +915,7 @@ async def test_compute_num_partitions_fetches_estimate_relative_to_interval():
async def _acreate_batch_export_for_test(team_id: int, interval: str = "hour") -> BatchExport:
"""Create a minimal BatchExport via the ORM (no Temporal schedule) for FK-backed run rows."""
destination = await BatchExportDestination.objects.acreate(
- type="S3",
+ type="AwsS3",
config={"bucket_name": "test-bucket", "region": "us-east-1", "prefix": "test"},
)
return await BatchExport.objects.acreate(
diff --git a/products/batch_exports/backend/tests/temporal/test_batch_export_utils.py b/products/batch_exports/backend/tests/temporal/test_batch_export_utils.py
index 432483895ab8..748f2ee767e4 100644
--- a/products/batch_exports/backend/tests/temporal/test_batch_export_utils.py
+++ b/products/batch_exports/backend/tests/temporal/test_batch_export_utils.py
@@ -20,7 +20,7 @@ async def s3_batch_export(
):
"""Provide a batch export for tests, not intended to be used."""
destination_data = {
- "type": "S3",
+ "type": "AwsS3",
"config": {
"bucket_name": "a-bucket",
"region": "us-east-1",
diff --git a/products/batch_exports/backend/tests/temporal/test_billing_limits.py b/products/batch_exports/backend/tests/temporal/test_billing_limits.py
index 2d5823ed64a9..b997580bc9cb 100644
--- a/products/batch_exports/backend/tests/temporal/test_billing_limits.py
+++ b/products/batch_exports/backend/tests/temporal/test_billing_limits.py
@@ -59,7 +59,7 @@ TEST_TIME = dt.datetime(2025, 4, 24, 1, 0, 0, tzinfo=dt.UTC)
@pytest.fixture
def batch_export(team):
- destination = BatchExportDestination.objects.create(type="S3", config={})
+ destination = BatchExportDestination.objects.create(type="AwsS3", config={})
batch_export = BatchExport.objects.create(
name="billing-limit-test-export", team=team, destination=destination, interval="hour"
)
diff --git a/products/batch_exports/backend/tests/temporal/test_internal_events.py b/products/batch_exports/backend/tests/temporal/test_internal_events.py
index f87ac80a84ab..f508fc15b421 100644
--- a/products/batch_exports/backend/tests/temporal/test_internal_events.py
+++ b/products/batch_exports/backend/tests/temporal/test_internal_events.py
@@ -15,7 +15,7 @@ TEAM_ID = 1
BATCH_EXPORT_ID = "d0ec7b0c-6b3d-4a76-8ea4-6a5b2c0e1f5a"
RUN_ID = "b3f5a9d1-2c4e-4f6a-8b7c-9d0e1f2a3b4c"
BATCH_EXPORT_NAME = "test export"
-DESTINATION_TYPE = "S3"
+DESTINATION_TYPE = "AwsS3"
INTERVAL_START = dt.datetime(2023, 4, 24, tzinfo=dt.UTC)
INTERVAL_END = dt.datetime(2023, 4, 25, tzinfo=dt.UTC)
diff --git a/products/batch_exports/backend/tests/temporal/test_monitoring.py b/products/batch_exports/backend/tests/temporal/test_monitoring.py
index b901b70f976e..16be6eb0fec9 100644
--- a/products/batch_exports/backend/tests/temporal/test_monitoring.py
+++ b/products/batch_exports/backend/tests/temporal/test_monitoring.py
@@ -56,7 +56,7 @@ async def truncate(clickhouse_client):
async def batch_export(ateam, temporal_client):
"""Provide a batch export for tests, not intended to be used."""
destination_data = {
- "type": "S3",
+ "type": "AwsS3",
"config": {
"bucket_name": "a-bucket",
"region": "us-east-1",
diff --git a/products/batch_exports/backend/tests/temporal/test_realtime_failure_dispatch.py b/products/batch_exports/backend/tests/temporal/test_realtime_failure_dispatch.py
index e19d3376c60a..7bd93fa3b4b2 100644
--- a/products/batch_exports/backend/tests/temporal/test_realtime_failure_dispatch.py
+++ b/products/batch_exports/backend/tests/temporal/test_realtime_failure_dispatch.py
@@ -13,7 +13,7 @@ class TestDispatchBatchExportFailureRealtime(BaseTest):
@patch("products.batch_exports.backend.temporal.batch_exports.create_notification")
def test_dispatches_for_failed_batch_export_run(self, mock_create_notification: MagicMock) -> None:
destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_bucket"}
)
batch_export = BatchExport.objects.create(team=self.team, name="A batch export", destination=destination)
now = dt.datetime.now()
@@ -39,7 +39,7 @@ class TestDispatchBatchExportFailureRealtime(BaseTest):
)
def test_swallows_per_recipient_exceptions(self, mock_create: MagicMock) -> None:
destination = BatchExportDestination.objects.create(
- type=BatchExportDestination.Destination.S3, config={"bucket_name": "my_bucket"}
+ type=BatchExportDestination.Destination.AWS_S3, config={"bucket_name": "my_bucket"}
)
batch_export = BatchExport.objects.create(team=self.team, name="A batch export", destination=destination)
now = dt.datetime.now()
diff --git a/products/batch_exports/backend/tests/temporal/test_run_updates.py b/products/batch_exports/backend/tests/temporal/test_run_updates.py
index 7dfa5f70d43b..cb29c1f91bae 100644
--- a/products/batch_exports/backend/tests/temporal/test_run_updates.py
+++ b/products/batch_exports/backend/tests/temporal/test_run_updates.py
@@ -54,7 +54,7 @@ def team(organization):
def destination(team):
"""Fixture providing an BatchExportDestination for testing."""
dest = BatchExportDestination.objects.create(
- type="S3",
+ type="AwsS3",
config={
"bucket_name": "bucket",
"region": "us-east-1",
@@ -467,7 +467,7 @@ async def test_finish_batch_export_run_produces_failed_internal_event(activity_e
"batch_export_run_id": str(run_id),
"data_interval_start": start.isoformat(),
"data_interval_end": end.isoformat(),
- "destination_type": "S3",
+ "destination_type": "AwsS3",
"error": "Oh No!",
}
@@ -596,7 +596,7 @@ async def test_start_batch_export_run_produces_failed_billing_internal_event(act
"batch_export_run_id": str(run.id),
"data_interval_start": start.isoformat(),
"data_interval_end": end.isoformat(),
- "destination_type": "S3",
+ "destination_type": "AwsS3",
"error": "Over billing limit",
}
@@ -607,11 +607,11 @@ async def test_start_batch_export_run_produces_failed_billing_internal_event(act
@pytest.mark.parametrize(
"destination_type,model,deleted,billable",
[
- (BatchExportDestination.Destination.S3, BatchExport.Model.EVENTS, False, True),
+ (BatchExportDestination.Destination.AWS_S3, BatchExport.Model.EVENTS, False, True),
(BatchExportDestination.Destination.HTTP, BatchExport.Model.EVENTS, False, False),
(BatchExportDestination.Destination.WORKFLOWS, BatchExport.Model.EVENTS, False, False),
- (BatchExportDestination.Destination.S3, BatchExport.Model.EVENTS, True, False),
- (BatchExportDestination.Destination.S3, BatchExport.Model.HOGQL, False, False),
+ (BatchExportDestination.Destination.AWS_S3, BatchExport.Model.EVENTS, True, False),
+ (BatchExportDestination.Destination.AWS_S3, BatchExport.Model.HOGQL, False, False),
],
)
def test_usage_is_reported_only_for_what_the_nightly_report_bills(
diff --git a/products/batch_exports/backend/tests/temporal/test_workflow_metadata.py b/products/batch_exports/backend/tests/temporal/test_workflow_metadata.py
index dec21a998139..05eaa6047001 100644
--- a/products/batch_exports/backend/tests/temporal/test_workflow_metadata.py
+++ b/products/batch_exports/backend/tests/temporal/test_workflow_metadata.py
@@ -56,19 +56,19 @@ def test_build_logs_link_disabled_when_no_project_configured(settings):
@pytest.mark.parametrize(
"interval,is_backfill,expected",
[
- ("hour", False, "Batch export events every hour to S3"),
- ("day", False, "Batch export events every day to S3"),
- ("every 5 minutes", False, "Batch export events every 5 minutes to S3"),
- ("hour", True, "Backfill batch export events every hour to S3"),
+ ("hour", False, "Batch export events every hour to AwsS3"),
+ ("day", False, "Batch export events every day to AwsS3"),
+ ("every 5 minutes", False, "Batch export events every 5 minutes to AwsS3"),
+ ("hour", True, "Backfill batch export events every hour to AwsS3"),
],
)
def test_build_static_summary(interval, is_backfill, expected):
- assert build_static_summary("S3", "events", interval, is_backfill=is_backfill) == expected
+ assert build_static_summary("AwsS3", "events", interval, is_backfill=is_backfill) == expected
def test_build_static_summary_truncated_to_temporal_byte_limit():
# A long model name would otherwise push the summary past Temporal's 200-byte cap and be rejected.
- summary = build_static_summary("S3", "events_" * 50, "hour")
+ summary = build_static_summary("AwsS3", "events_" * 50, "hour")
assert len(summary.encode("utf-8")) <= STATIC_SUMMARY_MAX_BYTES
assert summary.endswith("…")
diff --git a/products/batch_exports/backend/tests/test_debugger.py b/products/batch_exports/backend/tests/test_debugger.py
index e54c6e5c0508..e4ebd1c2f7c3 100644
--- a/products/batch_exports/backend/tests/test_debugger.py
+++ b/products/batch_exports/backend/tests/test_debugger.py
@@ -17,7 +17,7 @@ pytestmark = [
def test_debugger_loads_batch_exports_for_team(team):
batch_exports = []
destination = BatchExportDestination(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
@@ -50,7 +50,7 @@ def test_debugger_loads_empty_batch_export_for_team(team):
def test_debugger_sets_working_batch_export_with_name(team):
batch_exports = {}
destination = BatchExportDestination(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
@@ -80,7 +80,7 @@ def test_debugger_sets_working_batch_export_with_name(team):
def test_debugger_sets_working_batch_export_with_uuid(team):
batch_exports = {}
destination = BatchExportDestination(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
@@ -110,7 +110,7 @@ def test_debugger_can_load_different_sets_of_batch_exports(team):
batch_exports = []
destination_s3 = BatchExportDestination(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={},
)
destination_bigquery = BatchExportDestination(
@@ -148,11 +148,11 @@ def test_debugger_can_load_different_sets_of_batch_exports(team):
assert bedbg.loaded_batch_exports == loaded
assert all(batch_export.paused is True for batch_export in loaded)
- loaded = bedbg.load_batch_exports(destination="S3", deleted=None)
+ loaded = bedbg.load_batch_exports(destination="AwsS3", deleted=None)
assert len(loaded) == 4
assert bedbg.loaded_batch_exports == loaded
- assert all(batch_export.destination.type == BatchExportDestination.Destination.S3 for batch_export in loaded)
+ assert all(batch_export.destination.type == BatchExportDestination.Destination.AWS_S3 for batch_export in loaded)
loaded = bedbg.load_batch_exports(destination="bigquery", deleted=None)
@@ -160,16 +160,16 @@ def test_debugger_can_load_different_sets_of_batch_exports(team):
assert bedbg.loaded_batch_exports == loaded
assert all(batch_export.destination.type == BatchExportDestination.Destination.BIGQUERY for batch_export in loaded)
- loaded = bedbg.load_batch_exports(name="test-batch-export-S3-False-False")
+ loaded = bedbg.load_batch_exports(name="test-batch-export-AwsS3-False-False")
assert len(loaded) == 1
assert bedbg.loaded_batch_exports == loaded # type: ignore[comparison-overlap]
- assert all(batch_export.name == "test-batch-export-S3-False-False" for batch_export in loaded) # type: ignore[unreachable]
+ assert all(batch_export.name == "test-batch-export-AwsS3-False-False" for batch_export in loaded) # type: ignore[unreachable]
def test_debugger_get_latest_run(team):
destination = BatchExportDestination(
- type=BatchExportDestination.Destination.S3,
+ type=BatchExportDestination.Destination.AWS_S3,
config={
"bucket_name": "my-production-s3-bucket",
"region": "us-east-1",
diff --git a/products/batch_exports/backend/tests/test_facade.py b/products/batch_exports/backend/tests/test_facade.py
index 5c0b793c5037..adcc37dd86bc 100644
--- a/products/batch_exports/backend/tests/test_facade.py
+++ b/products/batch_exports/backend/tests/test_facade.py
@@ -23,7 +23,7 @@ WINDOW_BEGIN = dt.datetime(2026, 1, 1, tzinfo=dt.UTC)
WINDOW_END = WINDOW_BEGIN + dt.timedelta(days=1)
IN_WINDOW = WINDOW_BEGIN + dt.timedelta(hours=1)
-S3 = BatchExportDestination.Destination.S3
+AWS_S3 = BatchExportDestination.Destination.AWS_S3
HTTP = BatchExportDestination.Destination.HTTP
NOOP = BatchExportDestination.Destination.NOOP
WORKFLOWS = BatchExportDestination.Destination.WORKFLOWS
@@ -40,7 +40,7 @@ def team(organization):
return create_team(organization=organization)
-def _create_export(team, *, name="export", destination_type=S3, config=None, **fields):
+def _create_export(team, *, name="export", destination_type=AWS_S3, config=None, **fields):
return testing.create_batch_export(
team.pk,
name=name,
@@ -85,8 +85,8 @@ def test_billable_rows_exported_sums_scheduled_and_on_demand_runs_per_team(team)
[
(HTTP, {}, False),
(WORKFLOWS, {}, False),
- (S3, {"model": BatchExport.Model.HOGQL}, False),
- (S3, {}, True),
+ (AWS_S3, {"model": BatchExport.Model.HOGQL}, False),
+ (AWS_S3, {}, True),
],
ids=["http destination", "workflows destination", "hogql model", "deleted export"],
)
@@ -198,7 +198,7 @@ def test_batch_export_by_name_carries_the_event_filters_and_no_destination_secre
def test_batch_export_by_name_is_none_when_nothing_matches(team):
_create_export(team, name="migration", destination_type=HTTP)
- assert api.get_batch_export_by_name(team.pk, "migration", S3) is None
+ assert api.get_batch_export_by_name(team.pk, "migration", AWS_S3) is None
def test_batch_export_by_name_rejects_an_ambiguous_match(team):
diff --git a/products/batch_exports/backend/tests/test_service.py b/products/batch_exports/backend/tests/test_service.py
index 8e305d685dbf..9a4c51670fe7 100644
--- a/products/batch_exports/backend/tests/test_service.py
+++ b/products/batch_exports/backend/tests/test_service.py
@@ -18,6 +18,7 @@ from products.batch_exports.backend.service import (
RedshiftBatchExportInputs,
RedshiftCopyInputs,
S3BatchExportInputs,
+ S3CompatibleBatchExportInputs,
aget_or_create_batch_export_backfill,
align_timestamp_to_interval,
)
@@ -33,7 +34,7 @@ DESTINATION_INPUTS = {
use_variant_type="true", # type: ignore
use_automatic_schema_evolution="false", # type: ignore
),
- "S3": S3BatchExportInputs(
+ "S3Compatible": S3CompatibleBatchExportInputs(
batch_export_id="test",
team_id=1,
bucket_name="bucket",
@@ -89,7 +90,7 @@ class TestTypeCoercionInBatchExportInputs:
[
("Databricks", "use_variant_type", True),
("Databricks", "use_automatic_schema_evolution", False),
- ("S3", "use_virtual_style_addressing", True),
+ ("S3Compatible", "use_virtual_style_addressing", True),
("Postgres", "has_self_signed_cert", True),
("BigQuery", "use_json_type", True),
],
@@ -102,7 +103,7 @@ class TestTypeCoercionInBatchExportInputs:
[
("Postgres", "port", 5432),
("Redshift", "port", 5439),
- ("S3", "max_file_size_mb", 100),
+ ("S3Compatible", "max_file_size_mb", 100),
("AzureBlob", "max_file_size_mb", 50),
],
)
@@ -138,7 +139,7 @@ class TestTypeCoercionInBatchExportInputs:
@pytest.fixture
async def batch_export(ateam):
destination = await BatchExportDestination.objects.acreate(
- type="S3",
+ type="AwsS3",
config={
"bucket_name": "test",
"region": "us-east-1",
diff --git a/products/batch_exports/frontend/README.md b/products/batch_exports/frontend/README.md
index 2d335a295606..daef9336c93d 100644
--- a/products/batch_exports/frontend/README.md
+++ b/products/batch_exports/frontend/README.md
@@ -89,16 +89,4 @@ If tests fail with `Cannot find module 'react'` from `kea-router`, run `pnpm ins
pnpm storybook
```
-Then navigate to **Scenes-App / BatchExports** in the sidebar. Stories: `NewS3Export`, `NewPostgresExport`, `ExistingBigQueryExport`.
-
-### Playwright E2E tests
-
-```sh
-pnpm --filter=playwright test e2e/batch-exports.spec.ts
-```
-
-Covers creating a new S3 export and validating required fields.
-
-Requires a running backend (`./bin/start`).
-
-You will also need to install Playwright using `pnpm exec playwright install`.
+Then navigate to **Scenes-App / BatchExports** in the sidebar. Stories: `NewAwsS3Export`, `NewS3CompatibleExport`, `NewPostgresExport`, `ExistingBigQueryExport`.