DataTongs — Reference Data Sync Scripts

DataTongs grips reference data from your live database and produces synchronization scripts — one SQL file per table, ready for schema packages or direct deployment.

Try it hands-on
DataTongs extracting reference data and generating sync scripts for multiple database engines

What DataTongs does

In schema-as-code workflows, SchemaTongs and SchemaQuench handle structure: extraction and deployment of tables, views, procedures, and functions. But database schemas don't live in isolation — they travel with reference data. Lookup tables, configuration rows, seed data, and status enumerations need the same version control and deployment lifecycle as the schema itself. DataTongs fills that gap.

DataTongs connects to a live database, reads your configured reference tables, and writes one synchronization script per table to your output path. On SQL Server and PostgreSQL, these scripts use MERGE statements — conditional inserts and updates in a single atomic operation. On MySQL and MariaDB, DataTongs emits INSERT ... ON DUPLICATE KEY UPDATE scripts, their native syntax for idempotent upserts. The output is self-contained: drop a script into a schema package's Table Data folder and SchemaQuench will execute it during deployment, or run it directly against any compatible target to synchronize reference data in isolation.

One DataTongs executable runs on every supported platform, and works identically on each; what changes is the adapter underneath. Set your Source:Platform value to SqlServer, PostgreSQL, MySQL, or MariaDb and DataTongs picks the right connection protocol, platform metadata APIs, and sync-script dialect.

DataTongs also configures how extracted data flows into your deployment pipeline. Pass the --ConfigureDataDelivery flag and DataTongs writes a DataDelivery block into each table's JSON schema file alongside the extracted .tabledata content file. The DataDelivery block captures delivery settings — which columns to match on, merge type, any filters, and platform-specific trigger or rule handling — so SchemaQuench knows exactly how to synchronize that data during deployment. This turns the workflow into a single integrated pipeline: SchemaTongs extracts your schema structure, DataTongs extracts your reference data and wires it into the delivery configuration in one pass, and SchemaQuench deploys both together. See SchemaQuench for how the deployment side reads and executes these configured data deliveries.

Important: one tool, a native dialect per engine

DataTongs generates platform-native scripts: SQL Server and PostgreSQL emit MERGE statements; MySQL and MariaDB emit INSERT ... ON DUPLICATE KEY UPDATE. The same extraction, a native dialect for each engine. A SQL Server DataTongs output is not compatible with MySQL — run each script against its target platform.

Jump to the reference for your platform

Each platform reference covers configuration, the platform-native sync-script syntax, and the extraction settings DataTongs exposes for that engine.

SQL Server

Reference for DataTongs on SQL Server. Configuration, MERGE script emission, Source, Tables, and ShouldCast settings including DisableTriggers, MergeUpdate, and MergeDelete.

PostgreSQL

Reference for DataTongs on PostgreSQL. Configuration, MERGE statement emission (PostgreSQL 15+ syntax), Tables entries with KeyColumns and optional Filter, and synchronization behavior.

MySQL

Reference for DataTongs on MySQL. Configuration, INSERT ... ON DUPLICATE KEY UPDATE script emission, Source + Tables + KeyColumns, and MySQL-native synchronization semantics.

MariaDB

Reference for DataTongs on MariaDB. Configuration, INSERT ... ON DUPLICATE KEY UPDATE script emission, Source + Tables + KeyColumns, and MariaDB-native synchronization semantics.

Try it hands-on

Each platform has a 15-minute hands-on walkthrough focused on extraction. You'll configure a source connection, run DataTongs against a live demo database, and review the generated synchronization scripts.

SQL Server Walkthrough

Hands-on 15-minute walkthrough using the Northwind demo database. Configure the source connection, run DataTongs, and review the generated MERGE scripts for reference tables.

PostgreSQL Walkthrough

Hands-on 15-minute walkthrough using the Northwind demo database. Configure the source connection, run DataTongs, and inspect the generated MERGE scripts and synchronization output.

MySQL Walkthrough

Hands-on 15-minute walkthrough using the Northwind demo database. Configure the source connection, run DataTongs, and review the generated INSERT ... ON DUPLICATE KEY UPDATE scripts.

MariaDB Walkthrough

Hands-on 15-minute walkthrough using the Northwind demo database. Configure the source connection, run DataTongs, and review the generated INSERT ... ON DUPLICATE KEY UPDATE scripts.

Shape. Strengthen. Succeed.

Free schema-as-code for SQL Server, PostgreSQL, MySQL, and MariaDB.

The source is on GitHub for anyone to read.

Get Started on GitHub