Skip to content

Creating sessions#

Sessions allow you to define the connection to a database that will be used to persist the state of experiments. By default, an in-memory SQlite instance is created:

Creating a session

1
2
3
4
import mltraq

session = mltraq.create_session()
print(session)
Output
Session(db="sqlite:///:memory:", experiments(0)=[])

Tip

An application can instantiate one or more sessions to implement different use cases. E.g., you might want to store experiments locally, and upstream results once you're confident in the results.

You can specify a connection string (passed to SQLAlchemy) with the url parameter. The password can be provided interactively by passing the option ask_password=True.