# cpl_core.database.context — Common Python Library documentation

# cpl_core.database.context

## cpl_core.database.context.database_context

class cpl_core.database.context.database_context.DatabaseContext

  Bases: `DatabaseContextABC`

  Representation of the database context

  > database_settings: `cpl_core.database.database_settings.DatabaseSettings`

  connect(database_settings: DatabaseSettings )

    Connects to a database by connection settings

    > database_settings `cpl_core.database.database_settings.DatabaseSettings`

  property cursor: MySQLCursorBuffered
  save_changes()

    Saves changes of the database

  select(statement: str) → list[tuple]

    Runs SQL Statements

    > statement: `str`

    > list: Fetched list of selected elements

## cpl_core.database.context.database_context_abc

class cpl_core.database.context.database_context_abc.DatabaseContextABC(*args)

  Bases: `ABC`

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

  abstract connect(database_settings: DatabaseSettings )

    Connects to a database by connection settings

    > database_settings `cpl_core.database.database_settings.DatabaseSettings`

  property cursor: MySQLCursorBuffered
  abstract save_changes()

    Saves changes of the database

  abstract select(statement: str) → list[tuple]

    Runs SQL Statements

    > statement: `str`

    > list: Fetched list of selected elements