{
  "slug": "schema-inferrer",
  "name": "gizza-ai/schema-inferrer",
  "version": "0.1.0",
  "title": "Schema Inferrer — JSON Schema & SQL CREATE TABLE from Sample Data — gizza.ai",
  "description": "Infer JSON Schema and SQL CREATE TABLE from CSV or JSON samples. Detect column types, nullability, and formats locally in your browser.",
  "tags": [
    "schema inferrer",
    "json schema generator",
    "infer json schema",
    "create table generator",
    "json to json schema",
    "csv to sql schema",
    "infer sql schema",
    "data type inference",
    "ddl generator"
  ],
  "category": "data",
  "urls": {
    "page": "https://gizza.ai/tools/schema-inferrer/",
    "markdown": "https://gizza.ai/tools/schema-inferrer/index.md",
    "descriptor": "https://gizza.ai/tools/schema-inferrer/tool.json",
    "deep_link_example": "https://gizza.ai/tools/schema-inferrer/?data=id%2Cemail%2Cscore%2Cactive%2Cjoined%0A1%2Ca%40example.com%2C9.5%2Ctrue%2C2024-01-02%0A2%2Cb%40example.com%2C7%2Cfalse%2C2024-02-10&format=auto&delimiter=auto&has_header=true&output=both&table=users&dialect=postgres&draft=2020-12&primary_key=id&not_null=true&detect_formats=true"
  },
  "cli": "gizza tool schema-inferrer \"id,email,score,active,joined\n1,a@example.com,9.5,true,2024-01-02\n2,b@example.com,7,false,2024-02-10\"",
  "tool": {
    "description": "From a sample dataset — CSV/delimited text or JSON records — infer a per-column type and nullability, then emit a standard JSON Schema (Draft 2020-12 or Draft-07) and/or a SQL CREATE TABLE statement. Type inference recognizes integer, float, boolean, date, and datetime columns (zero-padded codes like ZIP codes stay text); the JSON Schema maps them to integer/number/boolean/string (dates via the date/date-time format) and can tag email/uri/uuid/ipv4 string formats, while the CREATE TABLE maps them to the chosen dialect's column types (mysql, postgres, sqlite, mssql, ansi). Columns present in every record become required / NOT NULL; an optional PRIMARY KEY is marked in both outputs. Use the output option to get both artifacts, just the JSON Schema, or just the SQL. Emits schemas only — no INSERT rows.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "data": {
          "description": "The sample dataset to infer a schema from: CSV/delimited text with a header row, or JSON (an object = one record, or an array of record objects). Example CSV: \"id,name\\n1,Alice\\n2,Bob\". Column/field names come from the header (CSV) or object keys (JSON).",
          "type": "string"
        },
        "delimiter": {
          "default": "auto",
          "description": "CSV field delimiter. 'auto' (default) sniffs comma/semicolon/tab/pipe by picking the most consistent column count. Ignored for JSON input. Default auto.",
          "enum": [
            "auto",
            "comma",
            "tab",
            "semicolon",
            "pipe"
          ],
          "type": "string"
        },
        "detect_formats": {
          "default": true,
          "description": "Tag text columns whose values all match a known JSON Schema string 'format' (email, uri, uuid, ipv4). Date/datetime columns always get date/date-time regardless. Default true.",
          "type": "boolean"
        },
        "dialect": {
          "default": "postgres",
          "description": "SQL dialect for CREATE TABLE. Sets identifier quoting (mysql=`backticks`, postgres/sqlite/ansi=\"double quotes\", mssql=[brackets]) and column types (e.g. float → DOUBLE/DOUBLE PRECISION/REAL/FLOAT, boolean → BOOLEAN/TINYINT(1)/BIT, datetime → TIMESTAMP/DATETIME). Default postgres.",
          "enum": [
            "mysql",
            "postgres",
            "sqlite",
            "mssql",
            "ansi"
          ],
          "type": "string"
        },
        "draft": {
          "default": "2020-12",
          "description": "JSON Schema dialect to emit. '2020-12' (default) or 'draft-07'. Affects the $schema URL and whether a 'uuid' string format is emitted (Draft-07 has no uuid format). Default 2020-12.",
          "enum": [
            "2020-12",
            "draft-07"
          ],
          "type": "string"
        },
        "format": {
          "default": "auto",
          "description": "How to parse the input. 'auto' (default) treats text starting with { or [ as JSON, otherwise CSV. Force 'csv' or 'json' to override. Default auto.",
          "enum": [
            "auto",
            "csv",
            "json"
          ],
          "type": "string"
        },
        "has_header": {
          "default": true,
          "description": "Treat the first CSV row as column names. When false, columns are named column_1, column_2, … Ignored for JSON input (keys are always the columns). Default true.",
          "type": "boolean"
        },
        "not_null": {
          "default": true,
          "description": "Emit NOT NULL in CREATE TABLE (and list under JSON Schema 'required') for every column that had a value in every row. When false, columns are left nullable unless they are the primary key. Default true.",
          "type": "boolean"
        },
        "output": {
          "default": "both",
          "description": "Which artifact to emit. 'both' (default) returns the JSON Schema followed by the SQL CREATE TABLE; 'json-schema' returns only the JSON Schema; 'sql' returns only the CREATE TABLE. Default both.",
          "enum": [
            "both",
            "json-schema",
            "sql"
          ],
          "type": "string"
        },
        "primary_key": {
          "description": "Name of the column to mark as PRIMARY KEY in CREATE TABLE (and treat as required/NOT NULL in both outputs). Must be one of the columns. Optional.",
          "type": "string"
        },
        "table": {
          "default": "my_table",
          "description": "Table name for CREATE TABLE and the JSON Schema 'title' (default \"my_table\"). May be schema-qualified like \"public.users\" — each dot-separated part is quoted independently in the SQL.",
          "type": "string"
        }
      },
      "required": [
        "data"
      ],
      "type": "object"
    }
  }
}