quota_notifier.orm

Object relational mapper for connecting to the application database.

Module Contents

class quota_notifier.orm.Notification(**kwargs)[source]

History of user notifications

Fields:
  • id (Integer): Primary key for this table

  • username (String): Unique account name

  • threshold (Integer): Disk usage threshold that triggered the notification

  • file_system (String): Name of the file system triggering the notification

  • last_update (DateTime): Datetime of the last user notification

id
username
threshold
file_system
last_update
validate_percent(key: str, value: int) int[source]

Verify the given value is between 0 and 100 (inclusive)

Parameters:
  • key – Name of the database column being tested

  • value – The value to test

Returns:

The validated value

Raises:

ValueError – If the given value does not match required criteria

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

class quota_notifier.orm.DBConnection[source]

A configurable connection to the application database

This class acts as the primary interface for connecting to the application database. Use the configure method to change the location of the underlying application database. Changes made via this class will propagate to the entire parent application.

url: str = None
engine: Engine = None
connection: Connection | None = None
classmethod configure(url: str) None[source]

Update the connection information for the underlying database

Changes made here will affect the entire running application

Parameters:

url – URL information for the application database

classmethod session() Session[source]

Connect to the database and return a new database session