sqlite2mysql (class)

class sqlite2mysql(log, pathToSqlite, tablePrefix='', settings=False, dbConn=False)[source]

Bases: object

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

Key Arguments

  • log – logger

  • settings – the settings dictionary

  • pathToSqlite – path to the sqlite database to transfer into the MySQL database

  • tablePrefix – a prefix to add to all the tablename when converting to mysql. Default “”

  • dbConn – mysql database connection

Usage

To setup your logger, settings and database connections, please use the fundamentals package (see tutorial here).

To convert and import the content of a sqlite database into MySQL run the following:

Todo

  • add a tutorial about sqlite2mysql to documentation

from fundamentals.mysql import sqlite2mysql
converter = sqlite2mysql(
    log=log,
    settings=settings,
    pathToSqlite="/path/to/sqlite.db",
    tablePrefix="external"
)
converter.convert_sqlite_to_mysql()

Methods

convert_sqlite_to_mysql()

copy the contents of the sqlite database into the mysql database

convert_sqlite_to_mysql()[source]

copy the contents of the sqlite database into the mysql database

See class docstring for usage