Python client for Subsets data platform
Project description
Subsets Python Client
Simple Python client for the Subsets data platform.
Installation
pip install subsets-client
Quick Start
from subsets_client import SubsetsClient
import pandas as pd
# Initialize client
client = SubsetsClient(api_key="your_api_key")
# Create a dataset
dataset = client.create_dataset({
"id": "sales_data",
"title": "Global Sales Data",
"description": "Quarterly sales by region",
"license": "MIT",
"columns": [
{"id": "region", "type": "string", "description": "Sales region"},
{"id": "quarter", "type": "string", "description": "Quarter (e.g., 2023-Q1)"},
{"id": "revenue", "type": "double", "description": "Revenue in millions"}
]
})
# Add data
import pyarrow as pa
table = pa.table({
"region": ["North America", "Europe", "Asia"],
"quarter": ["2023-Q1", "2023-Q1", "2023-Q1"],
"revenue": [125.4, 98.2, 156.8]
})
client.add_data("sales_data", table)
# Query data
results = client.query("SELECT * FROM subsets.sales_data WHERE revenue > 100")
print(results)
API Reference
Creating Datasets
dataset = client.create_dataset({
"id": "dataset_id",
"title": "Dataset Title",
"description": "Description",
"license": "MIT",
"columns": [...]
})
Adding Data
# Using PyArrow Table
import pyarrow as pa
table = pa.table({
"col1": [1, 2, 3],
"col2": ["a", "b", "c"]
})
client.add_data("dataset_id", table)
Querying Data
# Returns a pandas DataFrame
df = client.query("SELECT * FROM subsets.dataset_id")
Managing Datasets
# List datasets
datasets = client.list_datasets(search="sales", limit=10)
# Get dataset info
info = client.get_dataset("dataset_id")
# Delete data (keeps structure)
client.delete_data("dataset_id")
# Delete entire dataset
client.delete_dataset("dataset_id")
Error Handling
from subsets_client import SubsetsError, AuthenticationError
try:
client.add_data("dataset_id", data)
except AuthenticationError:
print("Invalid API key")
except SubsetsError as e:
print(f"Error: {e}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
subsets_client-0.4.2.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subsets_client-0.4.2.tar.gz.
File metadata
- Download URL: subsets_client-0.4.2.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.1 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c632dbea05388b7df1f18e73f9fb384b06d326f58e3d1aba870f4e9194740a25
|
|
| MD5 |
26a56c1af73f19b3df6bd42b1759b907
|
|
| BLAKE2b-256 |
830df7acded2054a6322a06dca968769420e622fe4579dce14b58e5ca006f11c
|
File details
Details for the file subsets_client-0.4.2-py3-none-any.whl.
File metadata
- Download URL: subsets_client-0.4.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.1 Darwin/23.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db17eb13d049fe65c210f6d427bfe86ed3dc4c79d6f31747c3d4486b96459ae
|
|
| MD5 |
3bc1f7605bd5bbb2ab9dfbea6406c87f
|
|
| BLAKE2b-256 |
a49666d7dbe1b2cd3e36e3b1d5b5cb92db45f025e67684eea17d05e9cfab2995
|