All database configuration lives under the sql key in application.yaml. The provider auto-injects DatabaseConfig — no manual loading needed.
Config section: sql | Env prefix: LEX_SQL__ | Nested delimiter: __
url : postgresql+asyncpg://user:pass@localhost/mydb
export LEX_SQL__BACKEND__URL = postgresql + asyncpg :// user : pass @ localhost / mydb
export LEX_SQL__POOL__MIN_SIZE = 2
Key Type Default Env Var Description enabledboolTrueLEX_SQL__ENABLEDEnable the database module backendDatabaseBackendConfigsqlite:///piccolina.dbLEX_SQL__BACKEND__*Connection URL and driver poolDatabasePoolConfig(see below) LEX_SQL__POOL__*Connection pool settings operationsDatabaseOperationConfig(see below) LEX_SQL__OPERATIONS__*Operation settings outboxDatabaseOutboxConfig(see below) LEX_SQL__OUTBOX__*Outbox pattern settings migrationsDatabaseMigrationConfig(see below) LEX_SQL__MIGRATIONS__*Migration settings audit_hmac_keystr | NoneNoneLEX_SQL__AUDIT_HMAC_KEYHMAC key for audit signing backendslist[NamedDatabaseConfig][]LEX_SQL__BACKENDSMulti-database backends
Key Type Default Env Var Description urlSecretStrrequired LEX_SQL__BACKEND__URLDatabase connection URL
Valid URL prefixes: sqlite, postgresql, postgres, mysql, mariadb, oracle, mssql, custom.
Key Type Default Env Var Description min_sizeint1LEX_SQL__POOL__MIN_SIZEMinimum pool connections max_sizeint10LEX_SQL__POOL__MAX_SIZEMaximum pool connections max_overflowint5LEX_SQL__POOL__MAX_OVERFLOWMax overflow connections recycleint3600LEX_SQL__POOL__RECYCLEConnection recycle time (seconds) timeoutfloat30.0LEX_SQL__POOL__TIMEOUTPool timeout (seconds) acquire_timeoutDuration30sLEX_SQL__POOL__ACQUIRE_TIMEOUTConnection acquire timeout idle_timeoutDuration5mLEX_SQL__POOL__IDLE_TIMEOUTIdle connection timeout max_lifetimeDuration1hLEX_SQL__POOL__MAX_LIFETIMEMax connection lifetime
Key Type Default Env Var Description echoboolFalseLEX_SQL__OPERATIONS__ECHOLog all SQL statements statement_timeoutDuration60sLEX_SQL__OPERATIONS__STATEMENT_TIMEOUTMax query execution time
Key Type Default Env Var Description enabledboolTrueLEX_SQL__OUTBOX__ENABLEDEnable outbox pattern poll_intervalDuration5sLEX_SQL__OUTBOX__POLL_INTERVALOutbox poll interval batch_max_ageDuration30sLEX_SQL__OUTBOX__BATCH_MAX_AGEMax age for outbox batches
Key Type Default Env Var Description lock_timeoutDuration30sLEX_SQL__MIGRATIONS__LOCK_TIMEOUTMigration lock timeout
Key Type Default Env Var Description namestrrequired LEX_SQL__BACKENDS__0__NAMEUnique backend name backendDatabaseBackendConfigrequired LEX_SQL__BACKENDS__0__BACKEND__*Connection config primaryboolFalseLEX_SQL__BACKENDS__0__PRIMARYPrimary backend (unnamed bindings) poolDatabasePoolConfigmin_size=2LEX_SQL__BACKENDS__0__POOL__*Per-backend pool settings migration_dirstr | NoneNoneLEX_SQL__BACKENDS__0__MIGRATION_DIRAlembic dir for this backend
Key Type Default Description default_page_sizeint20Default pagination page size max_page_sizeint100Maximum allowed page size default_cursor_sizeint20Default cursor pagination size
url : postgresql+asyncpg://user:password@localhost:5432/mydb
audit_hmac_key : "${AUDIT_HMAC_KEY}"
Environment override equivalent:
export LEX_SQL__BACKEND__URL = postgresql + asyncpg :// user : password @ localhost : 5432 / mydb
export LEX_SQL__POOL__MIN_SIZE = 5
export LEX_SQL__POOL__MAX_SIZE = 30
export LEX_SQL__AUDIT_HMAC_KEY = my-hmac-key
url : postgresql+asyncpg:///primary
url : postgresql+asyncpg:///reporting
migration_dir : migrations/reporting
In production, set LEX_SQL__BACKEND__URL via environment variable — never hardcode credentials in YAML. The production validator rejects common default passwords.