
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 France License.
I've been looking for a while for a tool to generate graphs from sql schemas. This obvious operation seems implemented in many graphical design tools for database, but up until now, I didn't manage to find a command line tool to output a simple graph. Well, the answer came from sqlfairy ( http://sqlfairy.sourceforge.net/ ), a perl library to manipulate structured data definitions.
for example, to generate a nice picture from an existing sqlite database, this is the pipeline :
echo ".schema" | sqlite3 database > schema.sql
sqlt-graph --from=SQLite -o schema.png schema.sql
UPDATE: if you actually want to display relations between your tables, you can use FOREIGN KEY / REFERENCE definitions. Sqlite3 actually parses these definitions, but does not enforce them. On the other hand sqlfairy does not accept foreign key definitions if using the sqlite parser backend. The solution is to use the MySQL parser backend instead so to generate a nice graph.
An example is attached.
UPDATE: if you use postgresql, you should definitely have a look at pg_autodoc : http://www.rbt.ca/autodoc/index.html
Recent comments
18 weeks 1 day ago
1 year 18 weeks ago
1 year 22 weeks ago
1 year 35 weeks ago
1 year 37 weeks ago
1 year 39 weeks ago
1 year 42 weeks ago
1 year 43 weeks ago
2 years 20 weeks ago
2 years 24 weeks ago