Database tierΒΆ
You can use SQLAlchemy or its declarative layer Elixir with Nagare. For each request received, Nagare creates a database transaction which is commited at the end of the request handling or rollbacked if an exception is raised.
The database connection is activated and configurated in the [database]
section
of the application configuration file.
One of the parameters in this section is the location of the
__metadata__ object of
SQLAlchemy:
which must be explicitly created:
from elixir import * from sqlalchemy import MetaData __metadata__ = MetaData() # Database definitions ...
which Nagare automatically binds to the database engine when the application is launched
where your code must explicitly register the table definitions if you are using SQLAlchemy only
where Elixir automatically register the defined entities