EMMAA’s Database (emmaa.db)

The Database Schema (emmaa.db.schema)

class emmaa.db.schema.User(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, emmaa.db.schema.EmmaaTable

A table containing users of EMMAA: User(_id_, email)

Parameters:
  • id (int) – (from indralab_auth_tools.src.models.User.id, primary key) A database-generated integer from the User table in indralab auth tools.
  • email (str) – The email of the user (must be unique)
class emmaa.db.schema.Query(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, emmaa.db.schema.EmmaaTable

Queries run on each model: Query(_hash_, model_id, json)

The hash column is a hash generated from the json and model_id columns that can be derived from the

Parameters:
  • hash (big-int) – (primary key) A 32 bit integer generated from the json and model_id.
  • model_id (str) – (20 character) The short id/acronym for the given model.
  • json (json) – A json dict containing the relevant parameters defining the query.
class emmaa.db.schema.UserQuery(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, emmaa.db.schema.EmmaaTable

A table linking users to queries:

UserQuery(_id_, user_id, query_hash, date, subscription)

Parameters:
  • id (int) – (auto, primary key) A database-assigned integer id.
  • user_id (int) – (foreign key -> User.id) The id of the user related to this query.
  • query_hash (big-int) – (foreign key -> Query.hash) The hash of the query json, which can be directly generated.
  • date (datetime) – (auto) The date that this entry was added to the database.
  • subscription (bool) – Record whether the user has subscribed to see results of this model.
  • count (int) – Record the number of times the user associated with user id has done this query
class emmaa.db.schema.Result(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, emmaa.db.schema.EmmaaTable

Results of queries to models:

Result(_id_, query_hash, date, result_json)

Parameters:
  • id (int) – (auto, primary key) A database-assigned integer id.
  • query_hash (big-int) – (foreign key -> Query.hash) The hash of the query json, which can be directly generated.
  • date (datetime) – (auto) The date the result was entered into the database.
  • result_json (json) – A json dict containing the results for the query.
  • mc_type (str) – A name of a ModelChecker used to answer the query.

Database Manager (emmaa.db.manager)