SQL to ER Diagram
Home › BigQuery

BigQuery to ER Diagram

Turn a BigQuery query into a diagram. Paste a WITH … AS (…) CTE query and each CTE becomes a node, with edges inferred from the FROM / JOIN tables it reads — or paste plain CREATE TABLE DDL for a classic ER diagram.

Open the diagram tool →
No signup · nothing uploaded · export PNG / SVG / Mermaid / DBML · shareable link
ER diagram of the BigQuery example schema: customers, orders, customers_raw and orders_raw (4 tables, 3 relationships)
The BigQuery example below, drawn by the tool: customers, orders, customers_raw and orders_raw (4 tables, 3 relationships).

At a glance

What it is
SQL to ER Diagram is a free, open-source browser tool that turns a BigQuery CTE query or BigQuery DDL into an interactive diagram.
Input
A BigQuery WITH … AS (…) CTE query, or BigQuery CREATE TABLE DDL.
Output
An interactive diagram with one node per CTE or table and an edge for each table it reads, exportable as PNG or SVG.
Cost
Free. MIT-licensed open source. No account or signup.
Privacy
Runs entirely in your browser. The schema is never uploaded, and share links carry the diagram in the URL fragment, which is not sent to a server.
Limits
It never connects to your database itself: you paste schema text, or run one read-only catalog query in your own client and paste the result. There are no accounts, so there is no real-time multi-user editing; diagrams are kept in your browser, as a saved file, or as a share link. Layout stays smooth at around 300 tables.

How it works

  1. Copy a BigQuery WITH / CTE query, or your CREATE TABLE DDL.
  2. Paste it into the editor — BigQuery CTE queries are auto-detected.
  3. Each CTE becomes a node; columns come from its SELECT list, and FROM/JOIN references (including backtick project.dataset.table) are drawn as edges.
  4. Arrange, hide nodes, then export PNG/SVG or convert to Mermaid/DBML.

Example

A BigQuery CTE query like this:

WITH customers AS (
  SELECT id, email FROM `proj.shop.customers_raw`
),
orders AS (
  SELECT o.id, o.customer_id
  FROM `proj.shop.orders_raw` o
)
SELECT * FROM orders

…renders customers and orders as nodes, linked to the base tables they read from. Try it with your own →

Guide

This page does something the others don't: it diagrams queries, not just schemas. Paste a BigQuery WITH … AS (…) statement and each CTE becomes a node on the canvas — its columns inferred from the SELECT list — with edges drawn to every table or CTE it reads from, including backtick-quoted project.dataset.table references. It's a dependency graph of your query, laid out and exportable.

For schema diagrams, grab real DDL from INFORMATION_SCHEMA:

SELECT ddl FROM `mydataset.INFORMATION_SCHEMA.TABLES` t
JOIN `mydataset.INFORMATION_SCHEMA.TABLES_DDL_QUERY` …

— or simply bq show --schema --format=prettyjson per table and paste the CREATE TABLE form. Standard types (STRING, INT64, NUMERIC, STRUCT, ARRAY<STRUCT<…>>) render on the nodes.

Note that BigQuery doesn't enforce foreign keys — so a pure DDL paste gives you tables without edges. That's honest: use Infer links to draw the _id conventions, or diagram the CTE query that joins them to see the real relationships in use.

Why use it

BigQueryCTE / WITHSnowflakeSQL

FAQ

How do I visualize a BigQuery CTE query?

Paste your WITH … AS (…) query. Each CTE becomes a node, columns come from its SELECT list, and references to other CTEs or backtick-quoted project.dataset.table tables are drawn as edges.

Does it work with BigQuery CREATE TABLE DDL too?

Yes — paste standard CREATE TABLE statements and it draws a classic ER diagram with foreign-key relations.

Is my schema uploaded anywhere?

No. Everything runs locally in your browser — your schema is never uploaded to or stored on any server.

Is it free?

Yes. It is completely free and open source, with no account or sign-up required.

Related