Skip to main content

qx-projections

Projection runner for Qx services. Reads from the qx_aggregate_events event log and drives incremental or full-rebuild updates of read models.

Usage

from qx.projections import Projection, ProjectionRunner, include_projection_tables

class OrderCountProjection(Projection):
    name = "order_count"

    async def on_orderplaced(self, ev: OrderPlaced) -> None:
        await self._session.execute(
            "INSERT INTO order_counts (id, count) VALUES (:id, 1) "
            "ON CONFLICT (id) DO UPDATE SET count = count + 1",
            {"id": ev.tenant_id},
        )

runner = ProjectionRunner(checkpoints_table, events_table)
runner.register(OrderCountProjection())

# Incremental (call periodically)
async with session_factory() as session:
    await runner.run_once(session)

# Full rebuild
async with session_factory() as session:
    await runner.rebuild(session, projection_name="order_count")

Metadata

Release files for qx-projections 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qx-projections 1.1.0
File Size Uploaded Provenance Actions
qx_projections-1.1.0.tar.gz 5.3 kB Without provenance Details for qx_projections-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qx-projections 1.1.0
File Interpreter ABI Platform Actions
qx_projections-1.1.0-py3-none-any.whl Python 3 none any Details for qx_projections-1.1.0-py3-none-any.whl

Total release size: 10.7 kB

Release files / qx_projections-1.1.0.tar.gz

Download URL qx_projections-1.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ca435a2c439c12356228b99e3e306de626517cadfe5c377b96bd77939b0dd76
BLAKE2b-256 checksum
How to use checksums
1dbb5739a90617457b6ddf73d8511bcfd0b76a32817076f9f1681c2f7af4107d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / qx_projections-1.1.0-py3-none-any.whl

Download URL qx_projections-1.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38af4ff6dfa042a1b2e9d8dec50277d1a7e58ee10763e037bbf67f8b911862f3
BLAKE2b-256 checksum
How to use checksums
1f849c3902af58c44b989daef76f853987d734aea3181d4b11dd7866dd5b7a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for qx-projections 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page