In a recent release of fundamentals I included a new sqlite2mysql cl-tool. The sqlite2mysql tool does exactly what you would expect it to do; it takes the path to a sqlite database file and copies the tables found in the database to a MySQL database of your choosing.

For the usage run sqlite2mysql -h from the command-line:

Take a sqlite database file and copy the tables within it to a MySQL database

    sqlite2mysql -s <pathToSettingsFile> <pathToSqliteDB> [<tablePrefix>]


    pathToSqliteDB        path to the sqlite database file
    tablePrefix           a string to prefix the table names when copying to mysql database
    pathToSettingsFile    path to a settings file with logging and database information (yaml file)

    -h, --help            show this help message
    -v, --version         show version
    -s, --settings        the settings file

As usual pathToSettingsFile contains your MySQL database settings (see example at the start of this tutorial). To convert a sqlite databse I could run something like:

sqlite2mysql -s /Users/Me/mydefault_settings.yaml /Users/Me/ebooks.sqlite imported

This command takes the tables in the /Users/Me/ebooks.sqlite database, prepends the names of the tables with ‘imported_’ and imports the tables into the MySQL database whose settings are found in the /Users/Me/mydefault_settings.yaml file. Here are the resulting MySQL database tables as listed in MySQLWorkbench:

As alway, to upgrade fundamentals on you machine run:

pip install fundamentals --upgrade