: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
refactor(schema): Remove standalone batch export schema inputs (#116011)
Tomás Farías Santanaf70b9024f42d
diff --git a/products/batch_exports/backend/service.py b/products/batch_exports/backend/service.pyindex 8a6359238c9d..730d641fd983 100644--- a/products/batch_exports/backend/service.py+++ b/products/batch_exports/backend/service.py@@ -200,7 +200,6 @@ class BaseBatchExportInputs:is_earliest_backfill: bool = Falsebackfill_details: BackfillDetails | None = Nonebatch_export_model: BatchExportModel | None = None- batch_export_schema: BatchExportSchema | None = Noneintegration_id: int | None = Nonedef __post_init__(self):@@ -1202,12 +1201,6 @@ def sync_batch_export(batch_export: BatchExport, created: bool):else None,hogql_modifiers=batch_export.hogql_modifiers,),- # TODO: This field is deprecated, but we still set it for backwards compatibility.- # New exports created will always have `batch_export_schema` set to `None`, but existing- # batch exports may still be using it.- # This assignment should be removed after updating all existing exports to use- # `batch_export_model` instead.- batch_export_schema=None,integration_id=batch_export.destination.integration_id,**destination_config,)@@ -1424,8 +1417,6 @@ class BatchExportInsertInputs:run_id: str | None = Nonebackfill_details: BackfillDetails | None = Nonebatch_export_model: BatchExportModel | None = None- # TODO: Remove after updating existing batch exports- batch_export_schema: BatchExportSchema | None = None# TODO: Remove after updating existing batch exports to use backfill_detailsis_backfill: bool = False# TODO - pass these in to all inherited classes@@ -1468,7 +1459,6 @@ class BatchExportInsertInputs:"run_id": self.run_id,"backfill_details": self.backfill_details,"batch_export_model": self.batch_export_model,- "batch_export_schema": self.batch_export_schema,"batch_export_id": self.batch_export_id,"stage_folder": self.stage_folder,}diff --git a/products/batch_exports/backend/temporal/destinations/azure_blob_batch_export.py b/products/batch_exports/backend/temporal/destinations/azure_blob_batch_export.pyindex 37ae7f90390d..df2cdd6949e0 100644--- a/products/batch_exports/backend/temporal/destinations/azure_blob_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/azure_blob_batch_export.py@@ -436,7 +436,6 @@ class AzureBlobBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=azure_blob_default_fields(),integration_id=inputs.integration_id,diff --git a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.pyindex ba49a96da9c2..914ed64f60df 100644--- a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py@@ -48,7 +48,6 @@ from products.batch_exports.backend.service import (BatchExportField,BatchExportInsertInputs,BatchExportModel,- BatchExportSchema,BigQueryBatchExportInputs,)from products.batch_exports.backend.temporal.batch_exports import (@@ -1369,7 +1368,7 @@ class MergeSettings(typing.NamedTuple):def _get_merge_settings(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,) -> MergeSettings | None:"""Return merge settings for models that require merging."""if isinstance(model, BatchExportModel):@@ -1464,11 +1463,7 @@ async def insert_into_bigquery_activity_from_stage(inputs: BigQueryInsertInputs))async with Heartbeater():- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export_schema is None:- model = inputs.batch_export_model- else:- model = inputs.batch_export_schema+ model = inputs.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_BIGQUERY_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -1744,8 +1739,6 @@ class BigQueryBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- # TODO: Remove after updating existing batch exports.- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=bigquery_default_fields(),integration_id=inputs.integration_id,diff --git a/products/batch_exports/backend/temporal/destinations/databricks_batch_export.py b/products/batch_exports/backend/temporal/destinations/databricks_batch_export.pyindex 10f06c6b747d..fb4f6ae54587 100644--- a/products/batch_exports/backend/temporal/destinations/databricks_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/databricks_batch_export.py@@ -33,7 +33,6 @@ from products.batch_exports.backend.service import (BatchExportField,BatchExportInsertInputs,BatchExportModel,- BatchExportSchema,DatabricksBatchExportInputs,)from products.batch_exports.backend.temporal.batch_exports import (@@ -1036,7 +1035,7 @@ class TableSettings(t.NamedTuple):def _get_databricks_table_settings(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,record_batch_schema: pa.Schema,use_variant_type: bool,) -> TableSettings:@@ -1085,7 +1084,7 @@ def _get_databricks_table_settings(def _get_databricks_merge_config(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,) -> tuple[bool, list[str], list[str]]:requires_merge = Falsemerge_key = []@@ -1301,11 +1300,7 @@ async def insert_into_databricks_activity_from_stage(inputs: DatabricksInsertInp)async with Heartbeater():- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export_schema is None:- model = inputs.batch_export_model- else:- model = inputs.batch_export_schema+ model = inputs.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_DATABRICKS_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -1485,7 +1480,6 @@ class DatabricksBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=databricks_default_fields(),integration_id=inputs.integration_id,diff --git a/products/batch_exports/backend/temporal/destinations/http_batch_export.py b/products/batch_exports/backend/temporal/destinations/http_batch_export.pyindex 5dd77b4d1eba..91cd13efdddc 100644--- a/products/batch_exports/backend/temporal/destinations/http_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/http_batch_export.py@@ -203,9 +203,6 @@ async def insert_into_http_activity(inputs: HttpInsertInputs) -> BatchExportResuif not await client.is_alive():raise ConnectionError("Cannot establish connection to ClickHouse")- if inputs.batch_export_schema is not None:- raise NotImplementedError("Batch export schema is not supported for HTTP export")-if inputs.batch_export_model is not None:if inputs.batch_export_model.name != "events":raise NotImplementedError("HTTP export only supports the events model")@@ -422,7 +419,6 @@ class HttpBatchExportWorkflow(PostHogWorkflow):data_interval_end=data_interval.end.isoformat(),exclude_events=inputs.exclude_events,include_events=inputs.include_events,- batch_export_schema=inputs.batch_export_schema,run_id=run_id,backfill_details=inputs.backfill_details,is_backfill=is_backfill,diff --git a/products/batch_exports/backend/temporal/destinations/postgres_batch_export.py b/products/batch_exports/backend/temporal/destinations/postgres_batch_export.pyindex 767fe8e9b8e0..6848c05f602e 100644--- a/products/batch_exports/backend/temporal/destinations/postgres_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/postgres_batch_export.py@@ -37,7 +37,6 @@ from products.batch_exports.backend.service import (BatchExportField,BatchExportInsertInputs,BatchExportModel,- BatchExportSchema,PostgresBatchExportInputs,)from products.batch_exports.backend.temporal.batch_exports import (@@ -862,11 +861,11 @@ class PostgreSQLConsumer(Consumer):def _get_table_fields(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,record_batch_schema: pa.Schema,) -> Fields:"""Extract table field definitions from model and schema."""- if model is None or (isinstance(model, BatchExportModel) and model.name == "events"):+ if model is None or model.name == "events":table_fields: Fields = [("uuid", "VARCHAR(200)"),("event", "VARCHAR(200)"),@@ -899,7 +898,7 @@ class MergeSettings(typing.NamedTuple):def _get_merge_settings(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,) -> MergeSettings:requires_merge = Falsemerge_key: Fields = []@@ -977,11 +976,7 @@ async def insert_into_postgres_activity_from_stage(inputs: PostgresInsertInputs))async with Heartbeater():- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export_schema is None:- model = inputs.batch_export_model- else:- model = inputs.batch_export_schema+ model = inputs.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_POSTGRES_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -1213,7 +1208,6 @@ class PostgresBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=postgres_default_fields(),integration_id=inputs.integration_id,diff --git a/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py b/products/batch_exports/backend/temporal/destinations/redshift_batch_export.pyindex d8b2eff41b85..79ee68d8ccec 100644--- a/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py@@ -43,7 +43,6 @@ from products.batch_exports.backend.service import (BatchExportField,BatchExportInsertInputs,BatchExportModel,- BatchExportSchema,IAMRole,IntegrationID,RedshiftBatchExportInputs,@@ -811,7 +810,7 @@ class TableSchemas(typing.NamedTuple):def _get_table_schemas(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,record_batch_schema: pa.Schema,properties_data_type: str,) -> TableSchemas:@@ -825,7 +824,7 @@ def _get_table_schemas(properties_type = "VARCHAR(65535)"use_super = False- if model is None or (isinstance(model, BatchExportModel) and model.name == "events"):+ if model is None or model.name == "events":table_schema: Fields = [("uuid", "VARCHAR(200)"),("event", "VARCHAR(200)"),@@ -876,7 +875,7 @@ MergeSettings = RequiredMergeSettings | NotRequiredMergeSettingsdef _get_merge_settings(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,use_super: bool = False,) -> MergeSettings:"""Return merge settings for models that require merging."""@@ -912,7 +911,7 @@ def _get_merge_settings(return RequiredMergeSettings(requires_merge=True, merge_key=merge_key, update_key=update_key, primary_key=primary_key)- elif (model is None or (isinstance(model, BatchExportModel) and model.name == "events")) and use_super is True:+ elif (model is None or model.name == "events") and use_super is True:merge_key = [("uuid", "TEXT")]update_key = [("timestamp", "TIMESTAMP")]primary_key = [("uuid", "TEXT")]@@ -1303,11 +1302,7 @@ async def insert_into_redshift_activity_from_stage(inputs: RedshiftInsertInputs))async with Heartbeater():- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export.batch_export_schema is None:- model = inputs.batch_export.batch_export_model- else:- model = inputs.batch_export.batch_export_schema+ model = inputs.batch_export.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_REDSHIFT_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -1823,11 +1818,7 @@ async def copy_into_redshift_activity_from_stage(inputs: RedshiftCopyActivityInp)async with Heartbeater():- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export.batch_export_schema is None:- model = inputs.batch_export.batch_export_model- else:- model = inputs.batch_export.batch_export_schema+ model = inputs.batch_export.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_S3_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -2124,7 +2115,6 @@ class RedshiftBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=redshift_default_fields(),)diff --git a/products/batch_exports/backend/temporal/destinations/s3_batch_export.py b/products/batch_exports/backend/temporal/destinations/s3_batch_export.pyindex fe81e7dddb5d..bf95de0d8f56 100644--- a/products/batch_exports/backend/temporal/destinations/s3_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/s3_batch_export.py@@ -388,8 +388,6 @@ class S3BatchExportWorkflow(PostHogWorkflow):batch_export_model=inputs.batch_export_model,use_virtual_style_addressing=inputs.use_virtual_style_addressing,legacy_parquet_extension=inputs.legacy_parquet_extension,- # TODO: Remove after updating existing batch exports.- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=s3_default_fields(),)diff --git a/products/batch_exports/backend/temporal/destinations/snowflake_batch_export.py b/products/batch_exports/backend/temporal/destinations/snowflake_batch_export.pyindex 6a8b733248f1..c126a956c863 100644--- a/products/batch_exports/backend/temporal/destinations/snowflake_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/snowflake_batch_export.py@@ -34,7 +34,6 @@ from products.batch_exports.backend.service import (BatchExportField,BatchExportInsertInputs,BatchExportModel,- BatchExportSchema,SnowflakeBatchExportInputs,)from products.batch_exports.backend.temporal.batch_exports import (@@ -1284,7 +1283,7 @@ class MergeSettings(typing.NamedTuple):def _get_merge_settings(- model: BatchExportModel | BatchExportSchema | None,+ model: BatchExportModel | None,) -> MergeSettings | None:if isinstance(model, BatchExportModel):if model.name == "persons":@@ -1416,11 +1415,7 @@ async def insert_into_snowflake_activity_from_stage(integration = await _get_snowflake_integration(inputs.integration_id, inputs.team_id)- model: BatchExportModel | BatchExportSchema | None = None- if inputs.batch_export_schema is None:- model = inputs.batch_export_model- else:- model = inputs.batch_export_schema+ model = inputs.batch_export_modelqueue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_SNOWFLAKE_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)producer = Producer()@@ -1624,7 +1619,6 @@ class SnowflakeBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=snowflake_default_fields(),)diff --git a/products/batch_exports/backend/temporal/destinations/workflows_batch_export.py b/products/batch_exports/backend/temporal/destinations/workflows_batch_export.pyindex 94c114853e8a..3b1ccfd2a9ef 100644--- a/products/batch_exports/backend/temporal/destinations/workflows_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/workflows_batch_export.py@@ -551,7 +551,6 @@ class WorkflowsBatchExportWorkflow(PostHogWorkflow):backfill_details=inputs.backfill_details,is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=workflows_default_fields(inputs.batch_export_id),)diff --git a/products/batch_exports/backend/temporal/pipeline/entrypoint.py b/products/batch_exports/backend/temporal/pipeline/entrypoint.pyindex e4a89f4546e0..9256c0dee391 100644--- a/products/batch_exports/backend/temporal/pipeline/entrypoint.py+++ b/products/batch_exports/backend/temporal/pipeline/entrypoint.py@@ -13,12 +13,7 @@ from posthog.temporal.common.logger import get_write_only_loggerfrom products.batch_exports.backend.facade.enums import BatchExportRunStatusfrom products.batch_exports.backend.models.batch_export import BatchExportRun-from products.batch_exports.backend.service import (- BackfillDetails,- BatchExportField,- BatchExportModel,- BatchExportSchema,-)+from products.batch_exports.backend.service import BackfillDetails, BatchExportField, BatchExportModelfrom products.batch_exports.backend.temporal.batch_exports import FinishBatchExportRunInputs, finish_batch_export_runfrom products.batch_exports.backend.temporal.metrics import get_export_finished_metric, get_export_started_metricfrom products.batch_exports.backend.temporal.pipeline.internal_stage import (@@ -50,7 +45,6 @@ class _BatchExportInputsProtocol(typing.Protocol):run_id: str | None = Nonebackfill_details: BackfillDetails | None = Nonebatch_export_model: BatchExportModel | None = None- batch_export_schema: BatchExportSchema | None = Noneis_backfill: bool = Falsebatch_export_id: str | None = Nonedestination_default_fields: list[BatchExportField] | None = None@@ -209,7 +203,6 @@ async def _stage_batch_export_data(batch_export_model=batch_export_inputs.batch_export_model,is_workflows=is_workflows,on_demand=batch_export_inputs.on_demand,- batch_export_schema=batch_export_inputs.batch_export_schema,destination_default_fields=batch_export_inputs.destination_default_fields,)return await workflow.execute_activity(diff --git a/products/batch_exports/backend/temporal/pipeline/internal_stage.py b/products/batch_exports/backend/temporal/pipeline/internal_stage.pyindex 8c8bfe53db93..0ea4526064a5 100644--- a/products/batch_exports/backend/temporal/pipeline/internal_stage.py+++ b/products/batch_exports/backend/temporal/pipeline/internal_stage.py@@ -51,7 +51,6 @@ from products.batch_exports.backend.service import (BackfillDetails,BatchExportField,BatchExportModel,- BatchExportSchema,afetch_last_run_records_completed,)from products.batch_exports.backend.temporal.batch_exports import default_fields@@ -296,8 +295,6 @@ class BatchExportInsertIntoInternalStageInputs:batch_export_model: BatchExportModel | None = Noneis_workflows: bool = Falseon_demand: bool = False- # TODO: Remove after updating existing batch exports- batch_export_schema: BatchExportSchema | None = Nonedestination_default_fields: list[BatchExportField] | None = None@property@@ -313,7 +310,6 @@ class BatchExportInsertIntoInternalStageInputs:"run_id": self.run_id,"backfill_details": self.backfill_details,"batch_export_model": self.batch_export_model,- "batch_export_schema": self.batch_export_schema,"destination_default_fields": self.destination_default_fields,}@@ -382,7 +378,6 @@ async def insert_into_internal_stage_activity() = await database_sync_to_async(resolve_batch_exports_model)(inputs.team_id,inputs.batch_export_model,- inputs.batch_export_schema,inputs.batch_export_id,is_backfill=inputs.backfill_details is not None,)diff --git a/products/batch_exports/backend/temporal/record_batch_model.py b/products/batch_exports/backend/temporal/record_batch_model.pyindex 5e7093c5f169..929869725673 100644--- a/products/batch_exports/backend/temporal/record_batch_model.py+++ b/products/batch_exports/backend/temporal/record_batch_model.py@@ -34,7 +34,7 @@ from products.batch_exports.backend.hogql_source import (serialize_batch_export_query,validate_hogql_batch_export_user,)-from products.batch_exports.backend.service import BatchExportModel, BatchExportSchema+from products.batch_exports.backend.service import BatchExportModelfrom products.batch_exports.backend.temporal.errors import MissingRequiredInputsErrorfrom products.batch_exports.backend.temporal.metrics import log_query_durationfrom products.batch_exports.backend.temporal.sql.common import (@@ -443,7 +443,6 @@ class HogQLQueryRecordBatchModel(RecordBatchModel):def resolve_batch_exports_model(team_id: int,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,batch_export_id: str | None = None,is_backfill: bool = False,):@@ -453,43 +452,35 @@ def resolve_batch_exports_model(and new parameters. Eventually, once everything is a `RecordBatchModel`, this couldbe removed."""- model: BatchExportModel | BatchExportSchema | None = None+ model = batch_export_modelrecord_batch_model: RecordBatchModel | None = None- if batch_export_schema is None:- model = batch_export_model- if model is not None:- model_name = model.name- extra_query_parameters = model.schema["values"] if model.schema is not None else None- fields = model.schema["fields"] if model.schema is not None else None- filters = model.filters-- if model_name == "sessions":- record_batch_model = SessionsRecordBatchModel(- team_id=team_id, batch_export_id=batch_export_id, is_backfill=is_backfill- )- elif model_name == "hogql":- if model.hogql_query is None:- raise UnsupportedHogQLQueryError("Batch export model is 'hogql' but no HogQL query was provided")- record_batch_model = HogQLQueryRecordBatchModel(- team_id=team_id,- hogql_query=model.hogql_query,- batch_export_id=batch_export_id,- user_id=model.user_id,- hogql_modifiers=model.hogql_modifiers,- )- else:- model_name = "events"- extra_query_parameters = None- fields = None- filters = None+ if model is not None:+ model_name = model.name+ extra_query_parameters = model.schema["values"] if model.schema is not None else None+ fields = model.schema["fields"] if model.schema is not None else None+ filters = model.filters++ if model_name == "sessions":+ record_batch_model = SessionsRecordBatchModel(+ team_id=team_id, batch_export_id=batch_export_id, is_backfill=is_backfill+ )+ elif model_name == "hogql":+ if model.hogql_query is None:+ raise UnsupportedHogQLQueryError("Batch export model is 'hogql' but no HogQL query was provided")+ record_batch_model = HogQLQueryRecordBatchModel(+ team_id=team_id,+ hogql_query=model.hogql_query,+ batch_export_id=batch_export_id,+ user_id=model.user_id,+ hogql_modifiers=model.hogql_modifiers,+ )else:- model = batch_export_schema- model_name = "custom"- extra_query_parameters = model["values"] if model is not None else {}- fields = model["fields"] if model is not None else None+ model_name = "events"+ extra_query_parameters = None+ fields = Nonefilters = None- schema = batch_export_schema or (batch_export_model.schema if batch_export_model is not None else None)+ schema = model.schema if model is not None else Noneif schema is not None and (query := schema.get("hogql_query")) and use_new_events_schema(team_id):context = HogQLContext(team_id=team_id,diff --git a/products/batch_exports/backend/tests/temporal/conftest.py b/products/batch_exports/backend/tests/temporal/conftest.pyindex c005102b9d56..930439a248cc 100644--- a/products/batch_exports/backend/tests/temporal/conftest.py+++ b/products/batch_exports/backend/tests/temporal/conftest.py@@ -229,19 +229,6 @@ def exclude_events(request) -> list[str] | None:return None-def batch_export_schema(request) -> dict | None:- """A parametrizable fixture to configure a batch export schema.-- By decorating a test function with @pytest.mark.parametrize("batch_export_schema", ..., indirect=True)- it's possible to set the batch_export_schema that will be used to create a BatchExport.- """- try:- return request.param- except AttributeError:- return None--@pytest_asyncio.fixtureasync def setup_postgres_test_db(postgres_config):"""Fixture to manage a database for Redshift and Postgres export testing.diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.pyindex 50a2de4107a2..918ab5cb85b1 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py@@ -46,7 +46,6 @@ async def run_activity(run_id=None,backfill_details=None,batch_export_model=inputs.batch_export_model,- batch_export_schema=inputs.batch_export_schema,destination_default_fields=azure_blob_default_fields(),),)@@ -76,12 +75,11 @@ async def test_activity_exports_model_to_azure_blob(model,):"""Test that events, persons, and sessions are exported to Azure Blob Storage."""- batch_export_schema = Nonebatch_export_model = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)batch_export_id = str(uuid.uuid4())@@ -97,7 +95,6 @@ async def test_activity_exports_model_to_azure_blob(integration_id=azure_integration.id,destination_default_fields=azure_blob_default_fields(),batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,)result = await run_activity(activity_environment, inputs)diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.pyindex 4b7046d70efe..478c36f0c3cd 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py@@ -40,8 +40,7 @@ async def test_workflow_exports_model_successfully(model: BatchExportModel | BatchExportSchema | None,):"""Test that the workflow exports events, persons, or sessions to Azure Blob Storage."""- batch_export_model = model if isinstance(model, BatchExportModel) else None- batch_export_schema = model if isinstance(model, dict) else None+ batch_export_model = BatchExportModel(name="events", schema=model) if isinstance(model, dict) else modelrun = await run_azure_blob_batch_export_workflow(team=ateam,@@ -54,7 +53,6 @@ async def test_workflow_exports_model_successfully(file_format=file_format,compression=compression,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,)assert run.status == "Completed"diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.pyindex ed4cbb15c3f0..063cf7883493 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py@@ -135,8 +135,7 @@ async def test_workflow_exports_data_successfully(model: BatchExportModel | BatchExportSchema | None,):"""Test workflow exports events, persons, or sessions to real Azure Storage."""- batch_export_model = model if isinstance(model, BatchExportModel) else None- batch_export_schema = model if isinstance(model, dict) else None+ batch_export_model = BatchExportModel(name="events", schema=model) if isinstance(model, dict) else modelrun = await run_azure_blob_batch_export_workflow(team=ateam,@@ -149,7 +148,6 @@ async def test_workflow_exports_data_successfully(file_format=file_format,compression=compression,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,)assert run.status == "Completed"diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.pyindex e4403f4fd7ef..e6e02750bb9a 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py@@ -140,7 +140,7 @@ def extract_model_configuration(schema["values"] if schema else None,)- return "custom", batch_export_model["fields"], None, batch_export_model["values"]+ return "events", batch_export_model["fields"], None, batch_export_model["values"]async def assert_clickhouse_records_in_azure_blob(@@ -166,7 +166,7 @@ async def assert_clickhouse_records_in_azure_blob()model_name, fields, filters, extra_query_parameters = extract_model_configuration(batch_export_model)- if model_name == "events":+ if model_name == "events" and fields is None:assert all("azure_blob_ingested_timestamp" in record for record in exported_records), ("Export didn't include ingested timestamp when expected")@@ -236,7 +236,7 @@ async def assert_clickhouse_records_in_azure_blob(TEST_AZURE_BLOB_MODELS: list[BatchExportModel | BatchExportSchema | None] = [BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "uuid", "alias": "uuid"},@@ -290,7 +290,6 @@ async def run_azure_blob_batch_export_workflow(file_format: str = "JSONLines",compression: str | None = None,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,legacy_parquet_extension: bool = True,):"""Run the Azure Blob batch export workflow and return the run result."""@@ -307,7 +306,6 @@ async def run_azure_blob_batch_export_workflow(legacy_parquet_extension=legacy_parquet_extension,integration_id=integration_id,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,)async with await WorkflowEnvironment.start_time_skipping() as activity_environment: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.pyindex 0e1afe3dc415..8accca2f7d41 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@@ -103,7 +103,6 @@ class BaseDestinationTest(ABC):interval: str,batch_export: BatchExport,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,backfill_details: BackfillDetails | None = None,**override_config,):@@ -114,7 +113,6 @@ class BaseDestinationTest(ABC):data_interval_end=data_interval_end.isoformat(),interval=interval,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,backfill_details=backfill_details,integration_id=batch_export.destination.integration_id,**{**batch_export.destination.config, **override_config},@@ -230,7 +228,7 @@ async def _get_records_from_clickhouse(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]@@ -378,7 +376,7 @@ class CommonWorkflowTests:# Common test models used across destinationsTEST_MODELS = [BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "uuid", "alias": "uuid"},@@ -503,19 +501,17 @@ class CommonWorkflowTests:f"Unnecessary test case as batch export model '{model.name}' is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)inputs = destination_test.create_batch_export_inputs(team_id=ateam.pk,data_interval_end=data_interval_end,interval=interval,batch_export=batch_export_for_destination,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,)@@ -539,7 +535,7 @@ class CommonWorkflowTests:team_id=ateam.pk,data_interval_start=data_interval_start,data_interval_end=data_interval_end,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,exclude_events=exclude_events,inputs=inputs,integration=integration,diff --git a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_activity.pyindex b4b06479d77f..a523b3ed86bd 100644--- a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_activity.py@@ -65,7 +65,6 @@ async def _run_activity(dataset_id: str,use_json_type: bool = False,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events: list[str] | None = None,include_events: list[str] | None = None,sort_key: str = "event",@@ -85,7 +84,6 @@ async def _run_activity(exclude_events=exclude_events,include_events=include_events,use_json_type=use_json_type,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=str(uuid.uuid4()),integration_id=integration.id if integration is not None else None,@@ -106,7 +104,6 @@ async def _run_activity(run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=bigquery_default_fields(),),)@@ -123,7 +120,7 @@ async def _run_activity(date_ranges=[(data_interval_start, data_interval_end)],exclude_events=exclude_events,include_events=include_events,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,use_json_type=use_json_type,min_ingested_timestamp=min_ingested_timestamp,sort_key=sort_key,@@ -199,12 +196,11 @@ async def test_insert_into_bigquery_activity_inserts_data_into_bigquery_table(if isinstance(model, BatchExportModel) and model.name == "persons" and exclude_events is not None:pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)sort_key = "event"if batch_export_model is not None:@@ -224,7 +220,6 @@ async def test_insert_into_bigquery_activity_inserts_data_into_bigquery_table(data_interval_end=data_interval_end,exclude_events=exclude_events,use_json_type=use_json_type,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,bigquery_config=bigquery_config,sort_key=sort_key,@@ -357,12 +352,11 @@ async def test_insert_into_bigquery_activity_from_stage_inserts_data_into_bigqueif isinstance(model, BatchExportModel) and model.name == "persons" and exclude_events is not None:pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)await _run_activity(activity_environment,@@ -377,7 +371,6 @@ async def test_insert_into_bigquery_activity_from_stage_inserts_data_into_bigqueinclude_events=None,use_json_type=use_json_type,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,bigquery_config=bigquery_config,sort_key="event",)@@ -407,12 +400,11 @@ async def test_insert_into_bigquery_activity_from_stage_inserts_data_into_bigqueif isinstance(model, BatchExportModel) and model.name == "persons":pytest.skip("Unnecessary test case as person batch export requires query permissions")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)with (unittest.mock.patch(@@ -433,7 +425,6 @@ async def test_insert_into_bigquery_activity_from_stage_inserts_data_into_bigqueinclude_events=None,use_json_type=use_json_type,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,bigquery_config=bigquery_config,sort_key="event",)diff --git a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.pyindex fbb6266c46ef..d4b9e91bcb77 100644--- a/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py+++ b/products/batch_exports/backend/tests/temporal/destinations/bigquery/test_workflow.py@@ -113,7 +113,6 @@ async def test_bigquery_export_workflow(if isinstance(model, BatchExportModel) and model.name == "persons" and exclude_events is not None:pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Nonesort_key = "event"@@ -125,7 +124,7 @@ async def test_bigquery_export_workflow(sort_key = "session_id"elif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)workflow_id = str(uuid.uuid4())inputs = BigQueryBatchExportInputs(@@ -133,7 +132,6 @@ async def test_bigquery_export_workflow(batch_export_id=str(bigquery_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,**bigquery_batch_export.destination.config,)@@ -211,12 +209,11 @@ async def test_bigquery_export_workflow_without_events(if isinstance(model, BatchExportModel) and model.name == "persons" and exclude_events is not None:pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)workflow_id = str(uuid.uuid4())inputs = BigQueryBatchExportInputs(@@ -224,7 +221,6 @@ async def test_bigquery_export_workflow_without_events(batch_export_id=str(bigquery_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,**bigquery_batch_export.destination.config,)diff --git a/products/batch_exports/backend/tests/temporal/destinations/bigquery/utils.py b/products/batch_exports/backend/tests/temporal/destinations/bigquery/utils.pyindex ca9a0a9174b1..e82ae52a2df3 100644--- a/products/batch_exports/backend/tests/temporal/destinations/bigquery/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/bigquery/utils.py@@ -29,7 +29,7 @@ TEST_TIME = dt.datetime.now(dt.UTC).replace(hour=0, minute=0, second=0, microsecTEST_MODELS: list[BatchExportModel | BatchExportSchema | None] = [BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "event", "alias": "event"},@@ -135,7 +135,7 @@ async def assert_clickhouse_records_in_bigquery(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]diff --git a/products/batch_exports/backend/tests/temporal/destinations/databricks/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/databricks/test_workflow.pyindex fd0d3a49c2f5..079a135b4053 100644--- a/products/batch_exports/backend/tests/temporal/destinations/databricks/test_workflow.py+++ b/products/batch_exports/backend/tests/temporal/destinations/databricks/test_workflow.py@@ -294,7 +294,6 @@ class TestDatabricksBatchExportWorkflow(CommonWorkflowTests):data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=None,batch_export=batch_export_for_destination,)@@ -450,7 +449,6 @@ class TestDatabricksBatchExportWorkflow(CommonWorkflowTests):data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=None,batch_export=batch_export_for_destination,use_automatic_schema_evolution=use_automatic_schema_evolution,)@@ -525,7 +523,6 @@ class TestDatabricksBatchExportWorkflow(CommonWorkflowTests):data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=None,batch_export=batch_export_for_destination,)@@ -565,7 +562,6 @@ class TestDatabricksBatchExportWorkflow(CommonWorkflowTests):data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=None,batch_export=batch_export_for_destination,)diff --git a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.pyindex f20156f61946..9fcb23a43855 100644--- a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py@@ -59,12 +59,11 @@ async def test_export_to_file_download_bucket_puts_data_into_s3(S3InsertInputs, and delegates to insert_into_s3_from_stage. We verifythe data ends up in the expected S3 location and matches what ClickHouse produces."""- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)batch_export_id = str(uuid.uuid4())run_id = str(uuid.uuid4())@@ -84,7 +83,6 @@ async def test_export_to_file_download_bucket_puts_data_into_s3(run_id=run_id,backfill_details=None,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,destination_default_fields=s3_default_fields(),),)@@ -96,7 +94,6 @@ async def test_export_to_file_download_bucket_puts_data_into_s3(stage_folder=stage_result.stage_folder,records_total=stage_result.records_total,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,batch_export_id=batch_export_id,exclude_events=exclude_events,include_events=None,diff --git a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_activity.pyindex 0e7915289ebd..2483e73455ab 100644--- a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_activity.py@@ -46,7 +46,6 @@ async def _run_activity(data_interval_end,table_name: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events: list[str] | None = None,include_events: list[str] | None = None,sort_key: str = "event",@@ -71,7 +70,6 @@ async def _run_activity(data_interval_end=data_interval_end.isoformat(),exclude_events=exclude_events,include_events=include_events,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=str(uuid.uuid4()),integration_id=integration_id,@@ -92,7 +90,6 @@ async def _run_activity(run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=(postgres_default_fields() if destination_default_fields is None else destination_default_fields),@@ -110,7 +107,7 @@ async def _run_activity(team_id=team.pk,data_interval_start=data_interval_start,data_interval_end=data_interval_end,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,exclude_events=exclude_events,sort_key=sort_key,expected_fields=expected_fields,@@ -184,9 +181,8 @@ async def test_insert_into_postgres_activity_handles_existing_events_table(ateam,) -> None:table_name = "existing_events"- batch_export_model = model if isinstance(model, BatchExportModel) else None- batch_export_schema = model if isinstance(model, dict) else None- custom_schema = batch_export_schema or (batch_export_model.schema if batch_export_model else None)+ batch_export_model = BatchExportModel(name="events", schema=model) if isinstance(model, dict) else model+ custom_schema = batch_export_model.schema if batch_export_model else Noneawait _run_activity(activity_environment=activity_environment,@@ -198,7 +194,6 @@ async def test_insert_into_postgres_activity_handles_existing_events_table(data_interval_end=data_interval_end,table_name=table_name,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,sort_key="person_id" if custom_schema is not None else "event",)@@ -232,7 +227,6 @@ async def test_insert_into_postgres_activity_handles_existing_events_table(data_interval_end=data_interval_end,table_name=table_name,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,expected_fields=(["person_id"]if custom_schema is not None@@ -282,12 +276,11 @@ async def test_insert_into_postgres_activity_inserts_data_into_postgres_table():pytest.skip(f"Unnecessary test case as {model.name} batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)sort_key = "event"if batch_export_model is not None:@@ -307,7 +300,6 @@ async def test_insert_into_postgres_activity_inserts_data_into_postgres_table(data_interval_end=data_interval_end,table_name="test_table",batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,exclude_events=exclude_events,sort_key=sort_key,integration_id=integration.id if integration is not None else None,@@ -587,12 +579,11 @@ async def test_insert_into_postgres_activity_inserts_fails_on_missing_primary_keThis error should only occur if the table is created outside the batch export."""- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)insert_inputs = PostgresInsertInputs(team_id=ateam.pk,@@ -600,7 +591,6 @@ async def test_insert_into_postgres_activity_inserts_fails_on_missing_primary_kedata_interval_start=data_interval_start.isoformat(),data_interval_end=data_interval_end.isoformat(),exclude_events=exclude_events,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=str(uuid.uuid4()),**postgres_config,@@ -621,7 +611,6 @@ async def test_insert_into_postgres_activity_inserts_fails_on_missing_primary_kerun_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=postgres_default_fields(),),)diff --git a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.pyindex 8a7edffc74af..db2a4013417e 100644--- a/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py+++ b/products/batch_exports/backend/tests/temporal/destinations/postgres/test_workflow.py@@ -69,12 +69,11 @@ async def test_postgres_export_workflow():pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)config = postgres_batch_export.destination.config@@ -84,7 +83,6 @@ async def test_postgres_export_workflow(batch_export_id=str(postgres_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,**config,)@@ -262,12 +260,11 @@ async def test_postgres_export_workflow_without_events():pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)workflow_id = str(uuid.uuid4())inputs = PostgresBatchExportInputs(@@ -275,7 +272,6 @@ async def test_postgres_export_workflow_without_events(batch_export_id=str(postgres_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,**postgres_batch_export.destination.config,)diff --git a/products/batch_exports/backend/tests/temporal/destinations/postgres/utils.py b/products/batch_exports/backend/tests/temporal/destinations/postgres/utils.pyindex c7f21ce5f01b..df4e84715e74 100644--- a/products/batch_exports/backend/tests/temporal/destinations/postgres/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/postgres/utils.py@@ -48,19 +48,7 @@ EXPECTED_PERSONS_BATCH_EXPORT_FIELDS = []-TEST_MODELS: list[BatchExportModel | BatchExportSchema | None] = [- BatchExportModel(- name="a-custom-model",- schema={- "fields": [- {"expression": "event", "alias": "event"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_0)s), '')", "alias": "browser"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_1)s), '')", "alias": "os"},- {"expression": "nullIf(properties, '')", "alias": "all_properties"},- ],- "values": {"hogql_val_0": "$browser", "hogql_val_1": "$os"},- },- ),+TEST_MODELS: list[BatchExportModel | None] = [BatchExportModel(name="events", schema=None),BatchExportModel(name="events",@@ -72,15 +60,6 @@ TEST_MODELS: list[BatchExportModel | BatchExportSchema | None] = [),BatchExportModel(name="persons", schema=None),BatchExportModel(name="sessions", schema=None),- {- "fields": [- {"expression": "event", "alias": "event"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_0)s), '')", "alias": "browser"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_1)s), '')", "alias": "os"},- {"expression": "nullIf(properties, '')", "alias": "all_properties"},- ],- "values": {"hogql_val_0": "$browser", "hogql_val_1": "$os"},- },None,]@@ -118,7 +97,7 @@ async def assert_clickhouse_records_in_postgres(schema_name: PostgreSQL schema name.table_name: PostgreSQL table name.team_id: The ID of the team that we are testing events for.- batch_export_schema: Custom schema used in the batch export.+ batch_export_model: Model used in the batch export.expected_fields: The expected fields to be exported."""inserted_records = []@@ -140,7 +119,7 @@ async def assert_clickhouse_records_in_postgres(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]diff --git a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_activity.pyindex bd1fda70dd82..2717520cc00a 100644--- a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_activity.py@@ -46,7 +46,6 @@ async def _run_activity(table_name: str,properties_data_type: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events: list[str] | None = None,include_events: list[str] | None = None,sort_key: str = "event",@@ -65,7 +64,6 @@ async def _run_activity(backfill_details=None,is_backfill=False,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,batch_export_id=str(uuid.uuid4()),destination_default_fields=redshift_default_fields(),)@@ -102,7 +100,6 @@ async def _run_activity(run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export.batch_export_model,- batch_export_schema=insert_inputs.batch_export.batch_export_schema,destination_default_fields=redshift_default_fields(),),)@@ -117,7 +114,7 @@ async def _run_activity(table_name=table_name,team_id=team.pk,date_ranges=[(data_interval_start, data_interval_end)],- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,exclude_events=exclude_events,properties_data_type=properties_data_type,sort_key=sort_key,@@ -192,12 +189,11 @@ async def test_insert_into_redshift_activity_inserts_data_into_redshift_table(person_properties={"utm_medium": "referral", "$initial_os": "Linux"},)- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)table_name = f"test_insert_activity_table__{ateam.pk}"@@ -218,7 +214,6 @@ async def test_insert_into_redshift_activity_inserts_data_into_redshift_table(data_interval_start=data_interval_start,data_interval_end=data_interval_end,exclude_events=exclude_events,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,redshift_config=redshift_config,sort_key=sort_key,@@ -528,7 +523,7 @@ async def test_insert_into_redshift_activity_handles_person_schema_changes(@pytest.mark.parametrize("exclude_events", [None], indirect=True)@pytest.mark.parametrize("properties_data_type", ["super"], indirect=True)[email protected]("model", [TEST_MODELS[1]])[email protected]("model", [BatchExportModel(name="events", schema=None)])@pytest.mark.parametrize("missing_person_id", [False, True])async def test_insert_into_redshift_activity_inserts_data_with_extra_columns(clickhouse_client,diff --git a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_copy_activity.py b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_copy_activity.pyindex 1be96979384e..c72c50d0c645 100644--- a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_copy_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_copy_activity.py@@ -68,7 +68,6 @@ async def _run_activity(credentials: AWSCredentials,properties_data_type: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events: list[str] | None = None,include_events: list[str] | None = None,sort_key: str = "event",@@ -91,7 +90,6 @@ async def _run_activity(backfill_details=None,is_backfill=False,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,batch_export_id=str(uuid.uuid4()),destination_default_fields=redshift_default_fields(),)@@ -138,7 +136,6 @@ async def _run_activity(run_id=None,backfill_details=None,batch_export_model=copy_inputs.batch_export.batch_export_model,- batch_export_schema=copy_inputs.batch_export.batch_export_schema,destination_default_fields=redshift_default_fields(),),)@@ -156,7 +153,7 @@ async def _run_activity(table_name=table_name,team_id=team.pk,date_ranges=[(data_interval_start, data_interval_end)],- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,exclude_events=exclude_events,properties_data_type=properties_data_type,sort_key=sort_key,@@ -214,12 +211,11 @@ async def test_copy_into_redshift_activity_inserts_data_into_redshift_table(person_properties={"utm_medium": "referral", "$initial_os": "Linux"},)- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)table_name = f"test_copy_activity_table__{ateam.pk}"@@ -244,7 +240,6 @@ async def test_copy_into_redshift_activity_inserts_data_into_redshift_table(data_interval_start=data_interval_start,data_interval_end=data_interval_end,exclude_events=exclude_events,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,redshift_config=redshift_config,sort_key=sort_key,@@ -590,7 +585,7 @@ async def test_copy_into_redshift_activity_handles_person_schema_changes(@pytest.mark.parametrize("exclude_events", [None], indirect=True)@pytest.mark.parametrize("properties_data_type", ["super"], indirect=True)[email protected]("model", [TEST_MODELS[1]])[email protected]("model", [BatchExportModel(name="events", schema=None)])async def test_copy_into_redshift_activity_inserts_data_with_extra_columns(clickhouse_client,activity_environment,@@ -668,7 +663,7 @@ async def test_copy_into_redshift_activity_inserts_data_with_extra_columns(@pytest.mark.parametrize("exclude_events", [None], indirect=True)@pytest.mark.parametrize("properties_data_type", ["varchar"], indirect=True)[email protected]("model", [TEST_MODELS[1]])[email protected]("model", [BatchExportModel(name="events", schema=None)])async def test_copy_into_redshift_activity_handles_events_table_missing_columns(clickhouse_client,activity_environment,@@ -747,7 +742,7 @@ async def test_copy_into_redshift_activity_handles_events_table_missing_columns(@pytest.mark.parametrize("exclude_events", [None], indirect=True)@pytest.mark.parametrize("properties_data_type", ["varchar"], indirect=True)[email protected]("model", [TEST_MODELS[1]])[email protected]("model", [BatchExportModel(name="events", schema=None)])async def test_copy_into_redshift_activity_handles_data_over_string_limit(clickhouse_client,activity_environment,diff --git a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_workflow.pyindex 803f08c6d99c..f2d50e751ed4 100644--- a/products/batch_exports/backend/tests/temporal/destinations/redshift/test_workflow.py+++ b/products/batch_exports/backend/tests/temporal/destinations/redshift/test_workflow.py@@ -196,19 +196,17 @@ async def test_redshift_export_workflow(copy_inputs = _build_copy_inputs(mode, aws_credentials, bucket_name, bucket_region, key_prefix)- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)inputs = RedshiftBatchExportInputs(team_id=ateam.pk,batch_export_id=str(redshift_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,mode=mode,copy_inputs=copy_inputs,@@ -326,7 +324,7 @@ async def test_redshift_export_workflow_handles_insert_activity_non_retryable_er@pytest.mark.parametrize("interval", ["hour"], indirect=True)@pytest.mark.parametrize("exclude_events", [None], indirect=True)@pytest.mark.parametrize("mode", ["COPY", "INSERT"], indirect=True)[email protected]("model", [TEST_MODELS[1]])[email protected]("model", [BatchExportModel(name="events", schema=None)])async def test_redshift_export_workflow_handles_undefined_function_error(clickhouse_client,redshift_config,diff --git a/products/batch_exports/backend/tests/temporal/destinations/redshift/utils.py b/products/batch_exports/backend/tests/temporal/destinations/redshift/utils.pyindex fcacb5d672b3..accccd38adf0 100644--- a/products/batch_exports/backend/tests/temporal/destinations/redshift/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/redshift/utils.py@@ -28,29 +28,10 @@ REQUIRED_ENV_VARS = (MISSING_REQUIRED_ENV_VARS = any(env_var not in os.environ for env_var in REQUIRED_ENV_VARS)-TEST_MODELS: list[BatchExportModel | BatchExportSchema | None] = [- BatchExportModel(- name="a-custom-model",- schema={- "fields": [- {"expression": "event", "alias": "event"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_0)s), '')", "alias": "browser"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_1)s), '')", "alias": "os"},- ],- "values": {"hogql_val_0": "$browser", "hogql_val_1": "$os"},- },- ),+TEST_MODELS: list[BatchExportModel | None] = [BatchExportModel(name="events", schema=None),BatchExportModel(name="persons", schema=None),BatchExportModel(name="sessions", schema=None),- {- "fields": [- {"expression": "event", "alias": "event"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_0)s), '')", "alias": "browser"},- {"expression": "nullIf(JSONExtractString(properties, %(hogql_val_1)s), '')", "alias": "os"},- ],- "values": {"hogql_val_0": "$browser", "hogql_val_1": "$os"},- },None,]@@ -93,7 +74,7 @@ async def assert_clickhouse_records_in_redshift(schema_name: Redshift schema name.table_name: Redshift table name.team_id: The ID of the team that we are testing events for.- batch_export_schema: Custom schema used in the batch export.+ batch_export_model: Model used in the batch export.date_ranges: Ranges of records we should expect to have been exported.expected_duplicates_threshold: Threshold of duplicates we should expect relative tonumber of unique events, fail if we exceed it.@@ -163,7 +144,7 @@ async def assert_clickhouse_records_in_redshift(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.pyindex 790453d73598..569834cfad20 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py@@ -108,12 +108,11 @@ async def test_insert_into_s3_activity_puts_data_into_s3(prefix = str(uuid.uuid4())- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)batch_export_id = str(uuid.uuid4())@@ -128,7 +127,6 @@ async def test_insert_into_s3_activity_puts_data_into_s3(compression=compression,exclude_events=exclude_events,file_format=file_format,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=batch_export_id,destination_default_fields=s3_default_fields(),@@ -263,12 +261,11 @@ async def test_insert_into_s3_activity_with_exclude_events(prefix = str(uuid.uuid4())- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)batch_export_id = str(uuid.uuid4())@@ -283,7 +280,6 @@ async def test_insert_into_s3_activity_with_exclude_events(compression=compression,exclude_events=exclude_events,file_format=file_format,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=batch_export_id,destination_default_fields=s3_default_fields(),@@ -388,7 +384,6 @@ async def test_insert_into_s3_activity_puts_splitted_files_into_s3(exclude_events=exclude_events,file_format=file_format,max_file_size_mb=max_file_size_mb,- batch_export_schema=None,batch_export_model=model,batch_export_id=str(uuid.uuid4()),destination_default_fields=s3_default_fields(),@@ -492,7 +487,6 @@ async def test_insert_into_s3_activity_fails_on_invalid_file_format(compression=compression,exclude_events=exclude_events,file_format=file_format,- batch_export_schema=None,batch_export_model=model,batch_export_id=str(uuid.uuid4()),destination_default_fields=s3_default_fields(),@@ -534,7 +528,6 @@ async def test_insert_into_s3_activity_fails_on_invalid_compression(compression=compression,exclude_events=exclude_events,file_format="JSONLines",- batch_export_schema=None,batch_export_model=model,batch_export_id=str(uuid.uuid4()),destination_default_fields=s3_default_fields(),diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.pyindex 82a44235b4f1..ffd61cb1ead4 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py@@ -82,12 +82,11 @@ async def test_insert_into_s3_activity_puts_data_into_gcs(prefix = str(uuid.uuid4())- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)batch_export_id = str(uuid.uuid4())@@ -102,7 +101,6 @@ async def test_insert_into_s3_activity_puts_data_into_gcs(compression=compression,exclude_events=exclude_events,file_format=file_format,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=batch_export_id,destination_default_fields=s3_default_fields(),@@ -214,7 +212,6 @@ async def test_insert_into_s3_activity_puts_splitted_files_into_gcs(exclude_events=exclude_events,file_format=file_format,max_file_size_mb=max_file_size_mb,- batch_export_schema=None,batch_export_model=model,batch_export_id=str(uuid.uuid4()),destination_default_fields=s3_default_fields(),diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_error_handling.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_error_handling.pyindex 7a2e89c95b87..aba224101d62 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_error_handling.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_error_handling.py@@ -247,7 +247,6 @@ async def test_s3_export_workflow_with_request_timeouts(to a `RequestTimeout` on the first run of the batch export. The second run should work normally."""batch_export_model = BatchExportModel(name="events", schema=None)- batch_export_schema = Noneraised = 0@@ -283,7 +282,6 @@ async def test_s3_export_workflow_with_request_timeouts(batch_export_id=str(s3_compatible_batch_export.id),data_interval_end=data_interval_end.isoformat(),batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,interval=interval,integration_id=s3_compatible_batch_export.destination.integration_id,**s3_compatible_batch_export.destination.config,diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.pyindex a796dbc7fec0..f98a35cabfc0 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py@@ -64,7 +64,7 @@ COMPRESSION_OPTIONS = [*COMPRESSION_EXTENSIONS.keys(), None]TEST_S3_MODELS: list[BatchExportModel | BatchExportSchema | None] = [BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "uuid", "alias": "uuid"},@@ -254,7 +254,7 @@ async def assert_clickhouse_records_in_s3(data_interval_end: End of the batch period for exported records.exclude_events: Event names to be excluded from the export.include_events: Event names to be included in the export.- batch_export_schema: Custom schema used in the batch export.+ batch_export_model: Model used in the batch export.compression: Optional compression used in upload.file_format: Optional file format used in upload.backfill_details: Optional backfill details (this affects the query that is run to get the records).@@ -283,7 +283,7 @@ async def assert_clickhouse_records_in_s3(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]@@ -414,12 +414,11 @@ async def run_s3_batch_export_workflow(`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 = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)exclude_events = s3_destination_config.get("exclude_events", None)file_format = s3_destination_config.get("file_format", "JSONLines")@@ -446,7 +445,6 @@ async def run_s3_batch_export_workflow(data_interval_end=data_interval_end.isoformat(),interval=interval,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,backfill_details=backfill_details,integration_id=integration_id,**s3_destination_config,@@ -544,7 +542,6 @@ async def run_activity(activity_environment: ActivityEnvironment, insert_inputs:run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=s3_default_fields(),),)diff --git a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_activity_e2e.py b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_activity_e2e.pyindex 101391c29ad9..6f49ed7f4253 100644--- a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_activity_e2e.py+++ b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_activity_e2e.py@@ -55,7 +55,6 @@ async def _run_activity(data_interval_end,table_name: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events=None,sort_key: str = "event",expected_fields=None,@@ -75,7 +74,6 @@ async def _run_activity(data_interval_start=data_interval_start.isoformat(),data_interval_end=data_interval_end.isoformat(),exclude_events=exclude_events,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,batch_export_id=batch_export_id or str(uuid.uuid4()),**snowflake_activity_inputs,@@ -95,7 +93,6 @@ async def _run_activity(run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=snowflake_default_fields(),),)@@ -112,7 +109,7 @@ async def _run_activity(data_interval_start=data_interval_start,data_interval_end=data_interval_end,exclude_events=exclude_events,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,sort_key=sort_key,expected_fields=expected_fields,expect_duplicates=expect_duplicates,@@ -156,12 +153,11 @@ async def test_insert_into_snowflake_activity_inserts_data_into_snowflake_table(if isinstance(model, BatchExportModel) and model.name != "events" and exclude_events is not None:pytest.skip("Unnecessary test case as batch export model is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)table_name = f"test_insert_activity_table_{ateam.pk}"@@ -184,7 +180,6 @@ async def test_insert_into_snowflake_activity_inserts_data_into_snowflake_table(data_interval_end=data_interval_end,table_name=table_name,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,exclude_events=exclude_events,sort_key=sort_key,min_ingested_timestamp=min_ingested_timestamp,@@ -496,7 +491,6 @@ async def test_insert_into_snowflake_activity_heartbeats(run_id=None,backfill_details=None,batch_export_model=insert_inputs.batch_export_model,- batch_export_schema=insert_inputs.batch_export_schema,destination_default_fields=snowflake_default_fields(),),)diff --git a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.pyindex be5904fea9a5..eb8e24dc6efe 100644--- a/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py+++ b/products/batch_exports/backend/tests/temporal/destinations/snowflake/test_workflow_e2e.py@@ -52,7 +52,6 @@ async def _run_workflow(data_interval_end,interval: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events=None,backfill_details=None,settings_overrides=None,@@ -69,7 +68,6 @@ async def _run_workflow(batch_export_id=str(snowflake_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,batch_export_model=batch_export_model,backfill_details=backfill_details,integration_id=snowflake_batch_export.destination.integration_id,@@ -127,7 +125,7 @@ async def _run_workflow(data_interval_start=data_interval_start,data_interval_end=data_interval_end,exclude_events=exclude_events,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,sort_key=sort_key,min_ingested_timestamp=min_ingested_timestamp,)@@ -157,12 +155,11 @@ async def test_snowflake_export_workflow(if isinstance(model, BatchExportModel) and model.name != "events" and exclude_events is not None:pytest.skip("Unnecessary test case as batch export model is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)min_ingested_timestamp = dt.datetime.now(dt.UTC).replace(tzinfo=None)@@ -175,7 +172,6 @@ async def test_snowflake_export_workflow(data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,exclude_events=exclude_events,min_ingested_timestamp=min_ingested_timestamp,)@@ -205,12 +201,11 @@ async def test_snowflake_export_workflow_with_many_files(if isinstance(model, BatchExportModel) and model.name != "events" and exclude_events is not None:pytest.skip("Unnecessary test case as batch export model is not affected by 'exclude_events'")- batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):batch_export_model = modelelif model is not None:- batch_export_schema = model+ batch_export_model = BatchExportModel(name="events", schema=model)min_ingested_timestamp = dt.datetime.now(dt.UTC).replace(tzinfo=None)@@ -223,7 +218,6 @@ async def test_snowflake_export_workflow_with_many_files(data_interval_end=data_interval_end,interval=interval,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,exclude_events=exclude_events,settings_overrides={"BATCH_EXPORT_SNOWFLAKE_UPLOAD_CHUNK_SIZE_BYTES": 1},min_ingested_timestamp=min_ingested_timestamp,diff --git a/products/batch_exports/backend/tests/temporal/destinations/snowflake/utils.py b/products/batch_exports/backend/tests/temporal/destinations/snowflake/utils.pyindex 5d3a96a94262..64238a69aae2 100644--- a/products/batch_exports/backend/tests/temporal/destinations/snowflake/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/snowflake/utils.py@@ -62,7 +62,7 @@ EXPECTED_PERSONS_BATCH_EXPORT_FIELDS = [TEST_MODELS: list[BatchExportModel | BatchExportSchema | None] = [BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "event", "alias": "event"},@@ -436,7 +436,7 @@ async def assert_clickhouse_records_in_snowflake(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]diff --git a/products/batch_exports/backend/tests/temporal/destinations/test_http_batch_export_workflow.py b/products/batch_exports/backend/tests/temporal/destinations/test_http_batch_export_workflow.pyindex bb811a285177..db6a5c140127 100644--- a/products/batch_exports/backend/tests/temporal/destinations/test_http_batch_export_workflow.py+++ b/products/batch_exports/backend/tests/temporal/destinations/test_http_batch_export_workflow.py@@ -218,7 +218,6 @@ async def test_insert_into_http_activity_inserts_data_into_http_endpoint(data_interval_start=data_interval_start.isoformat(),data_interval_end=data_interval_end.isoformat(),exclude_events=exclude_events,- batch_export_schema=None,backfill_details=BackfillDetails(backfill_id=None,start_at=data_interval_start.isoformat(),@@ -275,7 +274,6 @@ async def test_insert_into_http_activity_preserves_mutation_properties_when_usinteam_id=randint(1, 1000000),data_interval_start=None,data_interval_end=interval_end.isoformat(),- batch_export_schema=None,backfill_details=BackfillDetails(backfill_id=None,start_at=None,@@ -334,7 +332,6 @@ async def test_insert_into_http_activity_exports_mutation_properties_from_legacyteam_id=team_id,data_interval_start=interval_start.isoformat(),data_interval_end=interval_end.isoformat(),- batch_export_schema=None,backfill_details=(BackfillDetails(backfill_id=None, start_at=interval_start.isoformat(), end_at=interval_end.isoformat())if is_backfill@@ -390,7 +387,6 @@ async def test_insert_into_http_activity_throws_on_bad_http_status(data_interval_start=data_interval_start.isoformat(),data_interval_end=data_interval_end.isoformat(),exclude_events=exclude_events,- batch_export_schema=None,backfill_details=BackfillDetails(backfill_id=None,start_at=data_interval_start.isoformat(),@@ -463,7 +459,6 @@ async def test_http_export_workflow(interval,exclude_events,ateam,- batch_export_schema,):"""Test HTTP Export Workflow end-to-end by using a mock server.@@ -505,7 +500,6 @@ async def test_http_export_workflow(batch_export_id=str(http_batch_export.id),data_interval_end=data_interval_end.isoformat(),interval=interval,- batch_export_schema=batch_export_schema,**http_batch_export.destination.config,)@@ -580,7 +574,7 @@ async def test_http_export_workflow(BatchExportModel(name="persons", schema=None),BatchExportModel(name="sessions", schema=None),BatchExportModel(- name="a-custom-model",+ name="events",schema={"fields": [{"expression": "uuid", "alias": "uuid"},@@ -698,7 +692,10 @@ async def test_http_export_workflow_with_model(assert len(runs) == 1run = runs[0]assert run.status == "FailedRetryable"- assert run.latest_error == "NotImplementedError: HTTP export only supports the events model"+ if batch_export_model is not None and batch_export_model.schema is not None:+ assert run.latest_error == "NotImplementedError: HTTP export does not support schemas"+ else:+ assert run.latest_error == "NotImplementedError: HTTP export only supports the events model"assert run.records_completed is Noneelse:runs = await afetch_batch_export_runs(batch_export_id=http_batch_export.id)diff --git a/products/batch_exports/backend/tests/temporal/destinations/workflows/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/workflows/test_activity.pyindex ff8426eb2e5d..ae74089987b0 100644--- a/products/batch_exports/backend/tests/temporal/destinations/workflows/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/workflows/test_activity.py@@ -4,7 +4,7 @@ import urllib.parseimport pytest-from products.batch_exports.backend.service import BatchExportInsertInputs, BatchExportModel, BatchExportSchema+from products.batch_exports.backend.service import BatchExportInsertInputs, BatchExportModelfrom products.batch_exports.backend.temporal.destinations import workflows_batch_exportfrom products.batch_exports.backend.temporal.destinations.workflows_batch_export import (WorkflowsInsertInputs,@@ -46,7 +46,6 @@ async def _run_activity(data_interval_end,sort_key: str,batch_export_model: BatchExportModel | None = None,- batch_export_schema: BatchExportSchema | None = None,exclude_events: list[str] | None = None,include_events: list[str] | None = None,expected_fields=None,@@ -64,7 +63,6 @@ async def _run_activity(backfill_details=None,is_backfill=False,batch_export_model=batch_export_model,- batch_export_schema=batch_export_schema,batch_export_id=batch_export_id,)workflows_inputs = WorkflowsInsertInputs(@@ -87,7 +85,6 @@ async def _run_activity(backfill_details=None,is_workflows=True,batch_export_model=workflows_inputs.batch_export.batch_export_model,- batch_export_schema=workflows_inputs.batch_export.batch_export_schema,destination_default_fields=workflows_default_fields(batch_export_id),),)@@ -99,7 +96,7 @@ async def _run_activity(hog_function_id=hog_function_id,date_ranges=[(data_interval_start, data_interval_end)],team_id=team.pk,- batch_export_model=batch_export_model or batch_export_schema,+ batch_export_model=batch_export_model,exclude_events=exclude_events,sort_key=sort_key,expected_fields=expected_fields,@@ -194,7 +191,6 @@ async def test_insert_into_workflows_activity_from_stage_fails_on_non_retryable_backfill_details=None,is_workflows=True,batch_export_model=workflows_inputs.batch_export.batch_export_model,- batch_export_schema=workflows_inputs.batch_export.batch_export_schema,destination_default_fields=workflows_default_fields(batch_export_id),),)@@ -338,7 +334,6 @@ async def test_insert_into_workflows_activity_from_stage_fails_when_hog_functionbackfill_details=None,is_workflows=True,batch_export_model=workflows_inputs.batch_export.batch_export_model,- batch_export_schema=workflows_inputs.batch_export.batch_export_schema,destination_default_fields=workflows_default_fields(batch_export_id),),)diff --git a/products/batch_exports/backend/tests/temporal/destinations/workflows/utils.py b/products/batch_exports/backend/tests/temporal/destinations/workflows/utils.pyindex 50dfaf9327e2..5a637719e68b 100644--- a/products/batch_exports/backend/tests/temporal/destinations/workflows/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/workflows/utils.py@@ -54,7 +54,7 @@ async def assert_clickhouse_records_were_handled(batch_export_model.schema["values"] if batch_export_model.schema is not None else None)else:- model_name = "custom"+ model_name = "events"fields = batch_export_model["fields"]filters = Noneextra_query_parameters = batch_export_model["values"]diff --git a/products/batch_exports/backend/tests/temporal/pipeline/test_entrypoint.py b/products/batch_exports/backend/tests/temporal/pipeline/test_entrypoint.pyindex 760847f2a64e..2b53a6012d69 100644--- a/products/batch_exports/backend/tests/temporal/pipeline/test_entrypoint.py+++ b/products/batch_exports/backend/tests/temporal/pipeline/test_entrypoint.py@@ -158,7 +158,6 @@ class DummyExportWorkflow(PostHogWorkflow):is_backfill=is_backfill,batch_export_model=inputs.batch_export_model,# TODO: Remove after updating existing batch exports.- batch_export_schema=inputs.batch_export_schema,batch_export_id=inputs.batch_export_id,destination_default_fields=None,exception_to_raise=inputs.exception_to_raise,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.pyindex 145a04e4332b..277ba909f352 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@@ -128,7 +128,6 @@ async def test_insert_into_stage_activity_executes_the_expected_query_for_eventsexclude_events=exclude_events,include_events=include_events,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=BackfillDetails(backfill_id=None,@@ -182,7 +181,6 @@ async def test_insert_into_stage_activity_executes_the_expected_query_for_sessioexclude_events=None,include_events=None,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=None,destination_default_fields=None,@@ -274,7 +272,6 @@ async def _run_activity(exclude_events=exclude_events,include_events=None,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=None,destination_default_fields=None,@@ -1136,7 +1133,6 @@ async def test_insert_into_stage_activity_writes_dynamic_number_of_files(exclude_events=None,include_events=None,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=None,destination_default_fields=None,@@ -1186,7 +1182,6 @@ async def test_insert_into_stage_activity_uses_static_default_without_previous_rexclude_events=None,include_events=None,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=None,destination_default_fields=None,diff --git a/products/batch_exports/backend/tests/temporal/pipeline/test_producer.py b/products/batch_exports/backend/tests/temporal/pipeline/test_producer.pyindex 4478c1a96d15..81e6800e1d81 100644--- a/products/batch_exports/backend/tests/temporal/pipeline/test_producer.py+++ b/products/batch_exports/backend/tests/temporal/pipeline/test_producer.py@@ -343,7 +343,6 @@ async def test_producer_resumes_from_offset_after_mid_file_failure(exclude_events=None,include_events=None,run_id=None,- batch_export_schema=None,batch_export_model=model,backfill_details=None,destination_default_fields=None,diff --git a/products/batch_exports/backend/tests/temporal/test_record_batch_model.py b/products/batch_exports/backend/tests/temporal/test_record_batch_model.pyindex 8e2d9a3cdd9a..9352f0402923 100644--- a/products/batch_exports/backend/tests/temporal/test_record_batch_model.py+++ b/products/batch_exports/backend/tests/temporal/test_record_batch_model.py@@ -702,7 +702,7 @@ async def test_custom_export_recompilation_preserves_column_names(ateam, use_new}with override_settings(CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA=use_new_events_schema):_, _, _, fields, _, values = await database_sync_to_async(resolve_batch_exports_model)(- team_id=ateam.pk, batch_export_schema=schema+ team_id=ateam.pk, batch_export_model=BatchExportModel(name="events", schema=schema))assert fields is not None@@ -770,7 +770,7 @@ async def test_custom_export_backfill_runs_without_legacy_events_tables("values": {"unused_old_parameter": "stale"},}_, _, _, fields, _, values = await database_sync_to_async(resolve_batch_exports_model)(- team_id=ateam.pk, batch_export_schema=schema+ team_id=ateam.pk, batch_export_model=BatchExportModel(name="events", schema=schema))assert fields is not Noneassert "unused_old_parameter" not in values