Connections¶
Found in visit-generator.connections
is the base CubedConnection
class.
This class handles all connection wrappers to a database.
CubedConnection¶
The base class which all connection classes should inherit from.
init(host, user, password, database)¶
All instances must init with database connection details.
connect()¶
Set self.connection
to be a connection object using the connection details.
insert(table, columns, values, duplicate=None)¶
Handler that will run a query against a given table
updated a Tuple list of columns
based on a Tuple list of values
.
generate_query(table, columns, values, duplicate=None)¶
Returns a query with table
, columns
, and values
packaged together. Use duplicate
here whether to handle "ignore duplicates".
query(select, params)¶
Returns a set of data by running the String select
with the given Tuple params
.
empty_attrib_tables()¶
Build a handler for looping the given self.attrib_tables
to handle truncating or deleting.
CubedConnectionMysqlDB¶
This is the main class wrapper for PyMySQLdb connections. It implements the above functions and only needs to be instansiated with legal connection details.
Extra functions:
dictfetchall(cursor)¶
This function returns a python array of dict objects based on the SQL passed to the query
function and is part of the return formatting.