bedrock.db

This module contains database related classes and functions.

Behind the scenes we use SQLAlchemy and psycopg2 to connect to a PostgreSQL database, so many things here will look familiar.

Most important classes in this module are:

  • AlchemyHelper
    • A helper class for SQLAlchemy to provide CRUD operations.
  • ModelHelper
    • Subclass of AlchemyHelper that provides some extra helper methods such as JSON serialization, introspection, etc.
    • All your models should typically inherit from this class as well as Base (see BedrockModel).
  • BedrockModel
    • The base class for all models in Bedrock. It is aliased as Base (e.g. from bedrock.db.model_helper import Base).
    • All your models should typically inherit from this class (as Base) as well as ModelHelper.

See bedrock.model for more details.

 1"""
 2This module contains database related classes and functions.
 3
 4Behind the scenes we use [SQLAlchemy](https://www.sqlalchemy.org/) and [psycopg2](https://www.psycopg.org/docs/) to
 5connect to a [PostgreSQL](https://www.postgresql.org/) database, so many things here will look familiar.
 6
 7Most important classes in this module are:
 8* [AlchemyHelper](./db/alchemy_helper.html)
 9  * A helper class for SQLAlchemy to provide CRUD operations.
10* [ModelHelper](./db/model_helper.html)
11  * Subclass of AlchemyHelper that provides some extra helper methods such as JSON serialization, introspection, etc.
12  * All your models should typically inherit from this class as well as [`Base`](./db/model_helper.html#Base) (see [BedrockModel](./db/bedrock_model.html#BedrockModel)).
13* [BedrockModel](./db/bedrock_model.html)
14  * The base class for all models in Bedrock. It is aliased as `Base` (e.g. `from bedrock.db.model_helper import Base`).
15  * All your models should typically inherit from this class (as [`Base`](./db/model_helper.html#Base)) as well as [ModelHelper](./db/model_helper.html#ModelHelper).
16
17See `bedrock.model` for more details.
18"""