hawat.db module

This module contains very thin database abstraction layer and access functions for Hawat. It is a wrapper around SQLAlchemy library.

class hawat.db.StorageService[source]

Bases: object

This is a thin proxy class, that can be used in place of mentat.services.sqlstorage.StorageService. This is necessary for certain services like mentat.services.whois, that require some access to database storage service and are hardcoded to use mentat.services.sqlstorage.StorageService. This is necessary when using the services from Flask framework, because there is another storage service management feature in place using the py:mod:flask_sqlalchemy module.

property session

Thin proxy property for retrieving reference to current database session.

class hawat.db.StorageServiceManager[source]

Bases: object

This is a thin proxy class, that can be used in place of mentat.services.sqlstorage.StorageServiceManager. This is necessary for certain services like mentat.services.whois, that require some access to database storage service manager and are hardcoded to use mentat.services.sqlstorage.StorageServiceManager. This is necessary when using the services from Flask framework, because there is another storage service management feature in place using the py:mod:flask_sqlalchemy module.

static service()[source]

Thin proxy property for retrieving reference to current database storage service.

hawat.db.db_get()[source]

Opens a new database connection if there is none yet for the current application context.

Returns

Database storage handler.

Return type

flask_sqlalchemy.SQLAlchemy

hawat.db.db_query(dbmodel)[source]

Convenience method.

hawat.db.db_session()[source]

Convenience method.

hawat.db.db_settings(app)[source]

Return database settings from Mentat core configurations.

Returns

Database settings.

Return type

dict