Automatically create Flatfile Blueprints from SQL Data Definition Language (DDL) files to streamline database schema imports.
CREATE TABLE
script), parses it to identify table structures, and converts each table into a corresponding Sheet configuration with appropriate fields. This is ideal for use cases where a data import process needs to match an existing database schema, saving significant manual configuration time. It is designed to be used in a server-side listener, typically on the space:configure
event.
setupFactory
object passed to the configureSpaceWithSqlDDL
function.
PartialWorkbookConfig
object contains:
PartialSheetConfig
object contains:
Flatfile.spaces.SpaceConfig
.
setupFactory
object to be fully defined. It will:
source
propertyslug
slug
doesn’t correspond to any table found in the SQL fileslug
doesn’t match any table in the SQL file, you’ll see a console error:
Schema not found for table name accounts
Solution: Ensure the slug
property exactly matches the table name in your SQL DDL file.
source
property cannot be read, a hard error will be thrown.
Solution:
source
property must be a file path relative to the project’s root directoryslug
property must exactly match table names in your SQL DDL file for proper field generationNOT NULL
columns and other constraints from DDL and translates them into Flatfile field constraintssql-ddl-to-json-schema
and @flatfile/plugin-convert-json-schema
internally (no separate installation required)