Dataset
Database schema and migration datasets for AI training
A database schema dataset is the definition of a production database together with the record of how it changed: ordered migration scripts, DDL snapshots, constraints, indexes, views, triggers and stored procedures in T-SQL, PL/SQL or PL/pgSQL, with the review and rollback record for each change. SourceX sources these to a buyer's spec from established businesses that keep them in migration tools such as Flyway, Liquibase and Alembic or in database source control. The scope is schema and logic, not row data, which the buyer confirms in the license. Each dataset is de-identified and licensed for an agreed permitted use.
Dataset manifest
Sourced to your spec- What it is
- Production schema definitions with the migration chain, procedural code and the review and rollback record
- Typical systems
- Flyway, Liquibase, Alembic, Rails and Django migrations, SQL Server Data Tools, Redgate SQL Source Control
- Typical history
- Set by the buyer; a chain can run from a first baseline to the current schema
- Modality
- SQL and procedural source files, migration tool metadata, review and change-ticket text
- Delivery formats
- Migration files in original order and naming, DDL snapshots per release, JSONL metadata per migration and object
- Preparation
- Row data out of scope; ask how seed and lookup inserts were screened; credentials, connection strings, hostnames and author names removed or replaced
- Licensing
- Scoped per database or application; permitted use agreed per license; vendor-owned objects stay outside it
- Availability
- Sourced to your spec; supply is not guaranteed and depends on what history the partner kept
What a delivery contains
Fields vary by source system and are fixed per order. A typical delivery includes:
| Field | Type | What it holds |
|---|---|---|
| migration_id | string | Pseudonymous ID of one migration, stable across the delivery. |
| sequence | object | Version or revision identifier as the tool recorded it, and the order actually applied, which can differ from file order. |
| tool | object | Migration tool, target engine and dialect, original file name and type: versioned, repeatable, baseline or undo. |
| up_script | string | Forward script exactly as run, with batch separators, session settings and tool directives kept. |
| down_script | string | Rollback script, or null with the reason: never written, irreversible, or restore from backup. |
| operations | array | Parsed statements with operation kind, target object and options such as CONCURRENTLY, ONLINE or NOT VALID. |
| phase | object | Expand, backfill, switch, contract or standalone, plus the rollout group that ties the steps of one change together. |
| objects_after | object | Reference to the DDL snapshot after this migration: tables, columns, constraints, indexes and views. |
| routines | array | Stored procedures, functions, triggers and packages created or replaced, with body and the objects each reads and writes. |
| review | object | Pull request or change-ticket text, reviewer roles, comments and the database administrator sign-off. |
| apply_history | array | Per environment: when applied, duration, success flag and the checksum in the tool's history table. |
| rollback_events | array | Each time the migration was reverted, repaired or re-run, with the cause and what followed. |
| seed_data_screen | object | Whether the script carried INSERT or load statements, how the rows were classified and what was removed. |
Field names from the table above; values are masked placeholders.
Example record
{
"migration_id": "mig_7c41e9",
"sequence": {
"version": "214",
"applied_rank": 219,
"note": "applied after hotfix 215"
},
"tool": {
"name": "flyway",
"engine": "postgresql",
"file": "V214__ord_hdr_sync_fulfil_region.sql",
"type": "versioned"
},
"up_script": "CREATE OR REPLACE FUNCTION ord_hdr_sync_region() RETURNS trigger AS $$\nBEGIN\n IF NEW.fulfil_region_cd IS NULL THEN\n NEW.fulfil_region_cd := (SELECT region_cd FROM whse_ref WHERE whse_cd = NEW.whse_cd);\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;\n\nCREATE TRIGGER trg_ord_hdr_sync_region\n BEFORE INSERT OR UPDATE ON ord_hdr\n FOR EACH ROW EXECUTE FUNCTION ord_hdr_sync_region();",
"down_script": "DROP TRIGGER trg_ord_hdr_sync_region ON ord_hdr;\nDROP FUNCTION ord_hdr_sync_region();",
"operations": [
{
"op": "create_function",
"object": "ord_hdr_sync_region"
},
{
"op": "create_trigger",
"object": "trg_ord_hdr_sync_region",
"table": "ord_hdr"
}
],
"phase": {
"step": "expand",
"rollout_group": "chg_region_split",
"position": "2 of 6"
},
"objects_after": {
"snapshot": "snap_0214",
"tables_changed": [
"ord_hdr"
]
},
"routines": [
{
"name": "ord_hdr_sync_region",
"kind": "trigger_function",
"reads": [
"whse_ref"
],
"writes": [
"ord_hdr"
]
}
],
"review": {
"change_ref": "CHG-[ID]",
"comments": [
{
"role": "dba",
"text": "Fires on every update of a hot table. Put the trigger drop in the contract step so it does not outlive the rollout."
}
],
"approved_by_roles": [
"dba",
"service_owner"
]
},
"apply_history": [
{
"env": "production",
"applied_at": "2022-05-11T06:30:40Z",
"duration_ms": 97,
"success": true,
"checksum": -1193820457
}
],
"rollback_events": [],
"seed_data_screen": {
"contains_inserts": false,
"rows_removed": 0
}
}Synthetic record for illustration. Field names, structure and format are agreed per order.
What AI teams use it for
Text-to-SQL on realistic schemas
Hundreds of tables with abbreviated names, missing keys and overloaded columns give schema linking a harder and truer target than benchmark databases.
Writing and reviewing migrations
A schema state, a requested change, the migration written for it, the review comments and the production outcome form one supervised example.
Translating procedural SQL
Procedures, packages and triggers support dialect translation, and partners that moved engines can hold both versions of a routine.
Explaining why a schema is the way it is
The chain ties each column, constraint and index to the change that introduced it, for documentation and onboarding assistants.
Evaluating safe-change judgment
Failed, reverted and repaired migrations test whether a model spots a blocking lock or a rollback that loses data.
Use-case guides: Coding agents, Private evaluation sets, Enterprise and computer-use agents
What makes this data valuable
Replayable chain
Running the migrations in order from the stated baseline reproduces the delivered snapshot.
Linked multi-step changes
Expand, backfill and contract steps carry a shared rollout group, so one change can be read as a whole.
Rollbacks that were used
Down scripts exist, and the record shows which were run in an environment and which were only written.
Production execution history
Applied order, duration and failure flags come from the tool's own history table, not from file names.
Review on record
Reviewer comments and sign-off explain why a step was split, delayed or rewritten.
Resolved routine dependencies
Each procedure and trigger lists the objects it touches, and unresolved references are flagged.
Document stack
Database schema dataset
Why production schemas do not look like benchmark schemas
A schema that has run a business for many years does not look like the schemas in the best-known public text-to-SQL benchmarks, which are mostly small and cleanly named. A production database can have hundreds of tables. Names were abbreviated to fit old identifier length limits and never widened, so the order header is ord_hdr and the customer key is cust_no in one table and customer_id in the next. A status column holds codes defined only in a CASE expression inside a procedure, and spare columns named attr1 to attr20 mean something different for each product line.
The shortcuts are just as real. A customer name is copied onto the order row so a report can skip a join. Foreign keys are missing because a bulk load ran faster without them, or were added without checking existing rows. A snapshot shows these as noise. The migration chain shows them as decisions: the script that added the second address column, the ticket that asked for it, the backfill that covered part of the table, and the review comment explaining that the old column stays because a nightly export still reads it.
Much of the business logic lives here too. Posting, pricing and period-close rules often sit in stored procedures: long T-SQL batches with temp tables, cursors and dynamic SQL built by string concatenation, Oracle packages split into a specification and a body, and triggers that fire other triggers. A query log shows how analysts read a schema, and application code shows how a service calls it. Neither shows how the schema came to be.
What live data does to a schema change
A migration is written under a constraint application code never has: the table already holds rows, and old and new versions of the application are both connected while it runs. So a rename is not one statement. The usual pattern is expand, backfill and contract. Add the new column as nullable and keep it in step with the old one, by dual writes in the application or by a trigger. Copy existing rows across in batches by key range, so no transaction holds locks for long. Switch reads, and only in a later release drop the old column. Each step is its own migration file, and nothing in the files says they are one change unless the dataset links them.
The engine decides what a safe step looks like. In PostgreSQL an index on a busy table is built with CREATE INDEX CONCURRENTLY, which cannot run inside a transaction block, so the migration tool's transaction wrapper is switched off for that file. A foreign key is added NOT VALID and validated in a second statement. MySQL teams often run large alterations through gh-ost or pt-online-schema-change, which build an altered copy of the table, fill it in chunks while writes continue and then swap it in. Oracle and MySQL commit around each DDL statement implicitly, so a script that fails halfway leaves the schema half changed, where PostgreSQL can roll most DDL back inside a transaction.
Rollbacks are the other distinctive part. A down script can put a dropped column back but not its contents, so many are marked irreversible or replaced by a forward fix. What really happened is in the tool's history table and the change record: the migration that failed in production after passing in staging, the checksum repaired after someone edited an applied file, the hotfix applied out of order. Scripts alone do not show which steps ran long, failed or were reverted.
What to check before licensing
- Confirm in the license that the delivery is schema and logic only, with no row data, and search the sample for INSERT, COPY, BULK INSERT and MERGE statements that carry rows.
- Ask how seed and lookup data was screened. Status codes are reference data. Seeded users, employees, customers and test accounts are personal records and should be excluded.
- Replay the sample chain on an empty database of the stated engine, compare the result with the delivered snapshot, and ask which baseline replaces squashed early migrations.
- Count how many migrations have a down script, and ask which rollbacks were actually run in an environment.
- Ask whether the tool's history table from production is included, since it holds applied order, timing and failures.
- Search comments and dynamic SQL in the sample for credentials, connection strings, linked server names and hostnames.
- Ask how objects belonging to a packaged ERP or other vendor application were separated from the partner's own tables, and which procedures are encrypted or wrapped.
Delivery No files move before a signed license. A listing or a request grants no files by itself.
How licensing works through SourceX
- 1
Define
Send the domain, modality, volume, format, timeline and permitted use you need.
- 2
Source
SourceX identifies businesses that hold matching data and are open to licensing it.
- 3
Qualify
Fit, rights and quality are checked, and you review samples before committing.
- 4
License
Scope, permitted use, exclusivity, price and obligations are agreed in writing.
- 5
Deliver
Approved data is prepared, de-identified where required and transferred securely.
Questions Acquisition Partners ask
Does the dataset contain any rows from the tables?
It should not, and the license should say so. The scope is schema and logic only: DDL, migration scripts, views, triggers, procedures and their review and execution records. Migration scripts sometimes carry data, as INSERT statements that seed lookup tables or backfills with literal values, so ask how each script was screened. Reference rows such as status codes can be kept if you want them. Specify that rows describing people, customers or accounts are excluded, and search the sample yourself.
Which database engines and dialects can be requested?
Any engine a partner runs in production can be requested. SQL Server with T-SQL, Oracle with PL/SQL, PostgreSQL with PL/pgSQL and MySQL are typical. State the engine in your spec, because dialects differ in procedural syntax and in what DDL can run inside a transaction. Supply for a given engine is not guaranteed.
Can the migration chain be replayed to rebuild the schema?
Often, but not always from the first migration. Teams squash old migrations into a baseline and apply hotfixes by hand that never reach the migration folder, so a replayed schema can drift from production. Ask for the baseline the chain starts from and a DDL snapshot per release, then replay the sample and compare the two.
How is this different from a text-to-SQL dataset?
It is the schema side of the problem, without the questions. A text-to-SQL dataset pairs a natural-language request with a query. This data supplies realistic schemas with their history and procedural code, which suits migration writing and procedure translation. If you need question and query pairs against the same schemas, say so, since those come from query history and analytics tools and are scoped separately.
Are stored procedures delivered with the objects they depend on?
They should be, and it is worth writing into your spec. A procedure is only readable beside the tables, views, types and other routines it references, so ask for a dependency list per routine, resolved to objects in the same delivery. References into another database, a linked server or a vendor package cannot be resolved inside the delivery and should be flagged, not silently dropped.
What if the partner never used a migration tool?
Then the history has to be reconstructed, and it should be labeled as such. Many older databases were changed by hand-run scripts attached to change tickets, or by state-based tools that compare a project with the live schema and generate the difference. The record then comes from object scripts in source control, saved deployment scripts and the tickets. The order of changes is less exact, so ask which method applies to each database.
Related datasets
- SQL query logs paired with the business question
Analyst-run warehouse queries in session order, each with schema, run outcome and the paired business question
- Data pipeline code with run history
Pipeline and transformation code with commit history, run records, data-test results and lineage
- Legacy and rare-language codebases
Private production code in under-represented languages, with copybooks, job control, data definitions and change history
- Proprietary codebases with full history
Complete private repositories with full version history, build files, tests and docs
- Dependency upgrade and framework migration histories
The plan, ordered pull requests, codemods, shims, CI results and incidents of one large upgrade in a private codebase
Evaluating this data for procurement?
Diligence packets are prepared per dataset. Rights, privacy processing and quality differ between datasets.
Request dataset diligenceTell us what your models need
Send your spec — domain, volume, format, timeline and permitted use — and SourceX will match it against partner data and come back with what can be licensed.
Updated 25 November 2026.