Python SDK for Antfly - a distributed key-value store and search engine.
For the nightly version, visit the TestPyPI page.
pip install antfly-sdkfrom antfly import AntflyClient
# Initialize client
client = AntflyClient(
base_url="http://localhost:8080",
username="admin",
password="password"
)
# Create a table
client.create_table(
name="users",
num_shards=4,
schema={
"key": "user_id",
"document_types": {
"user": {
"fields": {
"name": {"type": "string"},
"email": {"type": "keyword"},
"age": {"type": "int"},
"created_at": {"type": "time"}
}
}
}
}
)
# Insert data
client.batch(
table="users",
inserts={
"user:1": {
"name": "John Doe",
"email": "[email protected]",
"age": 30
},
"user:2": {
"name": "Jane Smith",
"email": "[email protected]",
"age": 25
}
}
)
# Query data
results = client.query(
table="users",
full_text_search={"query": "John"},
limit=10
)
# Get specific record
user = client.get(table="users", key="user:1")- Simple API: Intuitive interface for all Antfly operations
- Type Safety: Full type hints for better IDE support
- Authentication: Built-in support for basic authentication
- Error Handling: Comprehensive error handling with custom exceptions
- Auto-generated Client: Based on OpenAPI specification for accuracy
- Clone the repository
- Install development dependencies:
uv syncThe SDK uses an auto-generated client based on the Antfly OpenAPI specification:
make generatemake testmake buildmake docs will generate the documentation in the docs/ folder.
Full documentation is available at https://antfly-sdk-python.readthedocs.io
Apache License 2.0