pi_dashboard.db

Database manager classes for the Pi Dashboard server.

class pi_dashboard.db.MetricsDatabaseManager(db_config)[source]

Manager class for metrics database operations.

__init__(db_config)[source]

Initialize the MetricsDatabaseManager with the given database configuration.

property db_url: str

Get the database URL.

is_stale(entry)[source]

Return True if the metrics entry is older than the specified metrics lifetime.

Parameters:

entry (SystemMetrics) – The metrics entry to check

Return bool:

True if the entry is stale

Return type:

bool

get_all_system_metrics_entries()[source]

Public method to retrieve all metrics entries.

Return type:

list[SystemMetrics]

get_system_metrics_entries_since(last_n_seconds, max_data_points)[source]

Get metrics entries from the last N seconds with adaptive downsampling.

Return type:

list[SystemMetrics]

perform_system_metrics_action(system_metrics, action)[source]

Perform a metrics action (create/update/delete) on the database.

Return type:

int

cleanup_old_system_metrics()[source]

Delete metrics entries that are older than the specified metrics lifetime.

Return type:

None

class pi_dashboard.db.NotesDatabaseManager(db_config)[source]

Manager class for notes database operations.

__init__(db_config)[source]

Initialize the NotesDatabaseManager with the given database configuration.

property db_url: str

Get the database URL.

get_all_note_entries()[source]

Public method to retrieve all note entries.

Return type:

list[NoteEntry]

perform_note_action(note_entry, action)[source]

Perform a note action (create/update/delete) on the database.

Return type:

int

Modules

metrics_database_manager

Metrics database manager.

notes_database_manager

Notes database manager.