draft

Snowflake schema diagrams from a DDL export

Three-part names, transient tables and constraints named before their kind — the shapes a Snowflake DDL export actually has.

Open the app

What the parser makes of it

The diagram

ACCOUNT ACCOUNT_ID number(38,0) PK NAME varchar(256) CREATED_AT timestamp_ntz(9) EVENT_LOG EVENT_ID number(38,0) PK ACCOUNT_ID number(38,0) FK EVENT_TYPE varchar(64) PAYLOAD variant LOADED_AT timestamp_ntz(9)
Drawn from the file below by draft render, on this page's build.

The file

This is the project's Snowflake test fixture, in full and unedited. Everything above was produced from it.

-- Snowflake: CREATE OR REPLACE TRANSIENT TABLE, three-part names, and
-- constraints named before their kind.

create or replace transient table ANALYTICS.PUBLIC.ACCOUNT (
    ACCOUNT_ID   number(38,0) not null primary key,
    NAME         varchar(256),
    CREATED_AT   timestamp_ntz(9) default current_timestamp()
);

create table if not exists ANALYTICS.PUBLIC.EVENT_LOG (
    EVENT_ID     number(38,0) not null,
    ACCOUNT_ID   number(38,0),
    EVENT_TYPE   varchar(64),
    PAYLOAD      variant,
    LOADED_AT    timestamp_ntz(9) default current_timestamp(),
    constraint PK_EVENT_LOG primary key (EVENT_ID),
    constraint FK_EVENT_ACCOUNT foreign key (ACCOUNT_ID)
        references ANALYTICS.PUBLIC.ACCOUNT (ACCOUNT_ID)
);

create or replace view ANALYTICS.PUBLIC.RECENT as
    select EVENT_ID from ANALYTICS.PUBLIC.EVENT_LOG where LOADED_AT > current_date();