Skip to main content

QuixLake Python SDK

A Python client library for interacting with QuixLake API. Provides easy-to-use methods for querying, inserting, and managing data without having to handle HTTP requests and response parsing manually.

Features

  • 🔍 Simple SQL Queries: Execute SQL queries and get pandas DataFrames
  • 📊 Data Management: Insert, compact, and repartition tables
  • 🗂️ Partition Support: Work with Hive-partitioned data
  • 🔧 Easy Setup: Simple installation and configuration
  • 📓 Jupyter Ready: Perfect for data analysis notebooks

Installation

pip install dist/quixlake_sdk-*.whl

Development mode

pip install -e .

With Jupyter support

pip install 'dist/quixlake_sdk-*.whl[jupyter]'

Quick Start

from quixlake import QuixLakeClient
import pandas as pd

# Initialize client
client = QuixLakeClient(base_url="http://localhost")

# Query data
df = client.query("SELECT * FROM my_table LIMIT 10")
print(df.head())

# Get available tables
tables = client.get_tables()
print("Available tables:", tables)

# Insert data
new_data = pd.DataFrame({
    'id': [1, 2, 3],
    'name': ['Alice', 'Bob', 'Charlie'],
    'machine': ['3D_PRINTER_0', '3D_PRINTER_1', '3D_PRINTER_0']
})

result = client.insert(
    table_name="users",
    data=new_data,
    hive_columns=["machine"]
)
print("Inserted:", result)

API Reference

QuixLakeClient

__init__(base_url="http://localhost", timeout=30)

Initialize the client with QuixLake API base URL.

query(sql, explain_analyze=False)

Execute SQL query and return pandas DataFrame.

  • sql: SQL SELECT statement
  • explain_analyze: Enable query execution plan analysis

get_tables()

Get list of available tables.

get_partitions(table_name)

Get partition tree structure for a table.

get_partition_info(table_name)

Get partition structure information for a table.

insert(table_name, data, hive_columns=None, timestamp_column=None, timestamp_format="day")

Insert pandas DataFrame into table with optional partitioning.

  • table_name: Target table name
  • data: pandas DataFrame to insert
  • hive_columns: List of columns for Hive partitioning
  • timestamp_column: Column for timestamp-based partitioning
  • timestamp_format: 'day', 'hour', or 'month'

compact(table_name, target_file_size_mb=128)

Compact table files to optimize performance.

repartition(table_name, hive_columns=None, timestamp_column=None, timestamp_format="day", target_file_size_mb=128)

Repartition table with new partition scheme.

delete(table_name, where_clause=None, delete_table=False, partitions=None)

Delete data from table with various deletion modes.

Examples

Basic Querying

client = QuixLakeClient()

# Simple query
df = client.query("SELECT COUNT(*) as total FROM events_hive")

# Query with explain analyze
df = client.query("SELECT * FROM events_hive WHERE machine = '3D_PRINTER_0'", explain_analyze=True)

Data Management

# Get table information
tables = client.get_tables()
partition_info = client.get_partition_info("events_hive")

# Insert partitioned data
df = pd.read_csv("new_events.csv")
client.insert(
    table_name="events_hive",
    data=df,
    hive_columns=["machine", "experiment_name"],
    timestamp_column="ts_ms",
    timestamp_format="day"
)

# Compact table
result = client.compact("events_hive", target_file_size_mb=256)

# Repartition table
result = client.repartition(
    table_name="events_hive",
    hive_columns=["machine", "year", "month"],
    timestamp_column="ts_ms",
    timestamp_format="month"
)

Using Context Manager

with QuixLakeClient() as client:
    df = client.query("SELECT * FROM my_table")
    print(df.describe())

Building the SDK

Run the build script to create a wheel package:

./build.sh

This will:

  1. Clean previous builds
  2. Install build dependencies
  3. Create wheel package in dist/ directory
  4. Show installation instructions

Development

Install in development mode

pip install -e .[dev]

Run tests

pytest

Code formatting

black src/

Error Handling

The SDK provides clear error messages for common issues:

  • Partition Mismatch: When trying to insert data with incompatible partition structure
  • Query Errors: SQL syntax errors or execution failures
  • Network Issues: Connection timeouts or API unavailability
try:
    df = client.query("SELECT * FROM non_existent_table")
except ValueError as e:
    print(f"Query error: {e}")

Requirements

  • Python 3.8+
  • pandas >= 1.3.0
  • requests >= 2.25.0

License

MIT License - see LICENSE file for details.

Metadata

Release files for quixlake-sdk 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quixlake-sdk 0.2.4
File Size Uploaded Provenance Actions
quixlake_sdk-0.2.4.tar.gz 12.7 kB Without provenance Details for quixlake_sdk-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quixlake-sdk 0.2.4
File Interpreter ABI Platform Actions
quixlake_sdk-0.2.4-py3-none-any.whl Python 3 none any Details for quixlake_sdk-0.2.4-py3-none-any.whl

Total release size: 20.9 kB

Release files / quixlake_sdk-0.2.4.tar.gz

Download URL quixlake_sdk-0.2.4.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a52f366a546e2f5d19da011801350c982a3b1565cae41091a1a413c85029a5bf
BLAKE2b-256 checksum
How to use checksums
0c5865d5461b4b7ed23439eca0390d6b7ac0249954be91149f66881779441a91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / quixlake_sdk-0.2.4-py3-none-any.whl

Download URL quixlake_sdk-0.2.4-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6a11540d577290082de6c6e43068e82242b3c765b84e4c92a33c4679540285d
BLAKE2b-256 checksum
How to use checksums
a4019e6a36cd5e32b16f55651e07690045fb60673a19d159eed6a631bf14ec14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for quixlake-sdk 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page