Python SDK
Python SDK
Python client for HeliosDB-Lite server.
Installation
pip install heliosdb-liteQuick Start
from heliosdb_lite import Client
# Connect to serverclient = Client("http://localhost:8080")
# Execute queryresult = await client.query("SELECT * FROM users")for row in result.rows: print(row)
# Close connectionawait client.close()Async Client
import asynciofrom heliosdb_lite import Client
async def main(): client = Client( base_url="http://localhost:8080", api_key="your-api-key", branch="main", timeout=30.0 )
# Query result = await client.query( "SELECT * FROM users WHERE id = $1", params=[1] )
# Execute (returns rows affected) count = await client.execute( "UPDATE users SET name = $1 WHERE id = $2", params=["Alice", 1] )
await client.close()
asyncio.run(main())Vector Search
results = await client.vector_search( store="documents", query="machine learning", top_k=10, min_score=0.5, filter={"category": "tech"})
for result in results: print(f"{result.id}: {result.score} - {result.content}")Branching
# Create branchawait client.create_branch("dev", from_branch="main")
# Switch branchclient.branch = "dev"
# Mergeawait client.merge_branch("dev", "main")Natural Language Query
result, sql = await client.nl_query("How many orders last week?")print(f"SQL: {sql}")print(f"Result: {result.rows}")See API Reference for complete documentation.