aepsych.database

Submodules

aepsych.database.db module

class aepsych.database.db.Database(db_path=None)[source]

Bases: object

get_engine()[source]
delete_db()[source]
is_update_required()[source]
perform_updates()[source]

Perform updates on known tables. SQLAlchemy doesn’t do alters so they’re done the old fashioned way.

session_scope()[source]

Provide a transactional scope around a series of operations.

execute_sql_query(query, vals)[source]

Execute an arbitrary query written in sql.

Parameters
  • query (str) –

  • vals (Dict[str, str]) –

get_master_records()[source]

Grab the list of master records.

get_master_record(experiment_id)[source]

Grab the list of master record for a specific experiment (master) id.

get_replay_for(master_id)[source]

Get the replay records for a specific master row.

get_strats_for(master_id=0)[source]

Get the strat records for a specific master row.

get_strat_for(master_id, strat_id=- 1)[source]

Get a specific strat record for a specific master row.

get_config_for(master_id)[source]

Get the strat records for a specific master row.

record_setup(description, name, id=None, request=None)[source]
Return type

str

record_message(master_table, type, request)[source]
Return type

None

record_strat(master_table, strat)[source]
record_config(master_table, config)[source]
list_master_records()[source]

aepsych.database.tables module

class aepsych.database.tables.Base(**kwargs)

Bases: object

The base class of the class hierarchy.

When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

metadata = MetaData()
registry = <sqlalchemy.orm.decl_api.registry object>
class aepsych.database.tables.DBMasterTable(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

Master table to keep track of all experiments and unique keys associated with the experiment

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

unique_id
experiment_name
experiment_description
experiment_id
children_replay
children_strat
children_config

@classmethod def from_sqlite(cls, row):

this = DBMasterTable() this.unique_id = row[“unique_id”] this.experiment_name = row[“experiment_name”] this.experiment_description = row[“experiment_description”] this.experiment_id = row[“experiment_id”] return this

static update(engine)[source]
static requires_update(engine)[source]
class aepsych.database.tables.DbReplayTable(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

use_extra_info = False
unique_id
timestamp
message_type
message_contents
extra_info
master_table_id
parent
classmethod from_sqlite(row)[source]
static update(engine)[source]
static requires_update(engine)[source]
class aepsych.database.tables.DbStratTable(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

unique_id
timestamp
strat
master_table_id
parent
classmethod from_sqlite(row)[source]
static update(engine)[source]
static requires_update(engine)[source]
class aepsych.database.tables.DbConfigTable(**kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

unique_id
timestamp
config
master_table_id
parent
classmethod from_sqlite(row)[source]
static update(engine)[source]
static requires_update(engine)[source]

Module contents