Skip to main content

Schema Importing

Drafta allows importing schema definitions from various formats, making it easy to migrate existing schemas or integrate with other systems. Supported import formats include:

  • SQL DDL
  • JSON Schema
  • Spark Schema

Importing SQL DDL

Drafta can parse SQL CREATE TABLE statements and convert them into Drafta schema format.

Example:

SQL DDL Input:

CREATE TABLE Users (
id VARCHAR(255),
name VARCHAR(255),
age INT,
is_active BOOLEAN
);

Converted Drafta Schema:

Users:
id: string
name: string
age: number
is_active: boolean

Importing JSON Schema

Drafta supports importing JSON Schema, commonly used in APIs and data validation.

Example:

JSON Schema Input:

{
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"age": { "type": "number" },
"isActive": { "type": "boolean" }
}
}

Converted Drafta Schema:

User:
id: string
name: string
age: number
isActive: boolean

Importing Spark Schema

Drafta also supports importing Apache Spark schemas, used for big data processing.

Example:

Spark Schema Input:

[
{ "name": "id", "type": "string" },
{ "name": "name", "type": "string" },
{ "name": "age", "type": "integer" },
{ "name": "is_active", "type": "boolean" }
]

Converted Drafta Schema:

User:
id: string
name: string
age: number
is_active: boolean