Skip to main content

Qx event store: event-sourced aggregates with Postgres-backed event log and snapshots

Project description

qx-eventstore

Event-sourced aggregates for the Qx framework. Aggregates are persisted as an immutable event stream in Postgres, with optional periodic snapshots for efficient replay.

Usage

from dataclasses import dataclass, field
from qx.eventstore import EventSourcedAggregate, EventStore, include_eventstore_tables

class MoneyDeposited(DomainEvent):
    event_name = "account.money_deposited"
    amount: int

@dataclass
class Account(EventSourcedAggregate[str]):
    balance: int = field(default=0)

    def deposit(self, amount: int) -> None:
        self.record_event(MoneyDeposited(amount=amount))

    def apply_moneydeposited(self, ev: MoneyDeposited) -> None:
        self.balance += ev.amount

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qx_eventstore-1.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qx_eventstore-1.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file qx_eventstore-1.1.0.tar.gz.

File metadata

  • Download URL: qx_eventstore-1.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qx_eventstore-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7be5d3585586837d89068476eb3e134f0668dea27953512992a7a59096ec782f
MD5 817b2549c118d6fbf877a03560ea9965
BLAKE2b-256 c16f4281eff6b567818fe6aff61452242ff16b0c8f9a3897e24f4ed279abe77d

See more details on using hashes here.

File details

Details for the file qx_eventstore-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: qx_eventstore-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qx_eventstore-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2056156fcb8833e69920e7add2044b4a9508971f0f7fc86a631ba57f6c29d312
MD5 1ff861d652ef20500d73c0b6677f4a45
BLAKE2b-256 53600522a4c2eaa76c0b13a2b1a84197bf3685085b77c7d9b94bed977455f127

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page