getml.database

This module provides communication routines to access various databases.

The connect_greenplum(), connect_mariadb(), connect_mysql(), connect_postgres(), and connect_sqlite3() functions do establish a connection between a database and the getML engine. During the data import using either the read_db() or read_query() methods of a DataFrame instance or the corresponding from_db() class method all data will be directly loaded from the database into the engine without ever passing the Python interpreter.

In addition, several auxiliary functions that might be handy during the analysis and interaction with the database are provided.

Note

There can only be one connection to a database be established at once. In every subsequent connection the previous one will be lost.

Functions

connect_greenplum(dbname, user, password, …)

Creates a new Greenplum database connection.

connect_mariadb(dbname, user, password, host)

Creates a new MariaDB database connection.

connect_mysql(dbname, user, password, host)

Creates a new MySQL database connection.

connect_postgres(dbname, user, password, …)

Creates a new PostgreSQL database connection.

connect_sqlite3([name, time_formats])

Creates a new SQLite3 database connection.

drop_table(name)

Drops a table from the database.

execute(query)

Executes an SQL query on the database.

get(query)

Executes an SQL query on the database and returns the result as a pandas dataframe.

get_colnames(name)

Lists the colnames of a table held in the database.

list_tables()

Lists all tables and views currently held in the database.

read_csv(name, fnames[, header, quotechar, …])

Reads a CSV file into the database.

sniff_csv(name, fnames[, header, …])

Sniffs a list of CSV files.