pengutils.events.base module

Events Base Models

This module defines the SQLAlchemy base classes and the core Event model for the penguin event database. All event types inherit from Event, which provides polymorphic mapping for different event subtypes.

Example usage

from pengutils.base import Event, Base

Classes

  • Base: Declarative base for all ORM models.

  • Event: Base class for all event records, supporting polymorphic identity.

Table Structure

The event table contains: - id: Primary key for the event. - type: Polymorphic type identifier. - procname: Name of the process involved in the event. - proc_id: Process ID.

class pengutils.events.base.Base(**kwargs)[source]

Bases: DeclarativeBase

Declarative base class for all ORM models.

Parameters:

kwargs (Any)

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 pengutils.events.base.Event(**kwargs)[source]

Bases: Base

Base class for all event records in the database.

Attributes

idint

Primary key for the event.

typestr

Polymorphic type identifier for the event.

procnamestr

Name of the process involved in the event.

proc_idint

Process ID associated with the event.

SQLAlchemy polymorphic mapping is used to allow subclasses to represent different event types.

id: Mapped[int]
proc_id: Mapped[int]
procname: Mapped[str]
type: Mapped[str]