Creating and dropping SQL databases
This module provides tools to create/drop and use databases specified by DB URL. This module only handles SQLite and PostgreSQL, but abstracts the differences between the two.
- class clldutils.db.DB(url, log=None)[source]
A relational database specified by DB URL. Supported dialects are “sqlite” and “postgresql”.
- Parameters:
url (
str) –log (
typing.Optional[logging.Logger]) –
- classmethod from_settings(settings, log=None)[source]
Instantiate a DB looking up the URL in a dict.
- Parameters:
settings (
dict) – A dict as returned - e.g. - by pyramid.paster.get_appsettings.
- property dialect: str
The database dialect
- property name: str
The database name.