EntityModel.comDocs
Contents

Start here

Guides

Examples

Platforms

Compare

Reference

Learn

Import from a database

EntityModel.com can build a model from an existing database schema. In the browser it does this without ever connecting to your database: it writes a metadata query, you run it in your own SQL tool, and you paste the result back.

In the browser

  1. In a model, choose Import → From a database.
  2. Pick the platform (Databricks, Snowflake, PostgreSQL or MySQL) and enter the catalog or database and the schema.
  3. Copy the generated query. It reads only metadata from the platform's information schema: tables, columns, types, keys and comments.
  4. Run it in your usual tool (a Databricks notebook or SQL editor, Snowsight, psql, a MySQL client) and copy the result grid.
  5. Paste the result back. Tables become entities and foreign keys become relationships, with the same lookup-table and junction-table handling as SQL import.

Because you run the query, the app never sees a host name, a password or a token.

Track schema changes

The first import of a schema becomes a Physical tab. Each later import of the same schema becomes a new, dated version tab derived from the previous one. Then:

  • Compare shows tables and columns added, removed, renamed or retyped between the two versions.
  • Migration SQL writes the ALTER/CREATE/DROP statements between them.

See Derive, compare and migrate tabs.

From the command line (local)

With a local checkout, em pull reads the schema directly. Credentials come from your environment or the platform's own CLI profile and are never stored in the model.

# Databricks Unity Catalog, through the REST API and your Databricks CLI profile
node bin/em.mjs pull sales --from databricks --catalog main --schema sales [--profile P]

# Snowflake SQL API: SNOWFLAKE_ACCOUNT + SNOWFLAKE_TOKEN,
# or SNOWFLAKE_USER + SNOWFLAKE_PRIVATE_KEY_PATH
node bin/em.mjs pull sales --from snowflake --catalog ANALYTICS --schema SALES

# PostgreSQL, through psql
node bin/em.mjs pull sales --from postgres --url postgres://… --schema public

# A query result you ran yourself, saved as CSV
node bin/em.mjs catalog-query --platform snowflake --catalog DB --schema S   # print the query
node bin/em.mjs pull sales --csv result.csv --platform snowflake

Add --propose to turn the pull into a proposal you review in the app instead of applying it directly.

Next steps

Frequently asked questions

Does EntityModel.com need my database password?

No. In the browser it gives you a metadata query to run in your own SQL tool and reads the pasted result. The command-line pull uses credentials from your environment or CLI profile and never writes them to the model.

Can I reverse-engineer Databricks Unity Catalog tables into an ERD?

Yes. Choose Databricks in Import → From a database, run the generated information-schema query in Databricks, and paste the result; or run em pull --from databricks locally. Primary and foreign key constraints become keys and relationships.