wuttjamaican.db.conf
¶
WuttJamaican - database configuration
- wuttjamaican.db.conf.get_engines(config, prefix)[source]¶
Construct and return all database engines defined for a given config prefix.
For instance if you have a config file with:
[wutta.db] keys = default, host default.url = sqlite:///tmp/default.sqlite host.url = sqlite:///tmp/host.sqlite
And then you call this function to get those DB engines:
get_engines(config, 'wutta.db')
The result of that will be like:
{'default': Engine(bind='sqlite:///tmp/default.sqlite'), 'host': Engine(bind='sqlite:///tmp/host.sqlite')}
- Parameters:
config – App config object.
prefix – Prefix for the config “section” which contains DB connection info.
- Returns:
A dictionary of SQLAlchemy engines, with keys matching those found in config.
- wuttjamaican.db.conf.get_setting(session, name)[source]¶
Get a setting value from the DB.
Note that this assumes (for now?) the DB contains a table named
setting
with(name, value)
columns.- Parameters:
session – App DB session.
name – Name of the setting to get.
- Returns:
Setting value as string, or
None
.