helpers to get and query a sqlalchemy engine for DB containing metadata on experiments
get_db_engine
(username
, password
, ip_adress
, model_name
, rdbms
='mysql'
)
Creates a sqlalchemy engine to query a database.
params:
- username: Username used to connect
- password: Password of the user
- ip_adress: IP adress of the database
- model_name: Name of the model of the database to connect to
- rdbms: Backend engine of the database
return:
- A sqlalchemy engine connected to the database
prompt_credentials
(user
=None
, db_adress
=None
)
Helper function to make a prompt for the password, and additonally the user and the database IP adress
if left to None.
params:
- user: None to prompt or name of the user.
- db_adress: None to prompt or database adress
return:
- username, password and database IP adress
get_record_essentials
(engine
, record_id
)
Retrieves the essential informations about a record.
params:
- engine: Database engine
- record_id: ID of the record
return:
- Pandas Dataframe of record essential informations
get_stim_params
(engine
, stim_hashes
)
Retrieves the parameters of a stimulus specified by its hash key.
params:
- engine: Database engine
- stim_hashes: Stimulus hash
return:
- Pandas Dataframe of stimulus parameters
get_table
(engine
, table_name
)
Return the entire content of a table in a pandas Dataframe.
params:
- engine: Database engine
- table_name: Name of the table
return:
- Pandas Dataframe of the whole table
stim_param_to_dict
(param_df
, md5
)