For reverse engineering an existing Snowflake schema and generating DDL, the best fit is a dedicated data modeling tool like ER/Studio Data Architect, Erwin Data Modeler, or SqlDBM, because they read live Snowflake metadata and produce accurate DDL scripts. If your team already uses dbt, its built-in dbt run-operation and dbt docs can reverse-engineer models but not raw tables, so for pure DDL generation from an existing database, a traditional modeling tool is more direct. This article explains what each tool does, how they compare, and how to choose based on your workflow.
What Reverse Engineering Means for Snowflake
Reverse engineering in data modeling means connecting to a live Snowflake account and pulling the actual table definitions, columns, data types, primary keys, foreign keys, and relationships into a visual diagram. The tool then lets you regenerate DDL that matches the current state of the database. This is different from forward engineering, where you design a model first and then generate DDL to create new tables.
For Snowflake specifically, reverse engineering must handle:
- Snowflake’s three-level namespace: database, schema, and table. A tool must let you select multiple schemas and databases.
- Data types like
VARIANT,OBJECT,ARRAY, andGEOGRAPHYthat are not in traditional relational databases. - Clustering keys and table comments that are part of the DDL but often ignored by generic tools.
- Time travel and transient tables, which are Snowflake-specific and may not be captured by all tools.
How the Tools Work
Most data modeling tools connect to Snowflake via JDBC or ODBC drivers. You enter your account URL, username, and password (or key-pair authentication), and the tool queries Snowflake’s INFORMATION_SCHEMA to read table and column metadata. Some tools also read SHOW TABLES and SHOW PRIMARY KEYS outputs. The tool then builds an entity-relationship diagram (ERD) and lets you edit it. When you finish, the tool generates a DDL script that can be run directly in Snowflake.
Key differences among tools are in how they handle relationships. Snowflake does not enforce foreign keys by default, so a tool that relies on declared FKs will find few or none. Better tools infer relationships from column names (e.g., customer_id in an orders table) or let you manually define them. This inference is critical for reverse engineering a Snowflake environment where FKs are often absent.
Tool Comparison: Which One Fits?
Here is a practical comparison of the most common tools used for Snowflake reverse engineering and DDL generation:
- Erwin Data Modeler – Mature, enterprise-grade. It has direct Snowflake support, including reverse engineering from a live connection, and generates DDL with Snowflake-specific syntax. It handles VARIANT and other semi-structured types. Steep learning curve and licensing cost.
- ER/Studio Data Architect – Similar to Erwin, with strong Snowflake support. It can reverse engineer multiple schemas and generate DDL. It also has a free community edition for smaller projects. Good for teams already using Embarcadero tools.
- SqlDBM – A cloud-based tool designed for Snowflake and other modern warehouses. It integrates natively with Snowflake, supports reverse engineering, and generates DDL that includes clustering keys. It is easier to use and cheaper than Erwin, but less powerful for complex enterprise modeling.
- dbt – Not a traditional modeling tool, but if your data pipeline is dbt-based, you can use
dbt run-operationto generate DDL for models. For reverse engineering raw tables, you would need to write queries against INFORMATION_SCHEMA. It is not a visual diagram tool. - Snowsight – Snowflake’s own web UI can show table DDL via
SHOW CREATE TABLE, but it does not build diagrams or manage relationships. It is a quick way to get DDL for a single table, not a modeling tool.
How to Choose the Right Tool
Consider your team’s workflow and budget:
- If you need visual diagrams for documentation and stakeholder communication, choose Erwin or ER/Studio. They produce professional ERDs.
- If you want a lightweight, cloud-based tool that integrates with Snowflake and is easy to learn, SqlDBM is a strong candidate.
- If your team is already using dbt and you only need DDL for models, use dbt’s built-in commands. For raw tables, write a script to query INFORMATION_SCHEMA and generate DDL.
- If you just need a quick DDL for one table without any modeling, use
SHOW CREATE TABLEin Snowsight.
Also consider whether you need to reverse engineer all schemas or just a few. Some tools have limits on the number of objects in free versions. Check that the tool supports Snowflake’s OAuth or key-pair authentication if you cannot use passwords.
Common Problems and How to Avoid Them
Reverse engineering Snowflake often hits these issues:
- Missing foreign keys – As noted, Snowflake does not enforce FKs. Tools that rely on them will show no relationships. Use a tool that infers relationships from naming conventions, or manually define them.
- Unsupported data types – Some older tools may not recognize
VARIANTorGEOGRAPHY. Ensure the tool’s version supports Snowflake’s latest types. - Schema selection – Snowflake has many schemas. If you connect to a database, you may need to select specific schemas; some tools reverse engineer all schemas by default, which can be overwhelming.
- DDL syntax errors – Generated DDL may include syntax that Snowflake does not accept (e.g.,
ON UPDATEclauses). Always test the DDL in a development environment before running in production. - Clustering keys – If your tables use clustering, the tool must capture the clustering key in the DDL. Not all tools do this correctly; verify the generated DDL includes
CLUSTER BY.
Cost and Licensing Considerations
Erwin and ER/Studio are commercial products with per-user licenses that can cost thousands of dollars per year. SqlDBM offers subscription pricing with a free tier for small projects. dbt is open-source (free) but requires engineering effort to build DDL generation scripts. Snowsight is free with your Snowflake account but offers no modeling features.
If you are a small team or a startup, SqlDBM or ER/Studio’s free community edition may be the most cost-effective. For large enterprises with existing governance requirements, Erwin’s integration with data catalogs and metadata management may justify the cost.
Alternatives: Scripting Your Own Reverse Engineering
If you prefer a code-based approach, you can write a script in Python or SQL to query Snowflake’s INFORMATION_SCHEMA.COLUMNS and generate DDL. This gives you full control and is free, but requires maintenance. A simple example:
SELECT 'CREATE OR REPLACE TABLE ' || TABLE_SCHEMA || '.' || TABLE_NAME || ' (' || LISTAGG(COLUMN_NAME || ' ' || DATA_TYPE, ', ') WITHIN GROUP (ORDER BY ORDINAL_POSITION) || ');' AS DDL
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'PUBLIC'
GROUP BY TABLE_SCHEMA, TABLE_NAME;
This generates basic DDL without keys or constraints. You would need to expand it to include primary keys, clustering, and comments. Tools like snowddl (an open-source project) can automate this more robustly, but they are not as user-friendly as a GUI tool.
Frequently Asked Questions
Can I use dbt to reverse engineer existing Snowflake tables?
dbt is not designed for that. dbt works with SQL models that you write, and it can generate DDL for those models, but it cannot introspect existing tables and produce a diagram or DDL for them. You would need to write a custom script or use a modeling tool.
Does Snowflake have a built-in data modeling tool?
No. Snowsight provides a SHOW CREATE TABLE command that returns DDL for a single table, but it does not create diagrams or manage relationships. For that, you need a third-party tool.
Which tool handles Snowflake’s VARIANT data type best?
Erwin, ER/Studio, and SqlDBM all support VARIANT. However, the way they display it in diagrams may differ. SqlDBM has native Snowflake integration, so it tends to handle VARIANT and other semi-structured types more cleanly.
Is it safe to run generated DDL directly in production?
Always review the DDL first. Generated DDL may include DROP TABLE statements or alter columns in ways that could cause data loss. Test in a staging environment and use CREATE OR REPLACE cautiously.
Can I reverse engineer only specific schemas?
Yes, most tools let you select schemas during the connection setup. In Erwin and ER/Studio, you choose your databases and schemas. In SqlDBM, you connect and then select the schemas you want to import.
What is the cheapest way to get DDL for a Snowflake table?
Use SHOW CREATE TABLE in Snowsight. It is free and gives you the exact DDL. For multiple tables, write a simple SQL query against INFORMATION_SCHEMA to generate DDL scripts.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Valheim Server Not Showing in Community List Fixes
- Soundbar vs 2.1 Speaker System: Which Is Better?
- DisplayPort vs HDMI: Which Cable Should You Use?
- Survive Lava for Brainrot Tier List170 points
- MySQL Dump Import: Fix Common Errors
- Mouse Moving on Its Own? Causes & Fixes