harp_apps.storage.utils.migrations¶
- exception StorageBootError[source]¶
Bases:
RuntimeErrorA storage failure whose message is the password-masked rendering of the original failure chain.
- create_alembic_config(url)[source]¶
Create our alembic configuration object, to run alembic commands.
- Parameters:
url (str | URL | Url | MultiHostUrl)
- create_harp_settings_with_storage_from_command_line_options(kwargs)[source]¶
Create a Harp configuration object using common server command line options (–set…) with the sqlalchemy storage application installed so that the storage is properly configured.
- async ensure_schema_is_current(engine)[source]¶
Raise
OutdatedSchemaErrorif the database schema is older than what this code expects.SQLite schemas are created without alembic, so they are compared to the models. Other databases are compared to the latest alembic revision.
- hide_password(message, url)[source]¶
Mask the password of
urlwhere it sits in a url inmessage: its userinfo or?password=.The shared shape-based masking runs on top, so any other url is covered whatever its encoding. Elsewhere the password is left alone: it is often a common word, or the user or database name, and masking it there would corrupt the message.
- mask_failure(exc, url)[source]¶
Return
excitself when its rendering holds no password, else aStorageBootErrorthat replaces it.- Parameters:
exc (BaseException)
url (str | URL | Url | MultiHostUrl)
- Return type:
- printable_url(url)[source]¶
Render
urlfor a message, its password masked wherever the url holds it.
- render_failure(exc, url)[source]¶
Render
excand its whole cause chain (any attributestr()uses), password masked.- Parameters:
exc (BaseException)
url (str | URL | Url | MultiHostUrl)
- Return type: