High-performance Python client for wynd data ingest.
Project description
wynd-dataingest
High-performance Python client for wynd data ingest.
It is built for services that want:
- HTTP connection reuse through
httpx - explicit sync and async NDJSON clients
- retries with exponential backoff and jitter
- optional gzip compression based on raw payload size
- publish-ready packaging for
pip install
Install
pip install wynd-dataingest
Quick Start
Sync client
from wynd_dataingest import CompressionOptions, WyndDataIngestClient
client = WyndDataIngestClient(
url="http://127.0.0.1:8686/events",
connections=16,
table_name="orders",
table_operation="insert",
compression=CompressionOptions(gzip=True),
headers={
"authorization": "Basic my-token",
},
)
result = client.send(
[
{"service": "api", "level": "info", "message": "order accepted"},
{"service": "api", "message": "batch item 1"},
{"service": "api", "message": "batch item 2"},
]
)
print(result.status_code)
client.close()
send() expects a sequence and emits newline-delimited JSON.
Async client
from wynd_dataingest import AsyncWyndDataIngestClient, CompressionOptions
async def ingest() -> None:
client = AsyncWyndDataIngestClient(
url="http://127.0.0.1:8686/events",
compression=CompressionOptions(gzip=True),
)
try:
result = await client.send(
[
{"service": "api", "message": "batch item 1"},
{"service": "api", "message": "batch item 2"},
]
)
print(result.status_code)
finally:
await client.aclose()
API
WyndDataIngestClient(...)
Supported constructor options:
url: full endpoint URLconnections: max pooled HTTP connections; defaults to16table_name: base table name for thetable-nameheadertable_operation:"insert" | "new" | "update" | "delete"; defaults to"insert"whentable_nameis setheaders: default request headerstimeout_ms: per-request timeout; defaults to30000user_agent: override the default user agentretry:RetryOptionscompression:CompressionOptions
Sending data
The client exposes:
send(payload, options=None)close()AsyncWyndDataIngestClient.send(payload, options=None)AsyncWyndDataIngestClient.aclose()
send() accepts:
- a sequence payload, which is serialized as newline-delimited JSON
bytesorbytearray, which are sent as-is when you already have NDJSON-encoded bytes
Table Routing Header
When table_name is configured, the client automatically adds a table-name header:
table_operation="insert"or"new"->table-name: <table_name>table_operation="update"->table-name: <table_name>-updatestable_operation="delete"->table-name: <table_name>-deletes
Compression
Enable gzip with built-in defaults:
from wynd_dataingest import CompressionOptions, WyndDataIngestClient
client = WyndDataIngestClient(
url="http://127.0.0.1:8686/events",
compression=CompressionOptions(gzip=True),
)
That uses the default gzip threshold of 100KB raw bytes.
Or customize it:
from wynd_dataingest import CompressionOptions, GzipCompressionOptions, WyndDataIngestClient
client = WyndDataIngestClient(
url="http://127.0.0.1:8686/events",
compression=CompressionOptions(
gzip=GzipCompressionOptions(min_bytes=4096, level=6)
),
)
Run Tests
Install test dependencies:
./.venv/bin/python -m pip install -e ".[test]"
Run the full test suite:
./.venv/bin/python -m pytest
Run only the client tests:
./.venv/bin/python -m pytest tests/test_wynd_dataingest_client.py
Publish To PyPI
Build locally:
python3 -m pip install --upgrade build
python3 -m build
Upload to PyPI:
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
Then users can install it with:
pip install wynd-dataingest
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wynd_dataingest-1.0.2.tar.gz.
File metadata
- Download URL: wynd_dataingest-1.0.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ce2918541d44a5b7e0d3b5586276d5c89058242f02d444775acb080e3610805
|
|
| MD5 |
9582287cd2aa5e7eb1fb64b3f00ee6bb
|
|
| BLAKE2b-256 |
8c30cfebc0ae4559804869b5c82d127d1514420874ad1563944c2c9c76df9f41
|
File details
Details for the file wynd_dataingest-1.0.2-py3-none-any.whl.
File metadata
- Download URL: wynd_dataingest-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af097d53edc29e5457d390003ba8abe969664f4beac556d64cb72f93d7467df
|
|
| MD5 |
565640f5448854e1728bb7bbc19b0704
|
|
| BLAKE2b-256 |
abb4c92cd56d87e13352f9a0bde56199b53f71a119438fc83328e1821cef9123
|