The Python SDK is the easiest way to programmatically interact with your local, subscribed, and published databases.
Latest documentation can be found directly on GitHub. Non-exhaustive samples below.
Installation
Loading Data
The Python SDK is built around Pandas dataframes as the core primitive. All objects are passed and retrieved as Pandas dataframes.
Your database session key can be found in the settings page.
from chakra_py import Chakra
import pandas as pd
# Initialize client
client = Chakra("YOUR_DB_SESSION_KEY")
# Push data to a new or existing table
data = pd.DataFrame({
"id": [1, 2, 3],
"name": ["Alice", "Bob", "Charlie"],
"score": [85.5, 92.0, 78.5]
})
client.push("students", data, create_if_missing=True)
# Simple query
df = client.execute("SELECT * FROM table_name")
# Complex query with aggregations
df = client.execute(
"""
SELECT
category,
COUNT(*) as count,
AVG(value) as avg_value
FROM measurements
GROUP BY category
HAVING count > 10
ORDER BY avg_value DESC
""")
# Work with results using pandas
print(df.describe())
print(df.groupby('category').agg({'value': ['mean', 'std']}))