create_database_engine#

safir.database.create_database_engine(url, password, *, isolation_level=None)#

Create a new async database engine.

Parameters:
  • url (str) – Database connection URL, not including the password.

  • password (str | None) – Database connection password.

  • isolation_level (str | None, default: None) – If specified, sets a non-default isolation level for the database engine.

Returns:

Newly-created database engine. When done with the engine, the caller must call await engine.dispose().

Return type:

sqlalchemy.ext.asyncio.AsyncEngine

Raises:

ValueError – A password was provided but the connection URL has no username.