API¶
Here’s the public API for Henson-Database.
Database¶
-
class
henson_database.
Database
(app=None)[source]¶ An interface to interact with a relational database.
Parameters: app (Optional[henson.base.Application]) – An application instance that has an attribute named settings that contains a mapping of settings to interact with a database. -
Model
¶ Return a base class for creating models.
Returns: - The base class
- to use for creating new models.
Return type: sqlalchemy.ext.declarative.declarative_base
-
engine
¶ Return the engine.
Returns: The engine. Return type: sqlalchemy.engine.Engine
-
init_app
(app)[source]¶ Initialize an application for use with the database.
If database settings are provided by app as a dict rather than individual keys and values, expands them to the format expected by the extension’s internal create_engine call.
Parameters: app (henson.base.Application) – Application instance that has an attribute named settings that contains a mapping of settings needed to interact with the database.
-
metadata
¶ Return the metadata associated with
db.Model
.Returns: The metadata. Return type: sqlalchemy.MetaData
-