Question

I'm new to Linux and have just installed Fedora 19 in VirtualBox.

I am running MariaDB and am wanting to generate database diagrams from the command line.

I have come across a few examples of output from SQLFairy:

http://nsaunders.wordpress.com/2009/01/11/easy-visualisation-of-database-schemas-using-sqlfairy/

http://www.christianbiggins.com/2008/11/er-diagrams-from-sql-files.html

http://techmania.wordpress.com/2008/06/09/creating-er-diagrams-from-sql/

And that seems to be the type of thing I am after.

I did a yum search with 'yum search sqlfairy' but there didn't seem to be any results.

Could anyone please tell me how to install sqlfairy in Fedora 19, or, if that's not possible, recommend a product that does a similar thing?

Edit:

I found this: https://admin.fedoraproject.org/pkgdb/acls/name/perl-SQL-Translator#f19

and installed via yum install perl-SQL-Translator.

I am now trying:

[me@my ~]  sqlt-graph -f MySQL -o mydatabase.png -t png mydatabase.sql

but am getting error:

ERROR (line 36): Invalid statement: Was expecting comment, 
or use, or set, or drop, or create, or alter, or insert, or 
delimiter, or empty statement
Error: translate: Error with parser 'SQL::Translator::Parser::MySQL':  
no results at /usr/bin/sqlt-graph line 195.

The .sql file is located is home/me which is where I am running the command from.

Was it helpful?

Solution

The solution was to follow the steps above, the error was solved by using the following for the mysqldump command, then the sqlt command above worked:

[username@hostname ~] mysqldump -u root -pmysql_root_password --no-data database_name > example.sql

OTHER TIPS

Take a look at SchemaCrawler, which can generate database diagrams from the command line. It works on Linux, and needs Java installed. You will need to find a JDBC driver for MariaDB.

Sualeh Fatehi, SchemaCrawler

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top