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.
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.
ingest.py
Copy
from chakra_py import Chakraimport pandas as pd# Initialize clientclient = Chakra("YOUR_DB_SESSION_KEY")# Push data to a new or existing tabledata = 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 querydf = client.execute("SELECT * FROM table_name")# Complex query with aggregationsdf = 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 pandasprint(df.describe())print(df.groupby('category').agg({'value': ['mean', 'std']}))