Read from and write to event stores
Project description
estory — read from and write to event stores
$ estory init <IDENTIFIER>
$ estory read <IDENTIFIER>
$ estory write <IDENTIFIER>
$ estory guess <IDENTIFIER>
IDENTIFIER is either:
- an URL of a Scrypture server (
http://host:port
) ; - a proper DSN (
driver://user:password@host:port/database
) ; - a file that will be interpreted as a DSN (
sqlite:///<FILE>
) ; - a name matching an environment variable (
ESTORY_<NAME>
).
To initialise an event store:
$ export ESTORY_TMP="sqlite:////tmp/event_store.sqlite"
$ estory init TMP
To write an event to a store:
$ jo stream="uuid" version=1 name="EventName" data=$(jo id=1) unixtime=$(date +%s) | estory write TMP
To read events from a store:
$ estory read TMP
{"stream": "uuid", "name": "EventName", "data": {"id": 1}, "unixtime": 1647876362, "who": "", "id": 1}
To copy events from one store to another:
$ export ESTORY_TMP2="sqlite:////tmp/another_event_store.sqlite"
$ estory init TMP2
$ estory read TMP | estory write TMP2
To copy only some events from one store to another:
$ estory read TMP | jq '.|select(.id==2)' | estory write TMP2
To modify events while copying them from one store to another:
$ estory read TMP | jq '.|.name="EventNewName"' | estory write TMP2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
estory-0.3.0a0.tar.gz
(15.7 kB
view hashes)
Built Distribution
estory-0.3.0a0-py3-none-any.whl
(17.1 kB
view hashes)