💙 Supporting healthcare non-profits: Metadataloop is free for 6–12 months. Contact Us to get started.
Developer Utility

Schema Inferrer · CSV / JSON → CREATE TABLE

Paste a CSV (with header) or JSON array — get a typed CREATE TABLE statement for Postgres, MySQL, Snowflake, or SQL Server. Detects ints, decimals, booleans, dates, timestamps, UUIDs, and varchar lengths from your sample.

Format
Table name
Dialect
Input · CSV or JSON sample
Output · CREATE TABLE DDL
-- Output will appear here.

Convert CSV or JSON to a typed CREATE TABLE

Sometimes you only have a sample data file and need a starting-point schema. Paste a CSV with a header row or a JSON array of objects, and the Schema Inferrer analyses every column and emits a clean CREATE TABLE in your dialect of choice — no signup, no upload.

How type inference works

  • Integer detection: All non-empty values match -?\d+ → INT (or BIGINT if any value > 2³¹).
  • Decimal detection: Mixed integer/float → DECIMAL(18, n) with n based on the longest fractional sample.
  • Boolean detection: Recognises true/false, yes/no, t/f, y/n → BOOLEAN (or BIT on SQL Server).
  • Date / Timestamp: YYYY-MM-DD → DATE; ISO timestamps → TIMESTAMP (DATETIME on MySQL, TIMESTAMP_NTZ on Snowflake).
  • UUID: Standard 8-4-4-4-12 hex pattern → UUID (Postgres), UNIQUEIDENTIFIER (SQL Server), VARCHAR(36) elsewhere.
  • VARCHAR length: Falls back to the shortest power-of-two bucket that fits every observed value (16/32/64/128/255/512/1024); over 1024 chars → TEXT.
  • Nullable detection: Any empty / null / N/A value in a column flips it to nullable; otherwise NOT NULL.

Example — CSV input

id,first_name,email,age,signup_date,is_active
1,Alice,alice@x.com,30,2024-03-12,true
2,Bob,bob@y.io,42,2023-11-30,false
3,Carol,carol@z.net,,2024-06-15,true

Inferred PostgreSQL:

CREATE TABLE "users" (
  "id" INT NOT NULL,
  "first_name" VARCHAR(16) NOT NULL,
  "email" VARCHAR(16) NOT NULL,
  "age" INT,
  "signup_date" DATE NOT NULL,
  "is_active" BOOLEAN NOT NULL
);

Common use cases

Bootstrapping a new table

Drop a CSV from a vendor or partner, get an instant DDL starter.

JSON API ingestion

Paste a JSON array response from a third-party API and design the warehouse table.

Migrating between dialects

Use sample exports to scaffold target-side CREATE TABLE statements.

Onboarding analysts

Help non-DBAs propose schemas from spreadsheets they already understand.

FAQ

What dialects are supported? PostgreSQL, MySQL/MariaDB, Snowflake, and Microsoft SQL Server. Each gets dialect-correct identifier quoting and type names.

Does it upload my data anywhere? Only to this server, only for the inference call, and nothing is logged or stored. No third-party AI service is called.

How big a sample do I need? Even 10 rows is usually enough. More rows give tighter VARCHAR sizing and better nullability detection.

Can I tweak the output? Yes — copy the DDL and adjust VARCHAR lengths, switch INT to BIGINT, or rename columns. The tool gets you 90% of the way; the last 10% is your domain knowledge.

⚠ Confirm Delete