# cpl.database.context — Common Python Library documentation

# cpl.database.context

## cpl.database.context.database_context

class `cpl.database.context.database_context.``DatabaseContext`(database_settings: cpl.database.database_settings.DatabaseSettings )

  Bases: `cpl.database.context.database_context_abc.DatabaseContextABC`

  Representation of the database context

  > database_settings: `cpl.database.database_settings.DatabaseSettings`

  `connect`(connection_string: str)

    Connects to a database by connection string

    > connection_string: `str`

    >   Database connection string, see: https://docs.sqlalchemy.org/en/14/core/engines.html

  property `engine`
  `save_changes`()

    Saves changes of the database

  property `session`

## cpl.database.context.database_context_abc

class `cpl.database.context.database_context_abc.``DatabaseContextABC`(*args)

  Bases: `abc.ABC`

  ABC for the `cpl.database.context.database_context.DatabaseContext`

  abstract `connect`(connection_string: str)

    Connects to a database by connection string

    > connection_string: `str`

    >   Database connection string, see: https://docs.sqlalchemy.org/en/14/core/engines.html

  abstract property `engine`
  `save_changes`()

    Saves changes of the database

  abstract property `session`