BaseDatabaseConfig#

pydantic model safir.database.BaseDatabaseConfig#

Base settings for database connections.

Parameters:
  • type (str)

  • isolationLevel (str | None, default: None)

  • maxOverflow (int | None, default: None)

  • poolPrePing (bool | None, default: None)

  • poolRecycle (int | None, default: None)

  • poolSize (int | None, default: None)

  • poolTimeout (int | None, default: None)

Config:
  • alias_generator: AliasGenerator = AliasGenerator(alias=None, validation_alias=<function to_camel at 0x7975e176a4b0>, serialization_alias=None)

  • extra: str = forbid

  • validate_by_name: bool = True

Fields:
Validators:
  • _remove_none » all fields

field isolation_level: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, title='Isolation level', description='Non-default isolation level for the database engine if specified')] = None#

Non-default isolation level for the database engine if specified

Validated by:
  • _remove_none

field max_overflow: Annotated[int | None, FieldInfo(annotation=NoneType, required=True, title='Surge connections', description='Maximum number of connections over the pool size for surge traffic')] = None#

Maximum number of connections over the pool size for surge traffic

Validated by:
  • _remove_none

field pool_pre_ping: Annotated[bool | None, FieldInfo(annotation=NoneType, required=True, title='Check connections', description='Check that a connection is alive before returning it to a session')] = None#

Check that a connection is alive before returning it to a session

Validated by:
  • _remove_none

field pool_recycle: Annotated[int | None, FieldInfo(annotation=NoneType, required=True, title='Recycle lifetime', description='Discard any idle connection open for longer than the provided number of seconds rather than attempting to reuse it. If the connection idle timeout on the database server is known, setting this to slightly less than that timeout will produce the best results.')] = None#

Discard any idle connection open for longer than the provided number of seconds rather than attempting to reuse it. If the connection idle timeout on the database server is known, setting this to slightly less than that timeout will produce the best results.

Validated by:
  • _remove_none

field pool_size: Annotated[int | None, FieldInfo(annotation=NoneType, required=True, title='Pool size', description='Connection pool size')] = None#

Connection pool size

Validated by:
  • _remove_none

field pool_timeout: Annotated[int | None, FieldInfo(annotation=NoneType, required=True, title='Pool timeout', description='How long to wait for a connection from the connection pool before giving up.')] = None#

How long to wait for a connection from the connection pool before giving up.

Validated by:
  • _remove_none

field type: Annotated[str, FieldInfo(annotation=NoneType, required=True, title='Database type')] [Required]#
Validated by:
  • _remove_none

engine_kwargs()#

Construct the keyword arguments to SQLAlchemy engine creation.

Return type:

dict[str, Any]