fundamentals.mysql.sqlite2mysql¶
Take a sqlite database file and copy the tables within it to a MySQL database
Usage:
sqlite2mysql -s
Options:
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
Module Contents¶
Classes¶
Take a sqlite database file and copy the tables within it to a MySQL database |
Functions¶
The main function used when |
API¶
- fundamentals.mysql.sqlite2mysql.main(arguments=None)[source][source]¶
The main function used when
yaml_to_database.pywhen installed as a cl tool
- class fundamentals.mysql.sqlite2mysql.sqlite2mysql(log, pathToSqlite, tablePrefix='', settings=False, dbConn=False)[source][source]¶
Bases:
objectTake a sqlite database file and copy the tables within it to a MySQL database
Key Arguments
log– loggersettings– the settings dictionarypathToSqlite– path to the sqlite database to transfer into the MySQL databasetablePrefix– 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
fundamentalspackage (see tutorial here https://fundamentals.readthedocs.io/en/master/initialisation.html).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()
Initialization