tkp.db – TKP database root package

tkp.db.commit()[source]

A generic wrapper to commit a query transaction

It saves the changes involved by a transaction

tkp.db.connect()[source]

A generic wrapper to connect to the configured database

tkp.db.connection()[source]

A generic wrapper to create a connection to the database if it does not exist

tkp.db.execute(query, parameters={}, commit=False)[source]

A generic wrapper for doing any query to the database

Parameters:
  • query – the query string
  • parameters – The query parameters. These will be converted and escaped.
  • commit – should a commit be performed afterwards, boolean
Returns:

a database cursor object

tkp.db.rollback()[source]

A generic wrapper to rollback a query transaction

Undo changes involved by a transaction that have not been saved