DatriseAI-first ETL

Free tool

Upsert / MERGE SQL generator

Every destination spells "insert or update" differently, and most of the differences bite at 3 a.m.: a MERGE that fails on duplicate source rows, an ON CONFLICT with no matching index, a Redshift delete that leaves ghost rows. Pick the destination, name your table, key and columns, and get the statement that is correct there.

The statements come from the load profiles Datrise uses to land CRM entities into each destination, including the watermark guard that stops an older row from overwriting a newer one. Nothing you type leaves the browser; the share link encodes the form in the URL.

Generate the statement

The URL updates as you type; share it to hand someone the exact form.

Statement · INSERT … ON CONFLICT DO UPDATE

INSERT INTO "deals" ("id", "name", "stage", "amount", "owner_id", "updated_at")
SELECT "id", "name", "stage", "amount", "owner_id", "updated_at"
FROM "deals_staging"
ON CONFLICT ("id") DO UPDATE SET
  "name" = EXCLUDED."name",
  "stage" = EXCLUDED."stage",
  "amount" = EXCLUDED."amount",
  "owner_id" = EXCLUDED."owner_id",
  "updated_at" = EXCLUDED."updated_at"
WHERE "deals"."updated_at" IS NULL
   OR "deals"."updated_at" < EXCLUDED."updated_at";

How each destination does an upsert

DestinationStatementMechanic
PostgreSQLSyntax and gotchasINSERT … ON CONFLICT DO UPDATEa watermark on each entity's updated-at, applied with INSERT … ON CONFLICT DO UPDATE
MySQLSyntax and gotchasINSERT … ON DUPLICATE KEY UPDATEa watermark on updated-at, applied with INSERT … ON DUPLICATE KEY UPDATE
Microsoft SQL ServerSyntax and gotchasMERGE … WITH (HOLDLOCK)a watermark on updated-at, applied with a MERGE statement
Oracle DatabaseSyntax and gotchasMERGE INTO … USINGa watermark on updated-at, applied with MERGE INTO
SnowflakeSyntax and gotchasMERGE INTO … QUALIFY-deduped USINGstaged loads merged on stable id with MERGE, so credits scale with change volume, not table size
Google BigQuerySyntax and gotchasMERGE with partition-pruned targetappends to a staging table, then MERGE on stable id into the partitioned target
Amazon RedshiftSyntax and gotchasDELETE … USING + INSERT (staging pattern)COPY from staged files, then a delete-and-insert merge on stable id
Databricks SQL WarehouseSyntax and gotchasDelta Lake MERGE INTOa Delta MERGE on stable id, with change history available via time travel
ClickHouseSyntax and gotchasINSERT into ReplacingMergeTree + FINALinserts into a ReplacingMergeTree keyed on stable id, so the latest version wins on merge
DuckDBSyntax and gotchasINSERT OR REPLACE / ON CONFLICT DO UPDATErewrites changed entities into the local database (or Parquet) on each run
Amazon AthenaSyntax and gotchasMERGE INTO (Iceberg table, engine v3)writes new Parquet partitions and registers them in the Glue Data Catalog
Amazon S3 Data LakeSyntax and gotchasappend partition + latest-version viewwrites new date partitions and compacts small files on a schedule
Azure Data Lake StorageSyntax and gotchasappend partition + latest-version viewwrites new date partitions to the container and compacts on a schedule
Azure SynapseSyntax and gotchasMERGE (dedicated SQL pool)COPY into staging, then a MERGE on stable id
AirtableSyntax and gotchasPATCH /records with performUpsertupserts records matched on a stable id field
MongoDBSyntax and gotchasbulkWrite updateOne { upsert: true }upserts by stable id with updateOne(upsert) on the source primary key
SupabaseSyntax and gotchasINSERT … ON CONFLICT DO UPDATEa watermark on updated-at, applied with INSERT … ON CONFLICT DO UPDATE
NeonSyntax and gotchasINSERT … ON CONFLICT DO UPDATEa watermark on updated-at, applied with INSERT … ON CONFLICT DO UPDATE
PlanetScaleSyntax and gotchasINSERT … ON DUPLICATE KEY UPDATEa watermark on updated-at, applied with INSERT … ON DUPLICATE KEY UPDATE
Amazon DynamoDBSyntax and gotchasPutItem with ConditionExpressionPutItem/UpdateItem keyed on a partition key derived from the entity id

Skip writing the merge at all

Datrise lands CRM and SaaS entities into every destination above with this exact mechanic, a watermark on updated-at, and typed columns, so the statement you just generated is what runs on your behalf. Join the waitlist to get early access.

Browse the integration catalog