flowserv.model.database module
Wrapper for database connections. The wrapper is used to open database sessions as well as to create a fresh database.
- class flowserv.model.database.DB(connect_url: str, web_app: Optional[bool] = False, echo: Optional[bool] = False)
Bases:
objectWrapper to establish a database connection and create the database schema.
- init() flowserv.model.database.DB
Create all tables in the database model schema. This will also register the default user. The password for the user is a random UUID since the default user is not expected to login (but be used only in open access policies).
- session()
Create a new database session instance. The sessoin is wrapped by a context manager to properly manage the session scope.
- Return type
- flowserv.model.database.SQLITE_DB(dirname: str, filename: Optional[str] = 'test.db')
Get connection Url for a databse file.
- class flowserv.model.database.SessionScope(session)
Bases:
objectContext manager for providing transactional scope around a series of database operations.
- close()
Close the session.
- open()
Get a reference to the database session object.
- flowserv.model.database.TEST_DB(dirname: str, filename: Optional[str] = 'test.db')
Get connection Url for a databse file.