The problem with writing GraphQL types by hand
You have a SQL schema with 20 tables. Your backend team wants a GraphQL API. Someone sits down and writes the SDL by hand — copying column names, converting VARCHAR(255) to String, BOOLEAN to Boolean, UUID to ID. Then the database schema changes and the SDL is already out of date.
SchemaForge converts SQL DDL to GraphQL SDL automatically. Each table becomes a type. Column types map to the correct GraphQL scalars. ENUMs become GraphQL enums. Nullable columns become optional fields. The conversion runs in under a second and produces output you can use directly or adjust as needed.
Quick start
1 — Install
# Install from GitHub (PyPI publishing pending)
pip install git+https://github.com/Coding-Dev-Tools/schemaforge.git
2 — Convert your SQL file
schemaforge convert --from sql --to graphql --input schema.sql --output schema.graphql
3 — Check the output
# schema.graphql — generated from your SQL DDL
type User {
id: ID!
email: String!
name: String
role: UserRole!
createdAt: String
}
enum UserRole {
admin
member
viewer
}
type Post {
id: ID!
authorId: ID!
title: String!
body: String
publishedAt: String
}
Each SQL table maps to a GraphQL type. NOT NULL columns become non-nullable fields (!). PRIMARY KEY UUID columns map to ID. ENUM columns generate a separate enum type. Function defaults like CURRENT_TIMESTAMP and gen_random_uuid() survive the conversion.
Type mapping reference
SchemaForge maps SQL column types to GraphQL scalars using a shared internal representation. Here's how the common types convert:
| SQL DDL Type | GraphQL Scalar | Notes |
|---|---|---|
VARCHAR(n), TEXT, CHAR(n) | String | — |
INTEGER, INT, SMALLINT, BIGINT | Int | — |
FLOAT, REAL, DOUBLE | Float | — |
BOOLEAN, BOOL | Boolean | — |
UUID | ID | Mapped to GraphQL's ID scalar |
TIMESTAMP, DATETIME, DATE, TIME | String | Custom DateTime scalar if preferred |
JSON, JSONB | JSON (custom scalar) | — |
DECIMAL(p,s), NUMERIC(p,s) | Float | — |
ENUM('a','b','c') | GraphQL enum type | Auto-generates separate enum definition |
BLOB, BYTEA | String | Encoded representation |
@relationship in Neo4j GraphQL or @link in Apollo Federation) are not generated automatically — SchemaForge converts table structures and column types. You add relationship semantics afterward based on your GraphQL server's conventions.
More conversion examples
Generate GraphQL from a Prisma schema
schemaforge convert --from prisma --to graphql --input schema.prisma --output schema.graphql
Convert GraphQL back to SQL DDL
# Bidirectional — graphql → sql is fully supported
schemaforge convert --from graphql --to sql --input schema.graphql --output schema.sql
Batch convert a directory of SQL files
schemaforge check --dir ./schemas/ --canonical sql
# Checks all schema files in the directory for consistency
# Use with --canonical to verify all formats roundtrip through a single source of truth
Diff two versions of your schema
# Catch breaking changes before they land in production
schemaforge diff schema-v1.sql schema-v2.sql
# Reports added/removed/modified tables, columns, indexes, and constraints
CI integration
Add schema consistency checks to your CI pipeline to catch drift early:
# .github/workflows/schema-check.yml (excerpt)
- name: Check schema consistency
run: |
pip install git+https://github.com/Coding-Dev-Tools/schemaforge.git
schemaforge diff schemas/current.sql schemas/expected.sql
schemaforge check --dir schemas/
schemaforge diff exits non-zero when it finds differences, so the job fails if the schemas diverge. Pair it with the check command to verify consistency across all formats in a directory.
VS Code extension
The SchemaForge VS Code extension lets you preview your schema converted to all 11 formats in a side panel as you edit. Open any .sql, .prisma, or .graphql file and run SchemaForge: Show Preview from the command palette to see the GraphQL SDL output live.
How SchemaForge compares
| Tool | SQL → GraphQL | GraphQL → SQL | Bidirectional (11 formats) | Local / offline | Free tier |
|---|---|---|---|---|---|
| SchemaForge | ✓ | ✓ | ✓ | ✓ | ✓ (CLI) |
| Hasura (hosted) | ✓ | — | — | Hosted SaaS | Free plan limited |
| graphql-code-generator | — | — | — | ✓ | ✓ (OSS) |
| prisma-to-graphql (custom scripts) | Partial | — | — | ✓ | ✓ (DIY) |
Comparison based on public documentation as of June 2026. Verify current feature sets before making tool decisions.
Pricing
GraphQL SDL import/export (including the sql → graphql direction) requires Individual or higher. The free tier covers convert and diff for basic format pairs.
| Plan | Price | GraphQL SDL | Batch mode | Alembic gen |
|---|---|---|---|---|
| Free | $0 | — | — | — |
| Individual | $15/mo ($12 billed annually) | ✓ | ✓ | ✓ |
| Suite (all 11 tools) | $49/mo ($39 billed annually) | ✓ | ✓ | ✓ |
| Team (up to 5) | $79/mo ($63 billed annually) | ✓ | ✓ | ✓ |
MIT license. No telemetry. Fully offline. No account required for the free tier.
Frequently asked questions
Can SchemaForge convert SQL to GraphQL automatically?
CURRENT_TIMESTAMP and gen_random_uuid().
What SQL dialects are supported?
CREATE TABLE, MySQL-specific options (ENGINE=InnoDB, AUTO_INCREMENT, DEFAULT CHARSET), inline ENUM columns, and table COMMENT. Function defaults (NOW(), gen_random_uuid()) are preserved using an internal fn: prefix convention so they survive roundtrips.
Does it handle relationships and foreign keys?
@link, Neo4j @relationship, etc.), so those are not auto-generated — you add them manually after the initial conversion, which takes seconds per relationship.
Can I convert GraphQL SDL back to SQL?
schemaforge convert --from graphql --to sql --input schema.graphql works the same as the reverse. Roundtrips go through a shared internal representation with zero data loss.
Is the GraphQL SDL output standard?
Is SchemaForge free?
convert and diff for individual use at a rate limit. GraphQL SDL import/export, batch directory conversion, and Alembic migration generation require Individual ($15/mo) or higher. MIT license, no telemetry, fully offline — no account required for the free tier.
Can I use SchemaForge in an AI coding agent?
schemaforge mcp) that exposes convert, diff, check, formats, and detect_format as tools. It works with Claude Code, Cursor, and any MCP-compatible AI client. Install with pip install "schemaforge[mcp] @ git+https://github.com/Coding-Dev-Tools/schemaforge.git".