SQLite_Database

Note

This module has use for developers only

class pankus.taurus.sqlite_database.SQLiteDatabase(database_name='taurus.db', **kwargs)[source]
do(script_name, args={})[source]
This is clever helper script. Function can perform:
  • a simle querry,
  • can perform a querry and return output cursor
  • can perform multiple ;- separated querrieis

scripts you want to output cursor must not contain ; scripts can be parametrized using :script_variablename notaton

Parameters:
  • script_name – Name of the QL script
  • args – dictionary of format {'script_variable':value}
Returns:

cursor or None

one(script_name, args={})[source]

Helper scripts that allows to fetch one row of output from SQL querries. This is usually for things like count when user expects one output value.

Parameters:
  • script_name – Name of the QL script
  • args – dictionary of format {'script_variable':value}
Returns:

single value

table_exists(dataset_name)[source]

Checks if table of a given name exist in a database. Search query is done according to best practices of table search

Parameters:dataset_name – name of searched table
Returns:True if number of table is not 0
transaction(script_name, data)[source]

Executes many querries in one transaction. Ex. it can insert multiple rows to database at once (hence faster). function must be provided with script name and iterable set. After function exits transaction is commited.

Parameters:
  • script_name – Name of the script (constructor) to construct sngle row of transaction
  • data – An iterable set on which transaction is constructed