mlos_bench.storage.sql.schema

DB schema definition for the SqlStorage backend.

Notes

The SQL statements are generated by SQLAlchemy, but can be obtained using repr or str (e.g., via print()) on this object. The mlos_bench CLI will do this automatically if the logging level is set to DEBUG.

Also see the mlos_bench CLI usage for details on how to invoke only the schema creation/update routines.

Classes

DbSchema

A class to define and create the DB schema.

Module Contents

class mlos_bench.storage.sql.schema.DbSchema(engine: sqlalchemy.engine.Engine | None)[source]

A class to define and create the DB schema.

Declare the SQLAlchemy schema for the database.

Parameters:

engine (sqlalchemy.engine.Engine | None) – The SQLAlchemy engine to use for the DB schema. Listed as optional for alembic schema migration purposes so we can reference it inside it’s env.py config file for meta data inspection, but won’t generally be functional without one.

__repr__() str[source]

Produce a string with all SQL statements required to create the schema from scratch in current SQL dialect.

That is, return a collection of CREATE TABLE statements and such. NOTE: this method is quite heavy! We use it only once at startup to log the schema, and if the logging level is set to DEBUG.

Returns:

sql – A multi-line string with SQL statements to create the DB schema from scratch.

Return type:

str

create() DbSchema[source]

Create the DB schema.

Return type:

DbSchema

update() DbSchema[source]

Updates the DB schema to the latest version.

Notes

Also see the mlos_bench CLI usage for details on how to invoke only the schema creation/update routines.

Return type:

DbSchema

config[source]

The Table storing TunableConfigData info.

config_param[source]

The Table storing TunableConfigData info.

experiment[source]

The Table storing ExperimentData info.

property meta: sqlalchemy.MetaData[source]

Return the SQLAlchemy MetaData object.

Return type:

sqlalchemy.MetaData

objectives[source]

The Table storing Experiment optimization objectives info.

trial[source]

The Table storing TrialData info.

trial_param[source]

The Table storing TrialData metadata info.

trial_result[source]

The Table storing TrialData results info.

trial_status[source]

The Table storing TrialData Status info.

trial_telemetry[source]

The Table storing TrialData telemetry info.