create_database_engine¶
- safir.database.create_database_engine(url, password, *, connect_args=None, isolation_level=None, max_overflow=None, pool_size=None, pool_timeout=None)¶
Create a new async database engine.
- Parameters:
url (
str|Url) – Database connection URL, not including the password.password (
str|SecretStr|None) – Database connection password.connect_args (
dict[str,Any] |None, default:None) – Additional connection arguments to pass directly to the underlying database driver.isolation_level (
str|None, default:None) – If specified, sets a non-default isolation level for the database engine.max_overflow (
int|None, default:None) – Maximum number of connections over the pool size for surge traffic.pool_size (
int|None, default:None) – Connection pool size.pool_timeout (
float|None, default:None) – How long to wait for a connection from the connection pool before giving up.
- Returns:
Newly-created database engine. When done with the engine, the caller must call
await engine.dispose().- Return type:
- Raises:
ValueError – A password was provided but the connection URL has no username.