: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
feat(api): Support Redshift integrations (#86500)
Tomás Farías Santanae991b08ebbda
diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex fd45261c127d..18d3631345d0 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -701,6 +701,8 @@ SPECTACULAR_SETTINGS = {"LayoutCompactionEnum": ["vertical", "horizontal", "stable"],"DesktopAccessReasonEnum": "products.tasks.backend.facade.contracts.DESKTOP_ACCESS_REASON_SCHEMA_VALUES","PropertyGroupOperator": ["AND", "OR"],+ # `mode` is a generic field name; name the Redshift batch-export mode set explicitly.+ "RedshiftExportModeEnum": ["INSERT", "COPY"],# `severity` is shared by a data quality check, its overview projection, and the severity a# past run was judged at."DataQualityCheckSeverityEnum": ["error", "warn"],diff --git a/products/batch_exports/backend/api/batch_export.py b/products/batch_exports/backend/api/batch_export.pyindex 06bad0821010..461ee25e73cb 100644--- a/products/batch_exports/backend/api/batch_export.py+++ b/products/batch_exports/backend/api/batch_export.py@@ -501,6 +501,114 @@ class SnowflakeDestinationConfigSerializer(serializers.Serializer):)+_AWS_CREDENTIALS_SCHEMA = {+ "type": "object",+ "properties": {+ "aws_access_key_id": {"type": "string"},+ "aws_secret_access_key": {"type": "string"},+ },+ "required": ["aws_access_key_id", "aws_secret_access_key"],+}+++@extend_schema_field(+ {+ "oneOf": [+ {"type": "integer", "description": "ID of an aws-s3-kind Integration."},+ _AWS_CREDENTIALS_SCHEMA,+ ],+ }+)+class RedshiftCopyBucketCredentialsField(serializers.JSONField):+ """Inline AWS credentials or the id of an aws-s3-kind Integration."""++ pass+++@extend_schema_field(+ {+ "oneOf": [+ {"type": "integer", "description": "ID of an aws-s3-kind Integration."},+ {"type": "string", "description": "ARN of an IAM role attached to the Redshift cluster."},+ _AWS_CREDENTIALS_SCHEMA,+ ],+ }+)+class RedshiftCopyAuthorizationField(serializers.JSONField):+ """IAM role ARN, inline AWS credentials, or the id of an aws-s3-kind Integration."""++ pass+++class RedshiftCopyInputsSerializer(serializers.Serializer):+ """S3 staging configuration for a Redshift batch export running in COPY mode."""++ s3_bucket = serializers.CharField(help_text="S3 bucket where files are staged before the Redshift COPY.")+ region_name = serializers.CharField(help_text="AWS region of the staging S3 bucket.")+ s3_key_prefix = serializers.CharField(help_text="Key prefix for staged files in the S3 bucket.")+ authorization = RedshiftCopyAuthorizationField(+ help_text=(+ "Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached "+ "to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration."+ ),+ )+ bucket_credentials = RedshiftCopyBucketCredentialsField(+ help_text=(+ "Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an "+ "aws-s3-kind Integration."+ ),+ )+++class RedshiftDestinationConfigSerializer(serializers.Serializer):+ """Typed configuration for a Redshift batch-export destination.++ Connection credentials may live in a linked Integration (when one is provided) or inline in+ this config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in+ `products/batch_exports/backend/service.py`.+ """++ database = serializers.CharField(help_text="Redshift database name to connect to.")+ host = serializers.CharField(+ required=False,+ help_text=(+ "Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift "+ "integration; plain Redshift integrations store the host themselves."+ ),+ )+ schema = serializers.CharField(+ required=False,+ default="public",+ help_text="Redshift schema name containing the destination table.",+ )+ table_name = serializers.CharField(+ required=False,+ default="events",+ help_text="Redshift table name to write exported rows into.",+ )+ port = serializers.IntegerField(+ required=False,+ default=5439,+ help_text="Port the Redshift server listens on.",+ )+ properties_data_type = serializers.ChoiceField(+ choices=["varchar", "super"],+ required=False,+ default="varchar",+ help_text="Data type used for JSON-like columns such as event properties.",+ )+ mode = serializers.ChoiceField(+ choices=["INSERT", "COPY"],+ required=False,+ default="INSERT",+ help_text="How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.",+ )+ copy_inputs = RedshiftCopyInputsSerializer(+ required=False,+ help_text="S3 staging configuration, required when mode is 'COPY'.",+ )++@extend_schema_field(PolymorphicProxySerializer(component_name="BatchExportDestinationConfig",@@ -512,6 +620,7 @@ class SnowflakeDestinationConfigSerializer(serializers.Serializer):"AwsS3": AwsS3DestinationConfigSerializer,"S3Compatible": S3CompatibleDestinationConfigSerializer,"Snowflake": SnowflakeDestinationConfigSerializer,+ "Redshift": RedshiftDestinationConfigSerializer,},resource_type_field_name="type",)@@ -617,6 +726,20 @@ class SnowflakeDestinationRequestSerializer(serializers.Serializer):config = SnowflakeDestinationConfigSerializer()+class RedshiftDestinationRequestSerializer(serializers.Serializer):+ """Request shape for creating or updating a Redshift batch-export destination."""++ type = serializers.ChoiceField(choices=["Redshift"])+ integration_id = serializers.IntegerField(+ required=False,+ help_text=(+ "ID of an aws-redshift-kind Integration providing connection credentials. Preferred over "+ "inline credentials. Use the integrations-list MCP tool to find one."+ ),+ )+ config = RedshiftDestinationConfigSerializer()++BatchExportDestinationRequest = PolymorphicProxySerializer(component_name="BatchExportDestinationRequest",serializers={@@ -627,6 +750,7 @@ BatchExportDestinationRequest = PolymorphicProxySerializer("AwsS3": AwsS3DestinationRequestSerializer,"S3Compatible": S3CompatibleDestinationRequestSerializer,"Snowflake": SnowflakeDestinationRequestSerializer,+ "Redshift": RedshiftDestinationRequestSerializer,},resource_type_field_name="type",)@@ -637,10 +761,11 @@ class BatchExportDestinationRequestField(serializers.JSONField):"""JSONField annotated with a polymorphic OpenAPI request schema.Only integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3,- S3Compatible, Snowflake) are exposed in the schema. integration_id is required for every one of- those except Snowflake, where inline credentials remain supported for the time being. Existing- Postgres and Snowflake exports created before integrations keep their inline credentials.- Runtime validation remains `BatchExportDestinationSerializer.validate_destination`.+ S3Compatible, Snowflake, Redshift) are exposed in the schema. integration_id is required for+ every one of those except Snowflake and Redshift, where inline credentials remain supported for+ the time being. Existing Postgres, Snowflake and Redshift exports created before integrations+ keep their inline credentials. Runtime validation remains+ `BatchExportDestinationSerializer.validate_destination`."""pass@@ -711,21 +836,36 @@ S3_DESTINATION_TO_INTEGRATION_KIND: dict[str, Integration.IntegrationKind] = {}+def _coerce_integration_id(value: typing.Any) -> int | None:+ """Return the integration id encoded in a Redshift COPY credential value, if any.++ `BatchExportDestination.config` is an `EncryptedJSONField`, which stringifies scalar+ leaves on the decrypt round trip, so an id may arrive as an int or a numeric string.+ """+ if isinstance(value, bool):+ return None+ if isinstance(value, int):+ return value+ if isinstance(value, str) and value.isdigit():+ return int(value)+ return None++class BatchExportDestinationSerializer(serializers.ModelSerializer):"""Serializer for an BatchExportDestination model.The `config` field is polymorphic and typed only for destinations that keepcredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,- AwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a- typed OpenAPI schema. Secret fields are stripped from `config` on read.+ AwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape+ but without a typed OpenAPI schema. Secret fields are stripped from `config` on read."""config = TypedBatchExportDestinationConfigField(help_text=("Destination-specific configuration. Fields depend on `type`. Credentials for ""integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, "- "Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped "- "from responses."+ "Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are "+ "stripped from responses."),)integration = TeamScopedPrimaryKeyRelatedField(@@ -743,7 +883,7 @@ class BatchExportDestinationSerializer(serializers.ModelSerializer):help_text=("ID of a team-scoped Integration providing credentials. Required when creating Databricks, ""AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake "- "(inline credentials remain supported); unused for other types."+ "and Redshift (inline credentials remain supported); unused for other types."),)@@ -785,7 +925,8 @@ class BatchExportDestinationSerializer(serializers.ModelSerializer):# resolve them at run time), so they must be required here only when no Integration is linked.# For the S3 family this is only possible when updating an export that predates integrations:# creating one without an Integration is rejected in `validate_destination`.- # TODO: remove this code once inline credentials are gone for S3 and integrations are enforced for Snowflake+ # TODO: remove this code once inline credentials are gone for S3 and integrations are enforced+ # for Snowflake and Redshiftconditionally_required: set[str] = set()if attrs.get("integration") is None:if export_type in S3_FAMILY_TYPES:@@ -794,6 +935,8 @@ class BatchExportDestinationSerializer(serializers.ModelSerializer):conditionally_required.add("endpoint_url")elif export_type == BatchExportDestination.Destination.SNOWFLAKE:conditionally_required = {"account", "user"}+ elif export_type == BatchExportDestination.Destination.REDSHIFT:+ conditionally_required = {"user", "password", "host"}for destination_field in destination_fields:is_required = (@@ -1455,6 +1598,29 @@ class BatchExportSerializer(serializers.ModelSerializer):)if destination_type == BatchExportDestination.Destination.REDSHIFT:+ integration = destination_attrs.get("integration")++ # Sticky integration: an export that uses one cannot drop back to inline credentials.+ # TODO: remove this guard once integrations are mandatory for Redshift and inline credentials are gone.+ if instance is not None and instance.destination.integration is not None and integration is None:+ raise serializers.ValidationError(+ "Cannot remove the integration from a Redshift batch export that uses one. "+ "Re-send its `integration` to keep it (or a different one to swap)."+ )++ if integration is not None:+ # (Team ownership is already enforced by the team-scoped `integration` field.)+ if integration.kind != Integration.IntegrationKind.AWS_REDSHIFT:+ raise serializers.ValidationError("Integration is not a Redshift integration.")++ # Only plain Redshift integrations store a host; AWS-flavor ones obtain+ # temporary credentials for a cluster endpoint that stays in the export config.+ if "host" not in integration.config and not merged_config.get("host"):+ raise serializers.ValidationError(+ "A 'host' is required when using an AWS Redshift integration: "+ "set it to the cluster or workgroup endpoint."+ )+mode = merged_config.get("mode")if mode == "COPY":@@ -1467,15 +1633,60 @@ class BatchExportSerializer(serializers.ModelSerializer):raise serializers.ValidationError("Missing required input for 'COPY'")credential_keys = {"aws_access_key_id", "aws_secret_access_key"}- if credential_keys - copy_inputs["bucket_credentials"].keys():- raise serializers.ValidationError("Missing required bucket credentials for 'COPY'")+ bucket_credentials = copy_inputs["bucket_credentials"]+ bucket_integration_id = _coerce_integration_id(bucket_credentials)authorization = copy_inputs.get("authorization")- if isinstance(authorization, dict):- if credential_keys - authorization.keys():- raise serializers.ValidationError("Missing required credentials for 'COPY'")- elif isinstance(authorization, str) and not authorization.strip():- raise serializers.ValidationError("Missing required IAM role for 'COPY'")+ authorization_integration_id = _coerce_integration_id(authorization)++ existing_copy_inputs = existing_config.get("copy_inputs") or {}++ for field_name, copy_integration_id in (+ ("bucket_credentials", bucket_integration_id),+ ("authorization", authorization_integration_id),+ ):+ # Sticky like the top-level integration: COPY credentials that reference an+ # integration cannot drop back to inline values.+ # TODO: remove this guard once integrations are mandatory for Redshift and+ # inline credentials are gone.+ if (+ instance is not None+ and copy_integration_id is None+ and _coerce_integration_id(existing_copy_inputs.get(field_name)) is not None+ ):+ raise serializers.ValidationError(+ f"Cannot switch '{field_name}' from an integration to inline credentials. "+ "Send a different integration ID to swap, or omit the field to keep the current one."+ )+ if copy_integration_id is None:+ continue+ # These ids live inside `config` rather than the team-scoped `integration`+ # field, so team ownership must be checked here.+ if not Integration.objects.filter(+ id=copy_integration_id,+ team_id=self.context["team_id"],+ kind=Integration.IntegrationKind.AWS_S3,+ ).exists():+ raise serializers.ValidationError(+ f"'{field_name}' does not reference an AWS S3 integration of this project."+ )++ if bucket_integration_id is None and (+ not isinstance(bucket_credentials, dict) or credential_keys - bucket_credentials.keys()+ ):+ raise serializers.ValidationError("Missing required bucket credentials for 'COPY'")++ if authorization_integration_id is None:+ if isinstance(authorization, dict):+ if credential_keys - authorization.keys():+ raise serializers.ValidationError("Missing required credentials for 'COPY'")+ elif isinstance(authorization, str):+ if not authorization.strip():+ raise serializers.ValidationError("Missing required IAM role for 'COPY'")+ else:+ raise serializers.ValidationError(+ "Authorization for 'COPY' must be an IAM role ARN, AWS credentials, or an integration ID."+ )if destination_type == BatchExportDestination.Destination.WORKFLOWS:team_id = self.context["team_id"]@@ -1499,14 +1710,13 @@ class BatchExportSerializer(serializers.ModelSerializer):BatchExportDestination.Destination.POSTGRES,BatchExportDestination.Destination.REDSHIFT,):- # Integration-backed Postgres exports keep the host in the linked Integration- # rather than in `config`; inline configs (Redshift, legacy Postgres) keep it in- # `config`. Prefer the Integration's host when one is provided so we don't skip+ # PostgreSQL-server integrations (Postgres, plain Redshift) keep the host in the+ # linked Integration; AWS Redshift integrations and inline configs keep it in+ # `config`. Prefer the Integration's host when it has one so we don't skip# SSRF validation (and don't `KeyError` on a `config` that has no `host`).integration = destination_attrs.get("integration")- if integration is not None:- host = integration.config.get("host")- else:+ host = integration.config.get("host") if integration is not None else None+ if host is None:host = merged_config.get("host")if host is not None:@@ -1689,7 +1899,14 @@ def recursive_dict_merge(if not isinstance(value, dict):continue- merged[key] = recursive_dict_merge(old.get(key, None) or {}, new.get(key, None) or {})+ # Recurse only when both sides are dicts: a dict replacing a scalar (e.g. inline+ # credentials replacing an IAM role or an integration id) is an overwrite, not a merge.+ old_value = old.get(key)+ new_value = new.get(key)+ merged[key] = recursive_dict_merge(+ old_value if isinstance(old_value, dict) else {},+ new_value if isinstance(new_value, dict) else {},+ )return mergeddiff --git a/products/batch_exports/backend/service.py b/products/batch_exports/backend/service.pyindex af8043ce48f9..dcbd95fb1700 100644--- a/products/batch_exports/backend/service.py+++ b/products/batch_exports/backend/service.py@@ -612,6 +612,16 @@ def coerce_config_to_declared_types(destination_type: str, config: dict[str, typexcept ValueError:passcoerced[key] = value++ if destination_type == "Redshift" and isinstance(coerced.get("copy_inputs"), dict):+ copy_inputs = {**coerced["copy_inputs"]}+ # Integration ids nested in copy_inputs also read back as digit strings.+ for key in ("authorization", "bucket_credentials"):+ value = copy_inputs.get(key)+ if isinstance(value, str) and value.isdigit():+ copy_inputs[key] = int(value)+ coerced["copy_inputs"] = copy_inputs+return coerceddiff --git a/products/batch_exports/backend/tests/api/test_create_redshift.py b/products/batch_exports/backend/tests/api/test_create_redshift.pyindex 2bca2e211d7e..9a8367a97e8c 100644--- a/products/batch_exports/backend/tests/api/test_create_redshift.py+++ b/products/batch_exports/backend/tests/api/test_create_redshift.py@@ -4,7 +4,10 @@ from django.test.client import Client as HttpClientfrom rest_framework import status-from products.batch_exports.backend.tests.api.operations import create_batch_export+from posthog.models.integration import Integration++from products.batch_exports.backend.tests.api.fixtures import create_organization, create_team, create_user+from products.batch_exports.backend.tests.api.operations import create_batch_export, get_batch_export_okpytestmark = [pytest.mark.django_db,@@ -156,3 +159,213 @@ def test_create_redshift_batch_export_validates_copy_inputs(if expected_status == status.HTTP_400_BAD_REQUEST:assert "Missing required" in response.json()["detail"]++[email protected]("authorization", [["arn:aws:iam::123456789012:role/my-role"], True, 1.5])+def test_create_redshift_batch_export_rejects_invalid_authorization_type(+ client: HttpClient, authorization, temporal, organization, team, user+):+ """Test 'authorization' values that are neither credentials, a role, nor an id are a 400.++ These used to pass validation and crash with a TypeError when the export synced.+ """+ destination_data = {+ "type": "Redshift",+ "config": {+ "user": "user",+ "password": "my-password",+ "database": "my-db",+ "host": "localhost",+ "mode": "COPY",+ "copy_inputs": {+ "s3_bucket": "my-production-s3-bucket",+ "region_name": "us-east-1",+ "s3_key_prefix": "posthog-events/",+ "bucket_credentials": {"aws_access_key_id": "abc123", "aws_secret_access_key": "secret"},+ "authorization": authorization,+ },+ },+ }++ batch_export_data = {+ "name": "my-production-redshift-destination",+ "destination": destination_data,+ "interval": "hour",+ }++ client.force_login(user)+ response = create_batch_export(client, team.pk, batch_export_data)++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()+ assert "Authorization for 'COPY'" in response.json()["detail"]+++def create_aws_redshift_role_integration(team, user) -> Integration:+ return Integration.objects.create(+ team=team,+ kind=Integration.IntegrationKind.AWS_REDSHIFT,+ integration_id="prod-redshift-role",+ config={+ "name": "prod-redshift-role",+ "aws_role_arn": "arn:aws:iam::123456789012:role/posthog-batch-exports",+ "user": "awsuser",+ },+ created_by=user,+ )+++def test_create_redshift_batch_export_with_aws_integration(client: HttpClient, temporal, organization, team, user):+ integration = create_aws_redshift_role_integration(team, user)++ batch_export_data = {+ "name": "my-integration-backed-redshift-destination",+ "interval": "hour",+ "destination": {+ "type": "Redshift",+ # No user/password inline: credentials come from the integration. Only the+ # cluster endpoint stays in the config.+ "config": {"database": "my-db", "host": "8.8.8.8"},+ "integration": integration.pk,+ },+ }++ client.force_login(user)+ response = create_batch_export(client, team.pk, batch_export_data)++ assert response.status_code == status.HTTP_201_CREATED, response.json()+++def test_create_redshift_batch_export_with_plain_integration(client: HttpClient, temporal, organization, team, user):+ integration = Integration.objects.create(+ team=team,+ kind=Integration.IntegrationKind.AWS_REDSHIFT,+ integration_id="prod-redshift-plain",+ config={"host": "8.8.8.8", "port": 5439, "user": "posthog", "ssl_mode": "require"},+ sensitive_config={"password": "very-secret"},+ created_by=user,+ )++ batch_export_data = {+ "name": "my-integration-backed-redshift-destination",+ "interval": "hour",+ "destination": {+ "type": "Redshift",+ # Plain Redshift integrations store the host themselves, so none is needed here.+ "config": {"database": "my-db"},+ "integration": integration.pk,+ },+ }++ client.force_login(user)+ response = create_batch_export(client, team.pk, batch_export_data)++ assert response.status_code == status.HTTP_201_CREATED, response.json()+++ "failure,expected_error",+ [+ ("wrong_kind", "not a Redshift integration"),+ ("aws_integration_without_host", "host"),+ ("no_integration_no_credentials", "missing required field"),+ ],+)+def test_create_redshift_batch_export_validates_integration(+ client: HttpClient, failure, expected_error, temporal, organization, team, user, aws_s3_integration+):+ config: dict = {"database": "my-db"}+ integration_pk = None++ if failure == "wrong_kind":+ integration_pk = aws_s3_integration.pk+ elif failure == "aws_integration_without_host":+ integration_pk = create_aws_redshift_role_integration(team, user).pk++ destination_data: dict = {"type": "Redshift", "config": config}+ if integration_pk is not None:+ destination_data["integration"] = integration_pk++ batch_export_data = {+ "name": "my-integration-backed-redshift-destination",+ "interval": "hour",+ "destination": destination_data,+ }++ client.force_login(user)+ response = create_batch_export(client, team.pk, batch_export_data)++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()+ assert expected_error in response.json()["detail"]+++ "copy_credential_source",+ ["own_integration", "other_team_integration", "wrong_kind_integration", "nonexistent_integration"],+)+def test_create_redshift_batch_export_validates_copy_integration_ids(+ client: HttpClient, copy_credential_source, temporal, organization, team, user, aws_s3_integration+):+ # These ids live inside `config` rather than the team-scoped `integration` field, so+ # tenant scoping is enforced by validation: a foreign or wrong-kind id must 400, not 500.+ expected_status: int+ if copy_credential_source == "own_integration":+ integration_id = aws_s3_integration.pk+ expected_status = status.HTTP_201_CREATED+ elif copy_credential_source == "other_team_integration":+ other_organization = create_organization("Other Org")+ other_team = create_team(other_organization)+ other_user = create_user("[email protected]", "Other User", other_organization)+ other_integration = Integration.objects.create(+ team=other_team,+ kind=Integration.IntegrationKind.AWS_S3,+ integration_id="other-prod-aws",+ config={"name": "other-prod-aws", "aws_account_id": "999999999999"},+ sensitive_config={"aws_access_key_id": "key", "aws_secret_access_key": "secret"},+ created_by=other_user,+ )+ integration_id = other_integration.pk+ expected_status = status.HTTP_400_BAD_REQUEST+ elif copy_credential_source == "wrong_kind_integration":+ integration_id = create_aws_redshift_role_integration(team, user).pk+ expected_status = status.HTTP_400_BAD_REQUEST+ else:+ integration_id = 999999+ expected_status = status.HTTP_400_BAD_REQUEST++ destination_data = {+ "type": "Redshift",+ "config": {+ "user": "user",+ "password": "my-password",+ "database": "my-db",+ "host": "localhost",+ "mode": "COPY",+ "copy_inputs": {+ "s3_bucket": "my-production-s3-bucket",+ "region_name": "us-east-1",+ "s3_key_prefix": "posthog-events/",+ "bucket_credentials": integration_id,+ "authorization": integration_id,+ },+ },+ }++ batch_export_data = {+ "name": "my-production-redshift-destination",+ "destination": destination_data,+ "interval": "hour",+ }++ client.force_login(user)+ response = create_batch_export(client, team.pk, batch_export_data)++ assert response.status_code == expected_status, response.json()++ if expected_status == status.HTTP_400_BAD_REQUEST:+ assert "does not reference an AWS S3 integration" in response.json()["detail"]+ else:+ # EncryptedJSONField stringifies the stored ids; responses must restore them to ints+ # to honor the generated types.+ batch_export = get_batch_export_ok(client, team.pk, response.json()["id"])+ assert batch_export["destination"]["config"]["copy_inputs"]["bucket_credentials"] == integration_id+ assert batch_export["destination"]["config"]["copy_inputs"]["authorization"] == integration_iddiff --git a/products/batch_exports/backend/tests/api/test_update_redshift.py b/products/batch_exports/backend/tests/api/test_update_redshift.pyindex bd6057925017..cbe28a679b65 100644--- a/products/batch_exports/backend/tests/api/test_update_redshift.py+++ b/products/batch_exports/backend/tests/api/test_update_redshift.py@@ -4,6 +4,8 @@ from django.test.client import Client as HttpClientfrom rest_framework import status+from posthog.models.integration import Integration+from products.batch_exports.backend.tests.api.operations import (create_batch_export_ok,get_batch_export_ok,@@ -16,6 +18,29 @@ pytestmark = []+def create_copy_batch_export(client: HttpClient, team, user, copy_inputs: dict) -> dict:+ destination_data = {+ "type": "Redshift",+ "config": {+ "user": "user",+ "password": "my-password",+ "database": "my-db",+ "host": "localhost",+ "schema": "public",+ "table_name": "my_events",+ "mode": "COPY",+ "copy_inputs": copy_inputs,+ },+ }+ batch_export_data = {+ "name": "my-production-redshift-destination",+ "destination": destination_data,+ "interval": "hour",+ }+ client.force_login(user)+ return create_batch_export_ok(client, team.pk, batch_export_data)++def test_can_patch_redshift_batch_export(client: HttpClient, temporal, organization, team, user):"""Test we can patch a Redshift batch export preserving credentials."""destination_data = {@@ -73,3 +98,120 @@ def test_can_patch_redshift_batch_export(client: HttpClient, temporal, organizatbatch_export = get_batch_export_ok(client, team.pk, batch_export["id"])assert batch_export["destination"]["type"] == "Redshift"assert batch_export["destination"]["config"]["copy_inputs"]["s3_bucket"] == "my-new-production-s3-bucket"+++def test_can_patch_redshift_batch_export_switching_authorization_to_credentials(+ client: HttpClient, temporal, organization, team, user+):+ """Test an update can switch 'authorization' from an IAM role to inline credentials.++ The config merge used to raise a TypeError on this transition and return a 500.+ """+ batch_export = create_copy_batch_export(+ client,+ team,+ user,+ {+ "s3_bucket": "my-production-s3-bucket",+ "region_name": "us-east-1",+ "s3_key_prefix": "posthog-events/",+ "bucket_credentials": {"aws_access_key_id": "abc123", "aws_secret_access_key": "secret"},+ "authorization": "arn:aws:iam::123456789012:role/my-role",+ },+ )++ new_batch_export_data = {+ "destination": {+ "type": "Redshift",+ "config": {+ "copy_inputs": {+ "authorization": {"aws_access_key_id": "new-key", "aws_secret_access_key": "new-secret"},+ },+ },+ },+ }++ response = patch_batch_export(client, team.pk, batch_export["id"], new_batch_export_data)+ assert response.status_code == status.HTTP_200_OK, response.json()++ batch_export = get_batch_export_ok(client, team.pk, batch_export["id"])+ assert batch_export["destination"]["config"]["copy_inputs"]["s3_bucket"] == "my-production-s3-bucket"++[email protected]("field_name", ["authorization", "bucket_credentials"])+def test_patching_redshift_batch_export_rejects_switching_copy_integration_to_inline(+ client: HttpClient, temporal, organization, team, user, aws_s3_integration, field_name+):+ """Test COPY credentials backed by an integration cannot switch back to inline values."""+ batch_export = create_copy_batch_export(+ client,+ team,+ user,+ {+ "s3_bucket": "my-production-s3-bucket",+ "region_name": "us-east-1",+ "s3_key_prefix": "posthog-events/",+ "bucket_credentials": aws_s3_integration.pk,+ "authorization": aws_s3_integration.pk,+ },+ )++ new_batch_export_data = {+ "destination": {+ "type": "Redshift",+ "config": {+ "copy_inputs": {+ field_name: {"aws_access_key_id": "abc123", "aws_secret_access_key": "secret"},+ },+ },+ },+ }++ response = patch_batch_export(client, team.pk, batch_export["id"], new_batch_export_data)+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()+ assert f"Cannot switch '{field_name}' from an integration to inline credentials" in response.json()["detail"]+++def test_can_patch_redshift_batch_export_swapping_copy_integration(+ client: HttpClient, temporal, organization, team, user, aws_s3_integration+):+ """Test COPY credentials backed by an integration can swap to a different integration."""+ other_integration = Integration.objects.create(+ team=team,+ kind=Integration.IntegrationKind.AWS_S3,+ integration_id="prod-aws-2",+ config={"name": "prod-aws-2", "aws_account_id": "123456789012"},+ sensitive_config={"aws_access_key_id": "key-2", "aws_secret_access_key": "secret-2"},+ created_by=user,+ )+ batch_export = create_copy_batch_export(+ client,+ team,+ user,+ {+ "s3_bucket": "my-production-s3-bucket",+ "region_name": "us-east-1",+ "s3_key_prefix": "posthog-events/",+ "bucket_credentials": aws_s3_integration.pk,+ "authorization": aws_s3_integration.pk,+ },+ )++ new_batch_export_data = {+ "destination": {+ "type": "Redshift",+ "config": {+ "copy_inputs": {+ "bucket_credentials": other_integration.pk,+ "authorization": other_integration.pk,+ },+ },+ },+ }++ response = patch_batch_export(client, team.pk, batch_export["id"], new_batch_export_data)+ assert response.status_code == status.HTTP_200_OK, response.json()++ batch_export = get_batch_export_ok(client, team.pk, batch_export["id"])+ assert batch_export["destination"]["config"]["copy_inputs"]["bucket_credentials"] == other_integration.pk+ assert batch_export["destination"]["config"]["copy_inputs"]["authorization"] == other_integration.pkdiff --git a/products/batch_exports/frontend/generated/api.schemas.ts b/products/batch_exports/frontend/generated/api.schemas.tsindex 5bc7c1da8da1..6ac21f1ea101 100644--- a/products/batch_exports/frontend/generated/api.schemas.ts+++ b/products/batch_exports/frontend/generated/api.schemas.ts@@ -335,6 +335,105 @@ export interface SnowflakeDestinationConfigApi {type: SnowflakeDestinationConfigApiType}+/**+ * * `varchar` - varchar+ * * `super` - super+ */+export type PropertiesDataTypeEnumApi = (typeof PropertiesDataTypeEnumApi)[keyof typeof PropertiesDataTypeEnumApi]++export const PropertiesDataTypeEnumApi = {+ Varchar: 'varchar',+ Super: 'super',+} as const++/**+ * * `INSERT` - INSERT+ * * `COPY` - COPY+ */+export type RedshiftExportModeEnumApi = (typeof RedshiftExportModeEnumApi)[keyof typeof RedshiftExportModeEnumApi]++export const RedshiftExportModeEnumApi = {+ Insert: 'INSERT',+ Copy: 'COPY',+} as const++/**+ * Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.+ */+export type RedshiftCopyInputsApiAuthorization =+ | number+ | string+ | {+ aws_access_key_id: string+ aws_secret_access_key: string+ }++/**+ * Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.+ */+export type RedshiftCopyInputsApiBucketCredentials =+ | number+ | {+ aws_access_key_id: string+ aws_secret_access_key: string+ }++/**+ * S3 staging configuration for a Redshift batch export running in COPY mode.+ */+export interface RedshiftCopyInputsApi {+ /** S3 bucket where files are staged before the Redshift COPY. */+ s3_bucket: string+ /** AWS region of the staging S3 bucket. */+ region_name: string+ /** Key prefix for staged files in the S3 bucket. */+ s3_key_prefix: string+ /** Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration. */+ authorization: RedshiftCopyInputsApiAuthorization+ /** Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration. */+ bucket_credentials: RedshiftCopyInputsApiBucketCredentials+}++export type RedshiftDestinationConfigApiType =+ (typeof RedshiftDestinationConfigApiType)[keyof typeof RedshiftDestinationConfigApiType]++export const RedshiftDestinationConfigApiType = {+ Redshift: 'Redshift',+} as const++/**+ * Typed configuration for a Redshift batch-export destination.+ *+ * Connection credentials may live in a linked Integration (when one is provided) or inline in+ * this config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in+ * `products/batch_exports/backend/service.py`.+ */+export interface RedshiftDestinationConfigApi {+ /** Redshift database name to connect to. */+ database: string+ /** Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves. */+ host?: string+ /** Redshift schema name containing the destination table. */+ schema?: string+ /** Redshift table name to write exported rows into. */+ table_name?: string+ /** Port the Redshift server listens on. */+ port?: number+ /** Data type used for JSON-like columns such as event properties.+ *+ * * `varchar` - varchar+ * * `super` - super */+ properties_data_type?: PropertiesDataTypeEnumApi+ /** How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.+ *+ * * `INSERT` - INSERT+ * * `COPY` - COPY */+ mode?: RedshiftExportModeEnumApi+ /** S3 staging configuration, required when mode is 'COPY'. */+ copy_inputs?: RedshiftCopyInputsApi+ type: RedshiftDestinationConfigApiType+}+export type BatchExportDestinationConfigApi =| DatabricksDestinationConfigApi| AzureBlobDestinationConfigApi@@ -343,14 +442,15 @@ export type BatchExportDestinationConfigApi =| AwsS3DestinationConfigApi| S3CompatibleDestinationConfigApi| SnowflakeDestinationConfigApi+ | RedshiftDestinationConfigApi/*** Serializer for an BatchExportDestination model.** The `config` field is polymorphic and typed only for destinations that keep* credentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,- * AwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a- * typed OpenAPI schema. Secret fields are stripped from `config` on read.+ * AwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape+ * but without a typed OpenAPI schema. Secret fields are stripped from `config` on read.*/export interface BatchExportDestinationApi {/** A choice of supported BatchExportDestination types.@@ -369,7 +469,7 @@ export interface BatchExportDestinationApi {* * `NoOp` - Noop* * `FileDownload` - File Download */type: BatchExportDestinationTypeEnumApi- /** Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses. */+ /** Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses. */config: BatchExportDestinationConfigApi/*** The integration for this destination.@@ -377,7 +477,7 @@ export interface BatchExportDestinationApi {*/integration?: number | null/**- * ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.+ * ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.* @nullable*/integration_id?: number | null@@ -1313,6 +1413,23 @@ export interface SnowflakeDestinationRequestApi {config: SnowflakeDestinationConfigApi}+export type RedshiftDestinationRequestApiType =+ (typeof RedshiftDestinationRequestApiType)[keyof typeof RedshiftDestinationRequestApiType]++export const RedshiftDestinationRequestApiType = {+ Redshift: 'Redshift',+} as const++/**+ * Request shape for creating or updating a Redshift batch-export destination.+ */+export interface RedshiftDestinationRequestApi {+ type: RedshiftDestinationRequestApiType+ /** ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one. */+ integration_id?: number+ config: RedshiftDestinationConfigApi+}+export type BatchExportDestinationRequestApi =| DatabricksDestinationRequestApi| AzureBlobDestinationRequestApi@@ -1321,6 +1438,7 @@ export type BatchExportDestinationRequestApi =| AwsS3DestinationRequestApi| S3CompatibleDestinationRequestApi| SnowflakeDestinationRequestApi+ | RedshiftDestinationRequestApi/*** Request body for create/partial_update on BatchExportViewSet.@@ -1914,6 +2032,16 @@ export const SnowflakeDestinationRequestTypeEnumApi = {Snowflake: 'Snowflake',} as const+/**+ * * `Redshift` - Redshift+ */+export type RedshiftDestinationRequestTypeEnumApi =+ (typeof RedshiftDestinationRequestTypeEnumApi)[keyof typeof RedshiftDestinationRequestTypeEnumApi]++export const RedshiftDestinationRequestTypeEnumApi = {+ Redshift: 'Redshift',+} as const+export type BatchExportsListParams = {/*** Number of results to return per page.diff --git a/products/batch_exports/frontend/generated/api.zod.ts b/products/batch_exports/frontend/generated/api.zod.tsindex e0dc99526f5b..38279c40378a 100644--- a/products/batch_exports/frontend/generated/api.zod.ts+++ b/products/batch_exports/frontend/generated/api.zod.ts@@ -22,6 +22,11 @@ export const batchExportsCreateBodyDestinationOneFiveConfigFileFormatDefault = `export const batchExportsCreateBodyDestinationOneSixConfigFileFormatDefault = `JSONLines`export const batchExportsCreateBodyDestinationOneSixConfigUseVirtualStyleAddressingDefault = falseexport const batchExportsCreateBodyDestinationOneSevenConfigTableNameDefault = `events`+export const batchExportsCreateBodyDestinationOneEightConfigSchemaDefault = `public`+export const batchExportsCreateBodyDestinationOneEightConfigTableNameDefault = `events`+export const batchExportsCreateBodyDestinationOneEightConfigPortDefault = 5439+export const batchExportsCreateBodyDestinationOneEightConfigPropertiesDataTypeDefault = `varchar`+export const batchExportsCreateBodyDestinationOneEightConfigModeDefault = `INSERT`export const batchExportsCreateBodyOffsetDayMin = 0export const batchExportsCreateBodyOffsetDayMax = 6@@ -320,6 +325,97 @@ export const BatchExportsCreateBody = /* @__PURE__ */ zod),}).describe('Request shape for creating or updating a Snowflake batch-export destination.'),+ zod+ .object({+ type: zod.enum(['Redshift']),+ integration_id: zod+ .number()+ .optional()+ .describe(+ 'ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.'+ ),+ config: zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsCreateBodyDestinationOneEightConfigSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsCreateBodyDestinationOneEightConfigTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsCreateBodyDestinationOneEightConfigPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(batchExportsCreateBodyDestinationOneEightConfigPropertiesDataTypeDefault)+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsCreateBodyDestinationOneEightConfigModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),+ })+ .describe('Request shape for creating or updating a Redshift batch-export destination.'),]).describe('Destination configuration. Required integration_id is enforced per destination type.'),interval: zod@@ -624,6 +720,11 @@ export const batchExportsUpdateBodyDestinationOneFiveConfigFileFormatDefault = `export const batchExportsUpdateBodyDestinationOneSixConfigFileFormatDefault = `JSONLines`export const batchExportsUpdateBodyDestinationOneSixConfigUseVirtualStyleAddressingDefault = falseexport const batchExportsUpdateBodyDestinationOneSevenConfigTableNameDefault = `events`+export const batchExportsUpdateBodyDestinationOneEightConfigSchemaDefault = `public`+export const batchExportsUpdateBodyDestinationOneEightConfigTableNameDefault = `events`+export const batchExportsUpdateBodyDestinationOneEightConfigPortDefault = 5439+export const batchExportsUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault = `varchar`+export const batchExportsUpdateBodyDestinationOneEightConfigModeDefault = `INSERT`export const batchExportsUpdateBodyOffsetDayMin = 0export const batchExportsUpdateBodyOffsetDayMax = 6@@ -922,6 +1023,97 @@ export const BatchExportsUpdateBody = /* @__PURE__ */ zod),}).describe('Request shape for creating or updating a Snowflake batch-export destination.'),+ zod+ .object({+ type: zod.enum(['Redshift']),+ integration_id: zod+ .number()+ .optional()+ .describe(+ 'ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.'+ ),+ config: zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsUpdateBodyDestinationOneEightConfigSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsUpdateBodyDestinationOneEightConfigTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsUpdateBodyDestinationOneEightConfigPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(batchExportsUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault)+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsUpdateBodyDestinationOneEightConfigModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),+ })+ .describe('Request shape for creating or updating a Redshift batch-export destination.'),]).describe('Destination configuration. Required integration_id is enforced per destination type.'),interval: zod@@ -979,6 +1171,11 @@ export const batchExportsPartialUpdateBodyDestinationOneFiveConfigFileFormatDefaexport const batchExportsPartialUpdateBodyDestinationOneSixConfigFileFormatDefault = `JSONLines`export const batchExportsPartialUpdateBodyDestinationOneSixConfigUseVirtualStyleAddressingDefault = falseexport const batchExportsPartialUpdateBodyDestinationOneSevenConfigTableNameDefault = `events`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigSchemaDefault = `public`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigTableNameDefault = `events`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigPortDefault = 5439+export const batchExportsPartialUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault = `varchar`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigModeDefault = `INSERT`export const batchExportsPartialUpdateBodyOffsetDayMin = 0export const batchExportsPartialUpdateBodyOffsetDayMax = 6@@ -1279,6 +1476,99 @@ export const BatchExportsPartialUpdateBody = /* @__PURE__ */ zod),}).describe('Request shape for creating or updating a Snowflake batch-export destination.'),+ zod+ .object({+ type: zod.enum(['Redshift']),+ integration_id: zod+ .number()+ .optional()+ .describe(+ 'ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.'+ ),+ config: zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsPartialUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),+ })+ .describe('Request shape for creating or updating a Redshift batch-export destination.'),]).optional().describe('Destination configuration. Required integration_id is enforced per destination type.'),@@ -1341,6 +1631,11 @@ export const batchExportsPauseCreateBodyDestinationOneConfigOneFiveFileFormatDefexport const batchExportsPauseCreateBodyDestinationOneConfigOneSixFileFormatDefault = `JSONLines`export const batchExportsPauseCreateBodyDestinationOneConfigOneSixUseVirtualStyleAddressingDefault = falseexport const batchExportsPauseCreateBodyDestinationOneConfigOneSevenTableNameDefault = `events`+export const batchExportsPauseCreateBodyDestinationOneConfigOneEightSchemaDefault = `public`+export const batchExportsPauseCreateBodyDestinationOneConfigOneEightTableNameDefault = `events`+export const batchExportsPauseCreateBodyDestinationOneConfigOneEightPortDefault = 5439+export const batchExportsPauseCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault = `varchar`+export const batchExportsPauseCreateBodyDestinationOneConfigOneEightModeDefault = `INSERT`export const batchExportsPauseCreateBodyOffsetDayMin = 0export const batchExportsPauseCreateBodyOffsetDayMax = 6@@ -1601,20 +1896,102 @@ export const BatchExportsPauseCreateBody = /* @__PURE__ */ zod.describe('Typed configuration for a Snowflake batch-export destination.\n\nAccount, user, authentication type and credentials may live in a linked Integration (when one is\nprovided) or inline in this config (legacy). Mirrors the non-credential fields of\n`SnowflakeBatchExportInputs` in `products\/batch_exports\/backend\/service.py`.'),+ zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsPauseCreateBodyDestinationOneConfigOneEightSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsPauseCreateBodyDestinationOneConfigOneEightTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsPauseCreateBodyDestinationOneConfigOneEightPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsPauseCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsPauseCreateBodyDestinationOneConfigOneEightModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),]).describe(- 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'+ 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'),integration: zod.number().nullish().describe('The integration for this destination.'),integration_id: zod.number().nullish().describe(- 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.'+ 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.'),}).describe(- 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a\ntyped OpenAPI schema. Secret fields are stripped from `config` on read.'+ 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape\nbut without a typed OpenAPI schema. Secret fields are stripped from `config` on read.').describe('Destination configuration (type, config, and optional integration).'),interval: zod@@ -1681,6 +2058,11 @@ export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneFiveFileForexport const batchExportsRunTestStepCreateBodyDestinationOneConfigOneSixFileFormatDefault = `JSONLines`export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneSixUseVirtualStyleAddressingDefault = falseexport const batchExportsRunTestStepCreateBodyDestinationOneConfigOneSevenTableNameDefault = `events`+export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightSchemaDefault = `public`+export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightTableNameDefault = `events`+export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightPortDefault = 5439+export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault = `varchar`+export const batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightModeDefault = `INSERT`export const batchExportsRunTestStepCreateBodyOffsetDayMin = 0export const batchExportsRunTestStepCreateBodyOffsetDayMax = 6@@ -1957,20 +2339,104 @@ export const BatchExportsRunTestStepCreateBody = /* @__PURE__ */ zod.describe('Typed configuration for a Snowflake batch-export destination.\n\nAccount, user, authentication type and credentials may live in a linked Integration (when one is\nprovided) or inline in this config (legacy). Mirrors the non-credential fields of\n`SnowflakeBatchExportInputs` in `products\/batch_exports\/backend\/service.py`.'),+ zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(+ batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightTableNameDefault+ )+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsRunTestStepCreateBodyDestinationOneConfigOneEightModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),]).describe(- 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'+ 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'),integration: zod.number().nullish().describe('The integration for this destination.'),integration_id: zod.number().nullish().describe(- 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.'+ 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.'),}).describe(- 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a\ntyped OpenAPI schema. Secret fields are stripped from `config` on read.'+ 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape\nbut without a typed OpenAPI schema. Secret fields are stripped from `config` on read.').describe('Destination configuration (type, config, and optional integration).'),interval: zod@@ -2040,6 +2506,11 @@ export const batchExportsUnpauseCreateBodyDestinationOneConfigOneFiveFileFormatDexport const batchExportsUnpauseCreateBodyDestinationOneConfigOneSixFileFormatDefault = `JSONLines`export const batchExportsUnpauseCreateBodyDestinationOneConfigOneSixUseVirtualStyleAddressingDefault = falseexport const batchExportsUnpauseCreateBodyDestinationOneConfigOneSevenTableNameDefault = `events`+export const batchExportsUnpauseCreateBodyDestinationOneConfigOneEightSchemaDefault = `public`+export const batchExportsUnpauseCreateBodyDestinationOneConfigOneEightTableNameDefault = `events`+export const batchExportsUnpauseCreateBodyDestinationOneConfigOneEightPortDefault = 5439+export const batchExportsUnpauseCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault = `varchar`+export const batchExportsUnpauseCreateBodyDestinationOneConfigOneEightModeDefault = `INSERT`export const batchExportsUnpauseCreateBodyOffsetDayMin = 0export const batchExportsUnpauseCreateBodyOffsetDayMax = 6@@ -2304,20 +2775,102 @@ export const BatchExportsUnpauseCreateBody = /* @__PURE__ */ zod.describe('Typed configuration for a Snowflake batch-export destination.\n\nAccount, user, authentication type and credentials may live in a linked Integration (when one is\nprovided) or inline in this config (legacy). Mirrors the non-credential fields of\n`SnowflakeBatchExportInputs` in `products\/batch_exports\/backend\/service.py`.'),+ zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsUnpauseCreateBodyDestinationOneConfigOneEightSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsUnpauseCreateBodyDestinationOneConfigOneEightTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsUnpauseCreateBodyDestinationOneConfigOneEightPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsUnpauseCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsUnpauseCreateBodyDestinationOneConfigOneEightModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),]).describe(- 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'+ 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'),integration: zod.number().nullish().describe('The integration for this destination.'),integration_id: zod.number().nullish().describe(- 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.'+ 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.'),}).describe(- 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a\ntyped OpenAPI schema. Secret fields are stripped from `config` on read.'+ 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape\nbut without a typed OpenAPI schema. Secret fields are stripped from `config` on read.').describe('Destination configuration (type, config, and optional integration).'),interval: zod@@ -2384,6 +2937,11 @@ export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneFiveFileexport const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneSixFileFormatDefault = `JSONLines`export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneSixUseVirtualStyleAddressingDefault = falseexport const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneSevenTableNameDefault = `events`+export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightSchemaDefault = `public`+export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightTableNameDefault = `events`+export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightPortDefault = 5439+export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault = `varchar`+export const batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightModeDefault = `INSERT`export const batchExportsRunTestStepNewCreateBodyOffsetDayMin = 0export const batchExportsRunTestStepNewCreateBodyOffsetDayMax = 6@@ -2664,20 +3222,110 @@ export const BatchExportsRunTestStepNewCreateBody = /* @__PURE__ */ zod.describe('Typed configuration for a Snowflake batch-export destination.\n\nAccount, user, authentication type and credentials may live in a linked Integration (when one is\nprovided) or inline in this config (legacy). Mirrors the non-credential fields of\n`SnowflakeBatchExportInputs` in `products\/batch_exports\/backend\/service.py`.'),+ zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(+ batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightSchemaDefault+ )+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(+ batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightTableNameDefault+ )+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(+ batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightPortDefault+ )+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(+ batchExportsRunTestStepNewCreateBodyDestinationOneConfigOneEightModeDefault+ )+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ type: zod.enum(['Redshift']),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),]).describe(- 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'+ 'Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses.'),integration: zod.number().nullish().describe('The integration for this destination.'),integration_id: zod.number().nullish().describe(- 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.'+ 'ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.'),}).describe(- 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a\ntyped OpenAPI schema. Secret fields are stripped from `config` on read.'+ 'Serializer for an BatchExportDestination model.\n\nThe `config` field is polymorphic and typed only for destinations that keep\ncredentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,\nAwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape\nbut without a typed OpenAPI schema. Secret fields are stripped from `config` on read.').describe('Destination configuration (type, config, and optional integration).'),interval: zoddiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 39108d8615e3..febae4b1d90e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -11980,15 +11980,111 @@ export namespace Schemas {type: SnowflakeDestinationConfigType;}- export type BatchExportDestinationConfig = DatabricksDestinationConfig | AzureBlobDestinationConfig | BigQueryDestinationConfig | PostgresDestinationConfig | AwsS3DestinationConfig | S3CompatibleDestinationConfig | SnowflakeDestinationConfig;+ /**+ * * `varchar` - varchar+ * * `super` - super+ */+ export type PropertiesDataTypeEnum = typeof PropertiesDataTypeEnum[keyof typeof PropertiesDataTypeEnum];+++ export const PropertiesDataTypeEnum = {+ Varchar: 'varchar',+ Super: 'super',+ } as const;++ /**+ * * `INSERT` - INSERT+ * * `COPY` - COPY+ */+ export type RedshiftExportModeEnum = typeof RedshiftExportModeEnum[keyof typeof RedshiftExportModeEnum];+++ export const RedshiftExportModeEnum = {+ Insert: 'INSERT',+ Copy: 'COPY',+ } as const;++ /**+ * Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.+ */+ export type RedshiftCopyInputsAuthorization = number | string | {+ aws_access_key_id: string;+ aws_secret_access_key: string;+ };++ /**+ * Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.+ */+ export type RedshiftCopyInputsBucketCredentials = number | {+ aws_access_key_id: string;+ aws_secret_access_key: string;+ };++ /**+ * S3 staging configuration for a Redshift batch export running in COPY mode.+ */+ export interface RedshiftCopyInputs {+ /** S3 bucket where files are staged before the Redshift COPY. */+ s3_bucket: string;+ /** AWS region of the staging S3 bucket. */+ region_name: string;+ /** Key prefix for staged files in the S3 bucket. */+ s3_key_prefix: string;+ /** Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration. */+ authorization: RedshiftCopyInputsAuthorization;+ /** Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration. */+ bucket_credentials: RedshiftCopyInputsBucketCredentials;+ }++ export type RedshiftDestinationConfigType = typeof RedshiftDestinationConfigType[keyof typeof RedshiftDestinationConfigType];+++ export const RedshiftDestinationConfigType = {+ Redshift: 'Redshift',+ } as const;++ /**+ * Typed configuration for a Redshift batch-export destination.+ *+ * Connection credentials may live in a linked Integration (when one is provided) or inline in+ * this config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in+ * `products/batch_exports/backend/service.py`.+ */+ export interface RedshiftDestinationConfig {+ /** Redshift database name to connect to. */+ database: string;+ /** Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves. */+ host?: string;+ /** Redshift schema name containing the destination table. */+ schema?: string;+ /** Redshift table name to write exported rows into. */+ table_name?: string;+ /** Port the Redshift server listens on. */+ port?: number;+ /** Data type used for JSON-like columns such as event properties.+ *+ * * `varchar` - varchar+ * * `super` - super */+ properties_data_type?: PropertiesDataTypeEnum;+ /** How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.+ *+ * * `INSERT` - INSERT+ * * `COPY` - COPY */+ mode?: RedshiftExportModeEnum;+ /** S3 staging configuration, required when mode is 'COPY'. */+ copy_inputs?: RedshiftCopyInputs;+ type: RedshiftDestinationConfigType;+ }++ export type BatchExportDestinationConfig = DatabricksDestinationConfig | AzureBlobDestinationConfig | BigQueryDestinationConfig | PostgresDestinationConfig | AwsS3DestinationConfig | S3CompatibleDestinationConfig | SnowflakeDestinationConfig | RedshiftDestinationConfig;/*** Serializer for an BatchExportDestination model.** The `config` field is polymorphic and typed only for destinations that keep* credentials in the linked Integration (currently Databricks, AzureBlob, BigQuery, Postgres,- * AwsS3, S3Compatible, Snowflake). Other destination types accept the same JSON shape but without a- * typed OpenAPI schema. Secret fields are stripped from `config` on read.+ * AwsS3, S3Compatible, Snowflake, Redshift). Other destination types accept the same JSON shape+ * but without a typed OpenAPI schema. Secret fields are stripped from `config` on read.*/export interface BatchExportDestination {/** A choice of supported BatchExportDestination types.@@ -12007,7 +12103,7 @@ export namespace Schemas {* * `NoOp` - Noop* * `FileDownload` - File Download */type: BatchExportDestinationTypeEnum;- /** Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses. */+ /** Destination-specific configuration. Fields depend on `type`. Credentials for integration-backed destinations (Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, Redshift) are NOT stored here — they live in the linked Integration. Secret fields are stripped from responses. */config: BatchExportDestinationConfig;/*** The integration for this destination.@@ -12015,7 +12111,7 @@ export namespace Schemas {*/integration?: number | null;/**- * ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake (inline credentials remain supported); unused for other types.+ * ID of a team-scoped Integration providing credentials. Required when creating Databricks, AzureBlob, BigQuery, Postgres, AwsS3, and S3Compatible destinations; optional for Snowflake and Redshift (inline credentials remain supported); unused for other types.* @nullable*/integration_id?: number | null;@@ -13001,7 +13097,24 @@ export namespace Schemas {config: SnowflakeDestinationConfig;}- export type BatchExportDestinationRequest = DatabricksDestinationRequest | AzureBlobDestinationRequest | BigQueryDestinationRequest | PostgresDestinationRequest | AwsS3DestinationRequest | S3CompatibleDestinationRequest | SnowflakeDestinationRequest;+ export type RedshiftDestinationRequestType = typeof RedshiftDestinationRequestType[keyof typeof RedshiftDestinationRequestType];+++ export const RedshiftDestinationRequestType = {+ Redshift: 'Redshift',+ } as const;++ /**+ * Request shape for creating or updating a Redshift batch-export destination.+ */+ export interface RedshiftDestinationRequest {+ type: RedshiftDestinationRequestType;+ /** ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one. */+ integration_id?: number;+ config: RedshiftDestinationConfig;+ }++ export type BatchExportDestinationRequest = DatabricksDestinationRequest | AzureBlobDestinationRequest | BigQueryDestinationRequest | PostgresDestinationRequest | AwsS3DestinationRequest | S3CompatibleDestinationRequest | SnowflakeDestinationRequest | RedshiftDestinationRequest;/*** Request body for create/partial_update on BatchExportViewSet.@@ -72872,6 +72985,16 @@ export namespace Schemas {OneOff: 'one_off',} as const;+ /**+ * * `Redshift` - Redshift+ */+ export type RedshiftDestinationRequestTypeEnum = typeof RedshiftDestinationRequestTypeEnum[keyof typeof RedshiftDestinationRequestTypeEnum];+++ export const RedshiftDestinationRequestTypeEnum = {+ Redshift: 'Redshift',+ } as const;+export interface RelationshipReject {/** Why the proposal is rejected. Persisted so it is never re-proposed. */rejection_reason?: string;diff --git a/services/mcp/src/generated/batch_exports/api.ts b/services/mcp/src/generated/batch_exports/api.tsindex 33a495b1526b..c5839fcf52a8 100644--- a/services/mcp/src/generated/batch_exports/api.ts+++ b/services/mcp/src/generated/batch_exports/api.ts@@ -42,6 +42,11 @@ export const batchExportsCreateBodyDestinationOneFiveConfigFileFormatDefault = `export const batchExportsCreateBodyDestinationOneSixConfigFileFormatDefault = `JSONLines`export const batchExportsCreateBodyDestinationOneSixConfigUseVirtualStyleAddressingDefault = falseexport const batchExportsCreateBodyDestinationOneSevenConfigTableNameDefault = `events`+export const batchExportsCreateBodyDestinationOneEightConfigSchemaDefault = `public`+export const batchExportsCreateBodyDestinationOneEightConfigTableNameDefault = `events`+export const batchExportsCreateBodyDestinationOneEightConfigPortDefault = 5439+export const batchExportsCreateBodyDestinationOneEightConfigPropertiesDataTypeDefault = `varchar`+export const batchExportsCreateBodyDestinationOneEightConfigModeDefault = `INSERT`export const batchExportsCreateBodyOffsetDayMin = 0export const batchExportsCreateBodyOffsetDayMax = 6@@ -333,6 +338,96 @@ export const BatchExportsCreateBody = /* @__PURE__ */ zod),}).describe('Request shape for creating or updating a Snowflake batch-export destination.'),+ zod+ .object({+ type: zod.enum(['Redshift']),+ integration_id: zod+ .number()+ .optional()+ .describe(+ 'ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.'+ ),+ config: zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsCreateBodyDestinationOneEightConfigSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsCreateBodyDestinationOneEightConfigTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsCreateBodyDestinationOneEightConfigPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(batchExportsCreateBodyDestinationOneEightConfigPropertiesDataTypeDefault)+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsCreateBodyDestinationOneEightConfigModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),+ })+ .describe('Request shape for creating or updating a Redshift batch-export destination.'),]).describe('Destination configuration. Required integration_id is enforced per destination type.'),interval: zod@@ -398,6 +493,11 @@ export const batchExportsPartialUpdateBodyDestinationOneFiveConfigFileFormatDefaexport const batchExportsPartialUpdateBodyDestinationOneSixConfigFileFormatDefault = `JSONLines`export const batchExportsPartialUpdateBodyDestinationOneSixConfigUseVirtualStyleAddressingDefault = falseexport const batchExportsPartialUpdateBodyDestinationOneSevenConfigTableNameDefault = `events`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigSchemaDefault = `public`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigTableNameDefault = `events`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigPortDefault = 5439+export const batchExportsPartialUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault = `varchar`+export const batchExportsPartialUpdateBodyDestinationOneEightConfigModeDefault = `INSERT`export const batchExportsPartialUpdateBodyOffsetDayMin = 0export const batchExportsPartialUpdateBodyOffsetDayMax = 6@@ -691,6 +791,98 @@ export const BatchExportsPartialUpdateBody = /* @__PURE__ */ zod),}).describe('Request shape for creating or updating a Snowflake batch-export destination.'),+ zod+ .object({+ type: zod.enum(['Redshift']),+ integration_id: zod+ .number()+ .optional()+ .describe(+ 'ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.'+ ),+ config: zod+ .object({+ database: zod.string().describe('Redshift database name to connect to.'),+ host: zod+ .string()+ .optional()+ .describe(+ 'Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.'+ ),+ schema: zod+ .string()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigSchemaDefault)+ .describe('Redshift schema name containing the destination table.'),+ table_name: zod+ .string()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigTableNameDefault)+ .describe('Redshift table name to write exported rows into.'),+ port: zod+ .number()+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigPortDefault)+ .describe('Port the Redshift server listens on.'),+ properties_data_type: zod+ .enum(['varchar', 'super'])+ .describe('\* `varchar` - varchar\n\* `super` - super')+ .default(+ batchExportsPartialUpdateBodyDestinationOneEightConfigPropertiesDataTypeDefault+ )+ .describe(+ 'Data type used for JSON-like columns such as event properties.\n\n\* `varchar` - varchar\n\* `super` - super'+ ),+ mode: zod+ .enum(['INSERT', 'COPY'])+ .describe('\* `INSERT` - INSERT\n\* `COPY` - COPY')+ .default(batchExportsPartialUpdateBodyDestinationOneEightConfigModeDefault)+ .describe(+ 'How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n\* `INSERT` - INSERT\n\* `COPY` - COPY'+ ),+ copy_inputs: zod+ .object({+ s3_bucket: zod+ .string()+ .describe('S3 bucket where files are staged before the Redshift COPY.'),+ region_name: zod.string().describe('AWS region of the staging S3 bucket.'),+ s3_key_prefix: zod+ .string()+ .describe('Key prefix for staged files in the S3 bucket.'),+ authorization: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod+ .string()+ .describe('ARN of an IAM role attached to the Redshift cluster.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration.'+ ),+ bucket_credentials: zod+ .union([+ zod.number().describe('ID of an aws-s3-kind Integration.'),+ zod.object({+ aws_access_key_id: zod.string(),+ aws_secret_access_key: zod.string(),+ }),+ ])+ .describe(+ 'Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration.'+ ),+ })+ .describe(+ 'S3 staging configuration for a Redshift batch export running in COPY mode.'+ )+ .optional()+ .describe("S3 staging configuration, required when mode is 'COPY'."),+ })+ .describe(+ 'Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products\/batch_exports\/backend\/service.py`.'+ ),+ })+ .describe('Request shape for creating or updating a Redshift batch-export destination.'),]).optional().describe('Destination configuration. Required integration_id is enforced per destination type.'),diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.jsonindex cf9de0b0d657..925de3e8aa2f 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json@@ -394,6 +394,134 @@},"required": ["type", "config"],"type": "object"+ },+ {+ "description": "Request shape for creating or updating a Redshift batch-export destination.",+ "properties": {+ "config": {+ "description": "Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products/batch_exports/backend/service.py`.",+ "properties": {+ "copy_inputs": {+ "description": "S3 staging configuration, required when mode is 'COPY'.",+ "properties": {+ "authorization": {+ "anyOf": [+ {+ "description": "ID of an aws-s3-kind Integration.",+ "type": "number"+ },+ {+ "description": "ARN of an IAM role attached to the Redshift cluster.",+ "type": "string"+ },+ {+ "properties": {+ "aws_access_key_id": {+ "type": "string"+ },+ "aws_secret_access_key": {+ "type": "string"+ }+ },+ "required": ["aws_access_key_id", "aws_secret_access_key"],+ "type": "object"+ }+ ],+ "description": "Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration."+ },+ "bucket_credentials": {+ "anyOf": [+ {+ "description": "ID of an aws-s3-kind Integration.",+ "type": "number"+ },+ {+ "properties": {+ "aws_access_key_id": {+ "type": "string"+ },+ "aws_secret_access_key": {+ "type": "string"+ }+ },+ "required": ["aws_access_key_id", "aws_secret_access_key"],+ "type": "object"+ }+ ],+ "description": "Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration."+ },+ "region_name": {+ "description": "AWS region of the staging S3 bucket.",+ "type": "string"+ },+ "s3_bucket": {+ "description": "S3 bucket where files are staged before the Redshift COPY.",+ "type": "string"+ },+ "s3_key_prefix": {+ "description": "Key prefix for staged files in the S3 bucket.",+ "type": "string"+ }+ },+ "required": [+ "s3_bucket",+ "region_name",+ "s3_key_prefix",+ "authorization",+ "bucket_credentials"+ ],+ "type": "object"+ },+ "database": {+ "description": "Redshift database name to connect to.",+ "type": "string"+ },+ "host": {+ "description": "Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.",+ "type": "string"+ },+ "mode": {+ "default": "INSERT",+ "description": "How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n* `INSERT` - INSERT\n* `COPY` - COPY",+ "enum": ["INSERT", "COPY"],+ "type": "string"+ },+ "port": {+ "default": 5439,+ "description": "Port the Redshift server listens on.",+ "type": "number"+ },+ "properties_data_type": {+ "default": "varchar",+ "description": "Data type used for JSON-like columns such as event properties.\n\n* `varchar` - varchar\n* `super` - super",+ "enum": ["varchar", "super"],+ "type": "string"+ },+ "schema": {+ "default": "public",+ "description": "Redshift schema name containing the destination table.",+ "type": "string"+ },+ "table_name": {+ "default": "events",+ "description": "Redshift table name to write exported rows into.",+ "type": "string"+ }+ },+ "required": ["database"],+ "type": "object"+ },+ "integration_id": {+ "description": "ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.",+ "type": "number"+ },+ "type": {+ "enum": ["Redshift"],+ "type": "string"+ }+ },+ "required": ["type", "config"],+ "type": "object"}],"description": "Destination configuration. Required integration_id is enforced per destination type."diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.jsonindex 2f897ad3d194..fcbfbc7968fb 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json@@ -393,6 +393,134 @@},"required": ["type", "config"],"type": "object"+ },+ {+ "description": "Request shape for creating or updating a Redshift batch-export destination.",+ "properties": {+ "config": {+ "description": "Typed configuration for a Redshift batch-export destination.\n\nConnection credentials may live in a linked Integration (when one is provided) or inline in\nthis config (legacy). Mirrors the non-credential fields of `RedshiftBatchExportInputs` in\n`products/batch_exports/backend/service.py`.",+ "properties": {+ "copy_inputs": {+ "description": "S3 staging configuration, required when mode is 'COPY'.",+ "properties": {+ "authorization": {+ "anyOf": [+ {+ "description": "ID of an aws-s3-kind Integration.",+ "type": "number"+ },+ {+ "description": "ARN of an IAM role attached to the Redshift cluster.",+ "type": "string"+ },+ {+ "properties": {+ "aws_access_key_id": {+ "type": "string"+ },+ "aws_secret_access_key": {+ "type": "string"+ }+ },+ "required": ["aws_access_key_id", "aws_secret_access_key"],+ "type": "object"+ }+ ],+ "description": "Authorization for Redshift to read staged files during COPY: the ARN of an IAM role attached to the cluster, inline AWS credentials, or the id of an aws-s3-kind Integration."+ },+ "bucket_credentials": {+ "anyOf": [+ {+ "description": "ID of an aws-s3-kind Integration.",+ "type": "number"+ },+ {+ "properties": {+ "aws_access_key_id": {+ "type": "string"+ },+ "aws_secret_access_key": {+ "type": "string"+ }+ },+ "required": ["aws_access_key_id", "aws_secret_access_key"],+ "type": "object"+ }+ ],+ "description": "Credentials used to stage files in the S3 bucket: inline AWS credentials or the id of an aws-s3-kind Integration."+ },+ "region_name": {+ "description": "AWS region of the staging S3 bucket.",+ "type": "string"+ },+ "s3_bucket": {+ "description": "S3 bucket where files are staged before the Redshift COPY.",+ "type": "string"+ },+ "s3_key_prefix": {+ "description": "Key prefix for staged files in the S3 bucket.",+ "type": "string"+ }+ },+ "required": [+ "s3_bucket",+ "region_name",+ "s3_key_prefix",+ "authorization",+ "bucket_credentials"+ ],+ "type": "object"+ },+ "database": {+ "description": "Redshift database name to connect to.",+ "type": "string"+ },+ "host": {+ "description": "Redshift cluster or Serverless workgroup endpoint. Required when using an AWS Redshift integration; plain Redshift integrations store the host themselves.",+ "type": "string"+ },+ "mode": {+ "default": "INSERT",+ "description": "How rows reach Redshift: batched INSERT statements, or COPY from files staged in S3.\n\n* `INSERT` - INSERT\n* `COPY` - COPY",+ "enum": ["INSERT", "COPY"],+ "type": "string"+ },+ "port": {+ "default": 5439,+ "description": "Port the Redshift server listens on.",+ "type": "number"+ },+ "properties_data_type": {+ "default": "varchar",+ "description": "Data type used for JSON-like columns such as event properties.\n\n* `varchar` - varchar\n* `super` - super",+ "enum": ["varchar", "super"],+ "type": "string"+ },+ "schema": {+ "default": "public",+ "description": "Redshift schema name containing the destination table.",+ "type": "string"+ },+ "table_name": {+ "default": "events",+ "description": "Redshift table name to write exported rows into.",+ "type": "string"+ }+ },+ "required": ["database"],+ "type": "object"+ },+ "integration_id": {+ "description": "ID of an aws-redshift-kind Integration providing connection credentials. Preferred over inline credentials. Use the integrations-list MCP tool to find one.",+ "type": "number"+ },+ "type": {+ "enum": ["Redshift"],+ "type": "string"+ }+ },+ "required": ["type", "config"],+ "type": "object"}],"description": "Destination configuration. Required integration_id is enforced per destination type."