astutus.db package

Submodules

astutus.db.logger_db module

class astutus.db.logger_db.Logger(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Model

as_dict() → Dict
as_json() → str
level
name

astutus.db.raspi_db module

class astutus.db.raspi_db.RaspberryPi(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Model

as_dict() → Dict
as_json() → str
id
ipv4
mac_addr

astutus.db.sqlite_db module

astutus.db.sqlite_db.get_instance() → flask_sqlalchemy.SQLAlchemy
astutus.db.sqlite_db.get_url() → str

Get the sqlite database URL used for this application.

Defaults to sqlite:////~/.astutus/astutus.db, where ~ is replaced by the absolute path to the user’s home directory.

Can be overridden by definining the environment variable ASTUTUS_DB_URL

astutus.db.sqlite_db.initialize_db_if_needed() → None

Initialize the database for the application as and if needed.

The directory implied by the sqlite database URL is created, and the database and it’s tables are created.

Please note that at this time, upgrading the database is not handled, as the database is considered transient, rather than being used for long term storage. If the database is outdated, it should be deleted, and then it will be recreated with the current schema.