Docs

Embed diagram in URL

You can open a diagram in /draw directly from a URL — by embedding SQL or a schema patch in the link. This is how AI assistants, blog posts, and documentation can link straight to an editable diagram.

From SQL (DDL)

Pass a CREATE TABLE statement as the ddl parameter. The SQL is parsed and visualized automatically.

 https://drawsql.app/draw#ddl=CREATE%20TABLE%20users%20(id%20BIGINT%20PRIMARY%20KEY,%20email%20VARCHAR(255)%20NOT%20NULL);

Add ?driver=pgsql or ?driver=sqlsrv to parse for PostgreSQL or SQL Server. MySQL is the default. If no driver is specified, DrawSQL auto-detects from the SQL syntax.

When to use which format

  • #ddl= — best for short SQL and plain-text responses. Works everywhere, no API needed.

  • #patch= — best for AI-generated schemas. Applied instantly in the browser, no server round trip.

  • Manual paste — open /draw directly and paste SQL yourself.

Use with AI assistants

If ChatGPT, Claude, or another AI gives you SQL, you can turn it into an editable diagram immediately.

  1. Ask your AI assistant for SQL DDL for your app or feature.

  2. Open drawsql.app/draw.

  3. Paste the SQL into the import flow, or open a DrawSQL link if the AI provided one.

  4. Move tables around, edit columns, and keep working from there.

Prompt ideas

  • "Design a PostgreSQL schema for a SaaS app with organizations, projects, tasks, and comments. Return SQL DDL and a DrawSQL link if possible."

  • "Take this SQL and make it easier to understand. Give me an ERD-friendly DrawSQL link."

  • "Generate MySQL CREATE TABLE statements for a billing system, then format them as a DrawSQL instant diagram link."

Still have a question? We'd love to help!