#sqlite #graphviz #database-schema

bin+lib visualize-sqlite

A simple way to draw a diagram from an sqlite database

6 releases (stable)

2.0.0 Aug 29, 2022
2.0.0-rc.0 Jul 4, 2022
1.1.1 Jul 9, 2021
1.1.0 Jul 2, 2021
1.0.1 Jul 1, 2021

#1957 in Database interfaces

24 downloads per month

MIT license

305KB
181 lines

Visualize an sqlite database

Create simple visualizations of sqlite databases in GraphViz dot format.

This version only works with the 2.0 version of diesel. Use version 1.x of this crate if you need compatibility with an older diesel version.

CLI

visualize-sqlite your_sqlite_database.db | dot -Tpng -Gfontname='Fira Mono' -Gfontcolor='#586e75' -Gbgcolor='#fdf6e3' -Nfontname='Fira Mono' -Nfontcolor='#586e75' -Efontname='Fira Mono' > output.png

API

use diesel::SqliteConnection;
use visualize_sqlite::Schema;

fn main() {
    let db = SqliteConnection::establish("your_sqlite_database.db").unwrap();
    let dot_input = Schema::load(&mut db).unwrap();

    println!("{}", dot_input);
}

Sample Output

Sample Output

Dependencies

~23MB
~451K SLoC