Generate DBML from SQL Database

dbdocs now provides a more direct way to generate DBML code from your database using the db2dbml command. This capability allows you to skip the need for manual drafting or conversion from SQL dumps, keep your documentation process simple, and ensure your DBML reflects the most current database structure.


dbdocs-generate-dbml-from-db-feature

Is it safe to allow dbdocs CLI to connect to my database? Yes

  • Everything runs on your local machine, and the database credentials are not tracked or sent anywhere.
  • The database connection is secured.
  • The code is open source from the @dbml/cli & @dbml/connector packages and can be checked here.

Supported databases: PostgreSQL, MySQL, MSSQL, Snowflake, BigQuery.

For more details, check out our doc here.

For the latest update on new features, make sure to follow us on our social media: :bird: X (TWITTER) - :luggage: LINKEDIN

Thank you for your continued support and trust in our products.
From dbx team with :heart:

1 Like

If you are working on dbdiagram, make sure to use the Import > From Database Connection (via CLI) option to get a detailed guide on how to connect to your database and generate the DBML code.

dbdiagram-generate-dbml-from-direct-db-connection

Cheers :beers:

1 Like

Hi @Thi_Nguyen
Does this work on Redshift since it’s based on Postgres? I’m asking because I received the following error when trying to generate the DBML file:

Error: column c.identity_increment does not exist.

Thank you

Hi @Khoa_Nguyen,

I’m Huy Phung from the dbdiagram team.

Amazon Redshift does not use the same INFORMATION_SCHEMA as PostgreSQL. While Redshift is based on PostgreSQL 8.0.2, it has its own set of system tables and views.

So, we will consider to support fetching metadata from Redshift connection in the future.

Best Regards
Huy Phung