DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Sualeh Fatehi
Sualeh Fatehi

Posted on • Updated on

How to Visualize Your SQLite Database with One Command (and Nothing to Install)

Ever wondered what the tables in your SQLite database look like, and how they are related to each other? Generate a diagram of your SQLite database with one command. You can run this on any system that has Docker installed.

On a Linux system, run a command like:

docker run \
--mount type=bind,source="$(pwd)",target=/home/schcrwlr \
--rm -it \
schemacrawler/schemacrawler \
/opt/schemacrawler/bin/schemacrawler.sh \
--server=sqlite \
--database=chinook-database-2.0.1.sqlite \
--info-level=standard \
--command=schema \
--output-file=output.png
Enter fullscreen mode Exit fullscreen mode

The command assumes that a SQLite database called "chinook-database-2.0.1.sqlite" is in your current directory. A file called "output.png" will be generated with the database schema, including columns, data-types, and foreign key relationships.

If you are using PowerShell on Windows, replace the trailing backslash on each line with a back-tick, and map the current directory differently. Run this command:

docker run `
--mount type=bind,source="${PWD}",target=/home/schcrwlr `
--rm -it `
schemacrawler/schemacrawler `
/opt/schemacrawler/bin/schemacrawler.sh `
--server=sqlite `
--database=chinook-database-2.0.1.sqlite `
--info-level=standard `
--command=schema `
--output-file=output.png
Enter fullscreen mode Exit fullscreen mode

You can generate PDF files, and other types of output too. Go through the SchemaCrawler tutorials on Katacoda to learn more SchemaCrawler commands.

Top comments (2)

Collapse
adriens profile image
adriens

Go to killercoda.com/schemacrawler for up-to-date Schemacrawler course

Collapse
adriens profile image
adriens

Hi @sualeh : could you please provide us the killercoda version ?

Head to your account's Settings to...

🌚 Enable dark mode
πŸ”  Change your default font
πŸ“š Adjust your experience level to see more relevant content