Hotdata API
Project description
hotdata
Official Python client for the Hotdata HTTP API: workspaces, connections, datasets, SQL queries, results, secrets, uploads, indexes, jobs, embedding providers, and workspace context.
Requirements
Python 3.9+
Install
pip install hotdata
For an unreleased revision:
pip install "git+https://github.com/hotdata-dev/sdk-python.git"
From a local checkout (editable):
pip install -e .
Authentication
The API uses an API key sent as Authorization: Bearer <key>, plus an X-Workspace-Id header on requests scoped to a workspace.
import hotdata
configuration = hotdata.Configuration(
api_key="YOUR_API_KEY",
workspace_id="YOUR_WORKSPACE_ID",
)
host defaults to https://api.hotdata.dev. Override it if you target another environment.
Usage
import hotdata
from hotdata.rest import ApiException
configuration = hotdata.Configuration(
api_key="YOUR_API_KEY",
workspace_id="YOUR_WORKSPACE_ID",
)
with hotdata.ApiClient(configuration) as api_client:
workspaces = hotdata.WorkspacesApi(api_client)
try:
response = workspaces.list_workspaces()
except ApiException as e:
print(f"API error: {e.status} {e.reason}\n{e.body}")
Each Api class groups endpoints by resource. Construct the client, then call the typed methods you need.
Arrow results
Query results can be fetched as an Apache Arrow IPC stream instead of JSON, which is faster and far more memory-efficient for large result sets. Install the optional extra:
pip install 'hotdata[arrow]'
Use hotdata.arrow.ResultsApi (a drop-in subclass of ResultsApi that adds Arrow methods):
from hotdata import ApiClient, Configuration
from hotdata.arrow import ResultsApi
with ApiClient(Configuration(api_key="...", workspace_id="...")) as client:
results = ResultsApi(client)
# Results are scoped to a database via the required `X-Database-Id` header,
# so pass the id of the database the query ran in.
database_id = "your_database_id"
# Buffered: returns a pyarrow.Table.
table = results.get_result_arrow(result_id, database_id)
# Streaming: yields a pyarrow.RecordBatchStreamReader without
# materializing the full table in memory.
with results.stream_result_arrow(result_id, database_id) as reader:
for batch in reader:
...
Both methods accept offset and limit for pagination. They raise hotdata.arrow.ResultNotReadyError if the result is still pending or processing — poll results.get_result(result_id, database_id) until status == "ready" first.
File uploads
hotdata.uploads.UploadsApi (also the default hotdata.UploadsApi) adds
upload_file, which uploads a local file directly to object storage and
finalizes it in one call. It opens an upload session, PUTs the bytes straight
to storage — a single PUT for a small file, concurrent part PUTs for a large
one — then finalizes. The bytes never round-trip through the API.
from hotdata import ApiClient, Configuration, UploadsApi
with ApiClient(Configuration(api_key="...", workspace_id="...")) as client:
uploads = UploadsApi(client)
finalized = uploads.upload_file(
"data.parquet",
content_type="application/parquet",
progress=lambda done, total: print(f"{done}/{total} bytes"),
)
# Pass finalized.upload_id to the managed-table load endpoint.
print(finalized.upload_id)
upload_file accepts a path, raw bytes, or a seekable binary file object
(size is inferred for all three; a file object is read from its current
position to the end). The SDK picks single vs. multipart from the size,
auto-scales the part size, and bounds part concurrency to a peak-memory budget
(override with part_size / max_concurrency / part_retry). A file larger than
8 MiB uploads via a streaming session — the SDK mints each part's URL just
before its PUT, so a presigned URL can't expire mid-transfer on a slow upload.
Storage PUTs go through a dedicated, header-isolated connection pool (auth and
workspace headers never reach object storage, which would otherwise reject the
upload) with a 30s connect timeout so a dead endpoint fails fast. Finalize is sent
with retries disabled so the exactly-once call is never accidentally replayed.
Every failure is a subclass of hotdata.uploads.UploadError (also importable as
from hotdata import UploadError), so a single except UploadError catches the
whole flow: SessionCreateError (opening the session — check .status for a
501 PRESIGN_UNSUPPORTED), StorageError (storage returned a non-2xx; .exhausted
is True if it outlived every retry round), StorageTransportError (the PUT
failed before any response), MissingETagError, MintPartError (minting a part
URL), FinalizeError, MalformedSessionError, SizeLimitError, and
UploadCancelledError. The phase errors that wrap a control-plane call chain the
underlying hotdata.exceptions.ApiException as __cause__ (and expose it as
.api_exception / .status). A local file read error surfaces as OSError.
The progress callback receives a cumulative (bytes_done, total) — for a
tqdm bar (whose update(n) wants a delta, and which isn't thread-safe under
multipart) use the ready-made adapter:
from hotdata import tqdm_progress
from tqdm import tqdm
with tqdm(total=size, unit="B", unit_scale=True) as bar:
uploads.upload_file("data.parquet", progress=tqdm_progress(bar))
Pass a threading.Event as cancel_event to abort an in-flight upload; tune the
control-plane calls with request_timeout (storage-PUT timeouts are automatic and
size-scaled).
For that fallback (or to upload from a non-seekable stream), use upload_stream,
which sends the bytes to the legacy POST /v1/files endpoint in one request,
streaming a file object without buffering it in memory:
with open("data.parquet", "rb") as f:
resp = uploads.upload_stream(f, content_type="application/parquet")
print(resp.id)
Note upload_file shadows the generated raw-body upload_file(body=...); that
raw operation is still reachable at
hotdata.api.uploads_api.UploadsApi.upload_file.
API reference
Generated Markdown for every operation and model is in docs/:
- Resource APIs:
docs/*Api.md(for exampleQueryApi.md) - Request and response models:
docs/<ModelName>.md
Support
Questions and issues: github.com/hotdata-dev/sdk-python.
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
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 hotdata-0.6.0.tar.gz.
File metadata
- Download URL: hotdata-0.6.0.tar.gz
- Upload date:
- Size: 214.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c655fd9691a1d65dd4ed51b86f1c27bf8e73268b4c44696987a57a624da35143
|
|
| MD5 |
20be54229d1488db4d2897a3b7ff3160
|
|
| BLAKE2b-256 |
d2176d9e7cbe7e766cd52968653096ce4199d0cb1aa55b73fcfc2979fb9805ff
|
Provenance
The following attestation bundles were made for hotdata-0.6.0.tar.gz:
Publisher:
publish.yml on hotdata-dev/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hotdata-0.6.0.tar.gz -
Subject digest:
c655fd9691a1d65dd4ed51b86f1c27bf8e73268b4c44696987a57a624da35143 - Sigstore transparency entry: 2104168321
- Sigstore integration time:
-
Permalink:
hotdata-dev/sdk-python@6ebc2f9f951654695923b99f56a4149639490d1c -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/hotdata-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6ebc2f9f951654695923b99f56a4149639490d1c -
Trigger Event:
push
-
Statement type:
File details
Details for the file hotdata-0.6.0-py3-none-any.whl.
File metadata
- Download URL: hotdata-0.6.0-py3-none-any.whl
- Upload date:
- Size: 312.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3324758eb0aa37bbcc505ddac524566a8c10fbe0787e226932e8b04d565200c1
|
|
| MD5 |
2a289243fc75a560824071814bce81fd
|
|
| BLAKE2b-256 |
dc0a4c9f23e1fa85a8d0336681f608c13100e4ab2cf4204846d90374b1bb141b
|
Provenance
The following attestation bundles were made for hotdata-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on hotdata-dev/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hotdata-0.6.0-py3-none-any.whl -
Subject digest:
3324758eb0aa37bbcc505ddac524566a8c10fbe0787e226932e8b04d565200c1 - Sigstore transparency entry: 2104168613
- Sigstore integration time:
-
Permalink:
hotdata-dev/sdk-python@6ebc2f9f951654695923b99f56a4149639490d1c -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/hotdata-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6ebc2f9f951654695923b99f56a4149639490d1c -
Trigger Event:
push
-
Statement type: