mysql (module)

Some handy mysql database query and insertion tools

Classes

database(log[, dbSettings, autocommit])

a database object that can setup up a ssh tunnel (optional) and a database connection

sqlite2mysql(log, pathToSqlite[, …])

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

yaml_to_database(log, dbConn[, …])

Take key-values from yaml files including a tablename(s) and add them to a mysql database table

Functions

convert_dictionary_to_mysql_table(log, …)

convert dictionary to mysql table

directory_script_runner(log, …[, dbConn, …])

A function to run all mysql scripts in a given directory (in a modified date order, oldest first) and then act on the script files in accordance with the succcess or failure of their execution

execute_mysql_script(pathToScript, dbConn, log)

execute a mysql script given its file path and return the success or failure status of the execution

get_database_table_column_names(dbConn, log, …)

get database table column names

insert_list_of_dictionaries_into_database_tables(…)

insert list of dictionaries into database tables

readquery(sqlQuery, dbConn, log[, quiet])

Given a mysql query, read the data from the database and return the results as a list of dictionaries (database rows)

setup_database_connection(pathToYamlFile)

Start a database connection using settings in yaml file

table_exists(dbConn, log, dbTableName)

Probe a database to determine if a given table exists

writequery(log, sqlQuery, dbConn[, Force, …])

Execute a MySQL write command given a sql query