I was recently responding to a question about DBeaver and the ability to automatically generate an ERD. The following post will walk you through the process.
;TLDR
Looking for an easy way to create one of these?
Let’s create 3 simple tables. A parent table with a primary key constraint and two additional tables with foreign key constraints that point to the same columns as the parent table’s primary key constraint.
create schema ERD; use schema ERD; create table parent ( col1 integer not null, col2 integer not null, constraint parentkey_1 primary key (col1, col2) not enforced ); create table child1 ( col_a integer not null, col_b integer not null, constraint childkey_1 foreign key (col_a, col_b) references parent (col1, col2) not enforced ); create table child2 ( col_a integer not null, col_b integer not null, constraint childkey_2 foreign key (col_a, col_b) references parent (col1, col2) not enforced );
Launch DBeaver and connect to your Snowflake Data Warehouse by filling in required information with your Snowflake account information. Note, that after you enter your account information, you can click the Test Connection and it will populate the Database, Warehouse, and Schema dropdowns allowing you to select from there.
Now that we are connected to Snowflake, we can use the code to create the tables that are the foundation of our ERD.
After running the script, we can now see the new schema and three tables have been created in the Snowflake Database.
Finally, double click on the HR Schema name, the one created earlier, and DBeaver will generate the ERD for you.
Enjoy!