SQL logo
Schema Standardsstandard

Connect SQL DDL

Give the column nobody can explain a rule the database can actually carry.

How CoreModels works with SQL

DDL is honest about storage and silent about sense. Teams paper over that with check constraints they forget, lookup tables they do not join, and documents nobody diffs against production.

CoreModels treats SQL as a first-class import and export. Conversion recipes (including JSON Schema to SQL) make the target dialect explicit and the loss visible. Governed allowed values can ride in comments or in generated checks depending on what the engine will enforce.

Use this when the database is the last remaining source of truth — and you need it to stop being the last remaining source of confusion.

Recipes

No recipes yet for SQL. The articles below still describe the problem this connector is built to close.

Uses

Problems this connector fixes

Articles that explain the gap, then point at the recipe that closes it.

Problem

The Column Nobody Can Explain

A partner feed starts rejecting rows at two in the morning. The cause is one column: `status`. Someone runs a `SELECT DISTINCT` against production and gets six values back. The application's enumeration has five. The integration document the partner was handed lists four. The column is declared `VARCHAR(32)`, so all six values are perfectly legal — the database was never told otherwise.

Outcomes

Four Requests, One Schema, Nothing Retyped

Here is a realistic week for whoever owns the customer schema in a mid-sized data platform.

Governance

Who Signs Off on a Generated `CREATE TABLE`?

A pull request lands. It contains a DDL file generated from a governed model, destined for a database real customers depend on. A reviewer has to decide whether to approve it.

Ecosystem

SQL Is Everywhere, Which Is Exactly Why It Cannot Be the Center

Read enough data specifications and you notice how often they quote SQL inside themselves.

Agents

An Agent Can Write Perfect DDL for the Wrong Database

Language models are unusually good at writing SQL DDL. They have read an enormous amount of it, the grammar is regular, and the output looks right immediately.

Quickstart

Your First DDL Transform Should Write Nothing: a SQL Quickstart

The most accurate description of your data is almost certainly a `CREATE TABLE` statement sitting in a migrations folder. It is reviewed, versioned, and executable — and it is legible to exactly one kind of consumer. Getting it out of that folder and into a data contract, a JSON Schema, or another vendor's dialect is usually where the accuracy stops.

API

Four Routes, One Envelope: SQL DDL on the CoreModels Transform API

| Route | Role | What it touches | |---|---|---| | `POST /graph/transform/schema/import/{projectId}` | Admin | writes the DDL's model into the project | | `POST /graph/transform/schema/export/{projectId}` | Viewer | reads the project, returns `CREATE TABLE` text | | `POST /graph/transform/schema/map/{projectId}` | Viewer (`ai`: Editor) | nothing — stateless, source in, target out | | `POST /graph/transform/plan/execute/{projectId}` | Viewer | nothing — replays a stored plan |

MCP

Teaching an Agent to Read DDL: the transform_schema MCP Tool

A partner attaches `subscriber_dump.sql` to a ticket. Backticks, an `ENUM`, a `DATETIME`, and one column named by a DBA who shouts. Your canonical model is a JSON Schema in a repo. Somebody has to reconcile the two, and historically that somebody spent an afternoon in a diff viewer.

Automation

Commit the Plan, Not the Guess: SQL Conversion Pipelines That Repeat

Database teams solved schema-as-code years ago. DDL lives in git, migrations get reviewed, nobody types `ALTER TABLE` into production by hand. Then the schema has to leave the database — become a JSON Schema for the API team, a contract for the platform team, DDL for a second warehouse — and the discipline evaporates into a conversion script that one person ran once on a laptop.

Deep dive

No Annotation Slot: How the SQL DDL Coder Carries Meaning, and Where It Stops

Every other format on the CoreModels transform surface has somewhere to put meaning. JSON Schema has `x-` keywords. Avro has custom attributes. LinkML has `slot_uri` and `meaning`. OWL *is* meaning. SQL DDL has a name, a type, and a handful of constraints — and no annotation slot at all.