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.0.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.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qx_eventstore-1.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 9349aa2ede4c9d0a18380a993dbda1f15a8c3839798295829a498aa364c63de1
MD5 935a72f79320d4e44beeac8cc387d7cc
BLAKE2b-256 ac73fcd506e1f0f03a2cb93473609c9490bad2aff1e52b9a03322255f23f0adc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qx_eventstore-1.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2022ec644b099756aa80f211f6455fa0e8c7490cb3ec335339f3ecb7f06ac060
MD5 d33cd999ccb9188ec22d6ae35aef9977
BLAKE2b-256 3e745baa4c66f193c06a38cdf07838977a172f1973643580531e42ea3189544f

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