Pre-release
This release is a pre-release and may not be stable for production use.
EvidentSource Client for Python
Python client for the EvidentSource event sourcing database.
Installation
pip install evidentsource-client
Usage
import asyncio
from evidentsource_client import EvidentSource
from evidentsource_core import DatabaseName, Selector, ProspectiveEvent, StringEventData
async def main():
# Connect to the server
async with await EvidentSource.connect("localhost:50051") as es:
# Create a database
db_name = DatabaseName("my-app")
await es.create_database(db_name)
# Connect to the database
conn = await es.connect_database(db_name)
# Transact events
events = [
ProspectiveEvent(
id="evt-1",
stream="orders",
event_type="OrderCreated",
data=StringEventData('{"orderId": "123"}'),
)
]
db = await conn.transact(events)
print(f"Committed at revision: {db.revision}")
# Query events
db = await conn.latest_database()
async for event in db.query_events(Selector.stream("orders")):
print(f"Event: {event.id} - {event.event_type}")
asyncio.run(main())
API
EvidentSource
The main entry point for connecting to an EvidentSource server.
EvidentSource.connect(address)- Connect to a servercreate_database(name)- Create a new databaseconnect_database(name)- Connect to an existing database
Connection
Represents a connection to a specific database.
transact(events, constraints?)- Commit events atomicallylatest_database()- Get the latest database state
DatabaseAtRevision
A point-in-time view of the database.
query_events(selector)- Query events matching a selectorview_state(name, version, params)- Get a state view
License
MIT OR Apache-2.0
Metadata
Release files for evidentsource-client 1.0.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| evidentsource_client-1.0.0rc1.tar.gz | 34.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| evidentsource_client-1.0.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.0 kB
Release files / evidentsource_client-1.0.0rc1.tar.gz
| Download URL | evidentsource_client-1.0.0rc1.tar.gz |
|---|---|
| Size | 34.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a27fc18986e765a466420936cf1eed839e747b931d5e8278ff2c383d42f6e20
|
|
BLAKE2b-256 checksum How to use checksums |
518833a416cad97aea633b26ad74656e89c08a7f1c5327cc7d1f25e8cf4229b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / evidentsource_client-1.0.0rc1-py3-none-any.whl
| Download URL | evidentsource_client-1.0.0rc1-py3-none-any.whl |
|---|---|
| Size | 42.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73bcea0384b157e458815f81a16ac6f8ee679aaa53404b5871d5632d9998f93f
|
|
BLAKE2b-256 checksum How to use checksums |
4d5bf6777db7517ba54f8914121c0e5c32d9fff2006fe075b3599e85223a059a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|