Batch exports: schedule events, persons, sessions and groups to your warehouse
Create, run, backfill and monitor scheduled exports to S3, GCS, Azure, Postgres, Snowflake, BigQuery, Redshift and Databricks with the API, the CLI or the app, and the exact permissions each destination needs.
A batch export is a schedule: every interval_secs Lucida writes the next window of one stream to your storage and, for a warehouse, loads it. Streams are events, persons, sessions and groups (plus query, source_rows and replays described in the API reference). Delivery is at-least-once: a window can be written twice after a retry, so de-duplicate by uuid (events), upsert by version (persons, groups) or use session_id (sessions). Persons and groups are exported again whenever they change.
Credentials are write-only. They are sealed when you save the schedule and are never returned, logged or shown again; to rotate one, delete and recreate the schedule.
The API
Everything is under /v1/projects/{project_id}/export-schedules. Reads need the connector:read scope, every other call connector:write.
Call | What it does |
|---|---|
| Create. Body: |
| List, |
| Read, change |
| Check a destination and its credentials without saving (writes and removes a probe object). |
| Stop and restart the schedule. |
| Run the next window now (202). The schedule must be enabled. |
| Export |
| Runs with |
| Retry a failed run, cancel a queued or running one. |
Failure alerts
A schedule whose last attempt failed shows as export_failing in pipeline health (GET /pipeline-health, and the Pipeline health page), carrying the error text. Turn on pipeline alerts under Pipeline health settings to get it by email, Slack or webhook. A schedule that is silently behind shows as export_behind.
Definitions as code
lucida pull and lucida apply manage schedules as lucida/export-schedules/<name>.yaml:
name: events-to-snowflake
stream: events
format: parquet
interval_secs: 3600
destination: { kind: s3, endpoint: https://s3.us-east-1.amazonaws.com, bucket: my-exports, region: us-east-1, prefix: lucida }
warehouse:
kind: snowflake
params: { account: xy12345.us-east-1, user: LUCIDA, database: ANALYTICS, schema: RAW, table: EVENTS, stage: LUCIDA_EXPORTS }
credentials: # references only: a literal value is refused
dest: { access_key: "env:EXPORT_S3_ACCESS_KEY", secret_key: "env:EXPORT_S3_SECRET_KEY" }
warehouse: { private_key: "env:EXPORT_SNOWFLAKE_KEY" }
enabled: trueEvery env:NAME is read from the environment of the machine running lucida apply when the schedule is created. After creation only name, interval_secs and enabled change in place; changing the stream, format, destination, warehouse or options means deleting the file's schedule (lucida prune --yes) and applying again. Pulled files never contain credentials.
Permissions per destination
Lucida only needs what is listed here.
S3 (and S3-compatible storage)
Credentials: access_key and secret_key (optionally session_token), or a role_arn in the destination that Lucida's AWS identity assumes (add external_id). The principal needs s3:PutObject on arn:aws:s3:::BUCKET/PREFIX/*. With sse: aws:kms it also needs kms:GenerateDataKey and kms:Decrypt on the key. Large files use multipart upload, so add s3:AbortMultipartUpload. No list or read access is needed.
Google Cloud Storage
Credential: a service_account_json (or a short-lived access_token). The service account needs storage.objects.create on the bucket (role Storage Object Creator).
Azure Blob Storage
Credential: a sas_token for the container with Create and Write permissions.
Postgres
Credential: dsn. The destination takes a [schema.]table, jsonl.gz and the events, persons or source_rows streams. The role needs CREATE on the schema for the first run (the table is created on first use), then INSERT and UPDATE on the table (persons upsert by version). tls_mode is require, verify-ca or verify-full. Groups and sessions are not written to Postgres directly: use a bucket and a warehouse.
Snowflake
Lucida writes files to a bucket and runs COPY INTO through the SQL API. You create the external stage and the table. Params: account, database, schema, table, stage (plus optional warehouse, role, stage_prefix).
Stage: an external stage over the export bucket, with a storage integration that can read it.
Credential: a key pair (
private_key, optionalprivate_key_passphrase, withparams.user) or a programmatic access token (token_type: PROGRAMMATIC_ACCESS_TOKEN) or OAuth token. Passwords are not supported.Grants for that user or role:
USAGEon the database, schema, warehouse and stage (andREADon the stage),INSERTon the table.
BigQuery
Load jobs read files from a GCS bucket, so the destination is gcs. Params: project, dataset, table (optional partition_type).
Credential:
service_account_json(oraccess_token);params.impersonatenames a service account to act as.Roles: BigQuery Job User on the project, BigQuery Data Editor on the dataset, and Storage Object Viewer on the bucket for the BigQuery service identity.
Redshift
Lucida issues COPY through the Redshift Data API. Params: region, database, schema_table, iam_role (the role Redshift assumes to read the bucket) and either cluster (plus db_user) or workgroup.
Credential:
access_keyandsecret_key, orparams.role_arn(andexternal_id) that Lucida's AWS identity assumes.Caller permissions:
redshift-data:ExecuteStatement,DescribeStatement, andredshift:GetClusterCredentials(provisioned) orredshift-serverless:GetCredentials(serverless).iam_roleneedss3:GetObjectands3:ListBucketon the bucket and must be attached to the cluster. The database user needsINSERTon the table.
Databricks
Lucida runs COPY INTO through the SQL Statement Execution API. Params: host, warehouse_id, table (catalog.schema.table, created by you), optional json_type (string or variant) and uri_scheme.
Credential: a personal
access_token, or a service principalclient_idandclient_secret(OAuth M2M).Grants:
CAN USEon the SQL warehouse,USE CATALOG,USE SCHEMAandMODIFYon the table, and read access to the bucket through an external location or storage credential.