|
DatabaseStorage
Database Storage
Database Storage for Test Data and ResultsTest data and results can be stored to a database when a test run completes. To enable database storage, you must add a results_database option to your config.cfg, which defines the db connection string. example: results_database: sqlite:///results.db Database storage requires sqlalchemy: http://www.sqlalchemy.org Several database back-ends are available to choose from: Example connection strings:
* SQLite is supported natively by Python, so there is no installation or configuration necessary. Results Database Diagram
Sample DB Query CodeHere is some sample code for retrieving results from the database via sqlalchemy: from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from lib.resultsloader import ResultRow
from lib.resultsloader import GlobalConfig
from lib.resultsloader import UserGroupConfig
from lib.resultsloader import TimerRow
engine = create_engine('sqlite:///results.db')
session = sessionmaker(bind=engine)
current = session()
for rr in current.query(ResultRow).order_by(ResultRow.trans_count):
print rr
print rr.global_config
print rr.global_config.user_group_configs
print rr.timers
| ||||||||