harp_apps.storage.models

class Base[source]

Bases: AsyncAttrs, DeclarativeBase

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.

__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.

Parameters:
Return type:

None

metadata: ClassVar[MetaData] = MetaData()

Refers to the _schema.MetaData collection that will be used for new _schema.Table objects.

See also

orm_declarative_metadata

registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>

Refers to the _orm.registry in use where new _orm.Mapper objects will be associated.

class Blob[source]

Bases: Base

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.

__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.

content_type
created_at
data
id
class BlobsRepository[source]

Bases: Repository[Blob]

Type

alias of Blob

count_orphans()[source]
async create(values, /, *, session)[source]
Parameters:

values (dict | Blob)

delete_orphans()[source]
class FlagsRepository[source]

Bases: Repository

Type

alias of UserFlag

class Message[source]

Bases: Base

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.

__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.

classmethod from_models(transaction, message, headers, content)[source]
Parameters:

message (BaseMessage)

to_model()[source]
body: Mapped[str | None]
created_at: Mapped[datetime]
headers: Mapped[str]
id: Mapped[int]
kind: Mapped[str]
summary: Mapped[str]
transaction: Mapped[Transaction]
transaction_id: Mapped[str]
class MessagesRepository[source]

Bases: Repository[Message]

Type

alias of Message

async create(values, /, *, session)[source]
Parameters:

values (dict | Message)

class Metric[source]

Bases: Base

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.

__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.

id
name
class MetricValue[source]

Bases: Base

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.

__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.

created_at
metric: Mapped[Metric]
metric_id
value
class MetricValuesRepository[source]

Bases: Repository[MetricValue]

Type

alias of MetricValue

class MetricsRepository[source]

Bases: Repository[Metric]

Type

alias of Metric

__init__(session_factory, /)[source]
async insert_values(values, /, session)[source]
Parameters:

values (dict)

class Tag[source]

Bases: Base

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.

__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.

id
name
class TagValue[source]

Bases: Base

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.

__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.

id
tag: Mapped[Tag]
tag_id
value
class TagValuesRepository[source]

Bases: Repository[TagValue]

Type

alias of TagValue

class TagsRepository[source]

Bases: Repository[Tag]

Type

alias of Tag

class Transaction[source]

Bases: Base

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.

__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.

to_model(with_user_flags=False)[source]
elapsed: Mapped[float]
endpoint: Mapped[str]
finished_at: Mapped[datetime]
flags: Mapped[List[UserFlag]]
id: Mapped[int]
messages: Mapped[List[Message]]
started_at: Mapped[datetime]
property tags
tpdex: Mapped[int]
type: Mapped[str]
x_cached: Mapped[str]
x_method: Mapped[str]
x_no_cache: Mapped[bool]
x_status_class: Mapped[str]
class TransactionsRepository[source]

Bases: Repository[Transaction]

Type

alias of Transaction

__init__(session_factory, /, tags=None, tag_values=None)[source]
async create(values, /, *, session=None)[source]
Parameters:

values (dict | Transaction)

delete_old(old_after)[source]
Parameters:

old_after (timedelta)

select(*, with_messages=False, with_user_flags=False, with_tags=False)[source]
async set_tags(transaction, tags, /, *, session=None)[source]
Parameters:
class User[source]

Bases: Base

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.

__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.

flags: Mapped[List[UserFlag]]
id
username
class UserFlag[source]

Bases: Base

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.

__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.

id
transaction: Mapped[Transaction]
transaction_id
type
user: Mapped[User]
user_id
class UsersRepository[source]

Bases: Repository

Type

alias of User

async find_one_by_username(username)[source]
Parameters:

username (str)

Return type:

User

Submodules