DatriseAI-first ETL

Mailgun to ClickHouse Integration

AI-first ETL from Mailgun into ClickHouse. Governed entities, incremental sync, typed landing tables.

How Datrise loads Mailgun into ClickHouse

Datrise syncs Mailgun's messages, domains, delivery events, bounces, complaints, and mailing lists into ClickHouse as a MergeTree table per source entity. Flexible or custom fields land in JSON or Map columns, and timestamps such as created, updated, and status changes are typed as DateTime64.

Sync is incremental: Datrise uses inserts into a ReplacingMergeTree keyed on stable id, so the latest version wins on merge, so re-runs update only what changed. Partition by month and order by (entity id, updated-at) for fast range scans. ClickHouse deduplicates asynchronously on merge, so Datrise uses ReplacingMergeTree and FINAL-safe queries rather than assuming immediate upserts.

Ideal for high-volume event analytics that need sub-second aggregation.

Endpoints

Mailgun: Transactional email API with delivery analytics.

ClickHouse: Columnar OLAP engine for fast aggregations.

How Mailgun entities map to ClickHouse

Mailgun entityClickHouse objectNotes
messagesmailgun_messagesid PK · custom fields → JSON or Map columns
domainsmailgun_domainsid PK · linked to mailgun_messages
delivery eventsmailgun_delivery_eventsDateTime64 events
bouncesmailgun_bouncesid PK · linked to mailgun_messages

FAQ

How does Datrise handle Mailgun's custom fields in ClickHouse?

Flexible values are stored as JSON or Map columns, so new fields don't require a migration; strongly-typed fields — dates, numbers, and references — are promoted to native ClickHouse types.

How does the Mailgun to ClickHouse sync stay up to date?

It runs incrementally — Datrise uses inserts into a ReplacingMergeTree keyed on stable id, so the latest version wins on merge.

Related pipelines

Early access

Connect Mailgun to ClickHouse the easy way

Skip brittle scripts and manual exports. Join the waitlist to get a guided setup, AI-assisted mapping, and reliable incremental sync for this integration.