Other api/dbcas

Table Of Contents

Previous topic

DBConf

Next topic

dbsvn - DBI SVN Gatekeeper

This Page

Daya Bay Links

Content Skeleton

DBCas

DybPython.dbcas

Pythonic representation of a DBI cascade, see A Cascade of Databases , than implements spawning of the cascade. Creating a pristine cascade that can be populated via fixtures.

Advantages :
  • allows testing to be perfomed in fully controlled/repeatable DB cascade
  • prevents littering production DB with testing detritus

Note such manipulations are not possible with the C++ DbiCascader DbiConnection as these fail to be instanciated if the DB does not exist.

class DybPython.dbcas.DBCas(cnf, append=True)[source]

Bases: list

Represents a cascade of databases (a list of DBCon instances) created from a DybPython.dbconf.DBConf instance

spawn()[source]

Spawning a cascade creates the databases in the cascade with prefixed names and populates them with fixtures

class DybPython.dbcas.DBCon(url, user, pswd, **kwa)[source]

Bases: dict

Dictionary holding parameters to connect to a DB and provides functionality to drop/create databases and run updates/queries against them.

process(sql)[source]

Attempts to create prepared statement from sql then processes it

server

If the connection attempt fails, try again without specifying the DB name, see root:TMySQLServer

Todo

Find way to avoid/capture the error after failure to connect

spawn(fixpass=False)[source]

Create new DB with prefixed name and spawn a DBCon to talk to it with

When fixpass is True the DB is neither created or dropped, but it is assumed to exist. This is used when doing DBI double dipping, used for example in dybgaudi:Database/DBWriter/tests

class DybPython.dbcas.DD[source]

Bases: dict

Compares directories contained cascade mysqldumps after first replacing the times from todays dates avoiding inevitable validity insert time differences

Successful comparison Requires the DbiTest and DybDbiTest dumps to be created on the same UTC day.

get_prep()[source]

Initially this just obscured the times in UTC todays date (which appears in the Vld table INSERTDATE column) to allow comparison between DbiTest and DybDbiTest runs done on the same UTC day

However, now that are extending usage of the MYSQLDUMP reference comparisons to dumps of DBWriter created DB from different days, need to obscure todays date fully

prep

Initially this just obscured the times in UTC todays date (which appears in the Vld table INSERTDATE column) to allow comparison between DbiTest and DybDbiTest runs done on the same UTC day

However, now that are extending usage of the MYSQLDUMP reference comparisons to dumps of DBWriter created DB from different days, need to obscure todays date fully