rs_server_common.db.models package

Submodules

rs_server_common.db.models.download_status module

Module used to implement abstract model of an SQLAlchemy table.

class rs_server_common.db.models.download_status.DownloadStatus(*args, **kwargs)

Bases: Base

Abstract implementation of SQLAlchemy Base

available_at_station = Column(None, DateTime(), table=None)
classmethod create(db: Session, **kwargs) DownloadStatus

Create and return database entry.

Parameters:
db_id = Column(None, Integer(), table=None, primary_key=True)
done(db: Session, download_stop: datetime = None)

Update database entry to done.

download_start = Column(None, DateTime(), table=None)
download_stop = Column(None, DateTime(), table=None)
failed(db: Session, status_fail_message: str, download_stop: datetime = None)

Update database entry to failed.

classmethod get(db: Session, name: str | Column[str], raise_if_missing=True) DownloadStatus | None

Get single database table entry by name.

Parameters:
  • db (Session) – Database session

  • name (str) – Product name

  • raise_if_missing (bool) – if product is missing, raise Exception or return None.

Returns:

database table entry

Return type:

DownloadStatus

classmethod get_if_exists(*args, **kwargs) DownloadStatus

Get single database entry by name if it exists, else None.

Calls get() with raise_if_missing=False

in_progress(db: Session, download_start: datetime = None)

Update database entry to progress.

init_on_load()

Invoked when retrieving an existing record from the database table.

name = Column(None, String(), table=None)
not_started(db: Session)

Update database entry to not started.

product_id = Column(None, String(), table=None)
status_fail_message = Column(None, String(), table=None)
class rs_server_common.db.models.download_status.EDownloadStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Download status enumeration.

DONE = 'DONE'
FAILED = 'FAILED'
IN_PROGRESS = 'IN_PROGRESS'
NOT_STARTED = 'NOT_STARTED'

Module contents

Database table models.