Skip to main content

Official Python SDK for Altertable Lakehouse API

Project description

Altertable Lakehouse Python SDK

Official Python SDK for the Altertable Lakehouse API.

Installation

pip install altertable-lakehouse

Usage

Initialization

from altertable_lakehouse import Client

client = Client(username="your_username", password="your_password")

# Disable TLS certificate verification for development only
client = Client(username="your_username", password="your_password", verify=False)

Querying

from altertable_lakehouse.models import QueryRequest

# Stream rows (good for large datasets)
req = QueryRequest(statement="SELECT * FROM my_table")
metadata, columns, row_iterator = client.query(req)
print(metadata.values)
print(columns)
for row in row_iterator:
    print(row)

# Accumulate all rows in memory
result = client.query_all(req)
print(result.metadata.values)
print(result.columns)
print(result.rows)

Append

res = client.append(
    catalog="my_cat",
    schema="my_schema",
    table="my_table",
    data={"col1": "val1"},
    sync=False,
)
print(res.ok)

if res.task_id:
    task = client.get_task(res.task_id)
    print(task.status)

Upload

from altertable_lakehouse.models import UploadFormat, UploadMode

with open("data.csv", "rb") as f:
    client.upload(
        catalog="my_cat", 
        schema="my_schema", 
        table="my_table", 
        format=UploadFormat.CSV, 
        mode=UploadMode.APPEND, 
        content=f.read()
    )

Validate Query

from altertable_lakehouse.models import ValidateRequest

res = client.validate(ValidateRequest(statement="SELECT * FROM non_existent"))
print(res.valid)
print(res.connections_errors)

Query Log & Cancellation

# Get query status
log_res = client.get_query("query_uuid_here")
print(log_res.progress)

# Cancel a query
cancel_res = client.cancel_query("query_uuid_here", "session_id_here")
print(cancel_res.cancelled)

Autocomplete

from altertable_lakehouse.models import AutocompleteRequest

res = client.autocomplete(AutocompleteRequest(statement="SEL", max_suggestions=5))
print(res.statement)
print([suggestion.suggestion for suggestion in res.suggestions])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altertable_lakehouse-0.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altertable_lakehouse-0.3.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file altertable_lakehouse-0.3.0.tar.gz.

File metadata

  • Download URL: altertable_lakehouse-0.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for altertable_lakehouse-0.3.0.tar.gz
Algorithm Hash digest
SHA256 00955f8e24e35439ca84b30f02a37681962b29faac028f96e1e9d5bfcb84e70a
MD5 4ceb1febe8658190d5f432f3670475a9
BLAKE2b-256 b00fd54b0578c583aa78d7b8fa882f5056e0f8d1daa84bd6789a6d449cf31426

See more details on using hashes here.

Provenance

The following attestation bundles were made for altertable_lakehouse-0.3.0.tar.gz:

Publisher: release-please.yml on altertable-ai/altertable-lakehouse-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file altertable_lakehouse-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for altertable_lakehouse-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0df2bce9932f7e058ec3c6695a10d474169193a8b33e08d6fd9d1f5802a801a6
MD5 846ea6734e115f86de38f40fcca41e4d
BLAKE2b-256 86f5d45ee6a8a41d47cf2f7c0b51ded83ce84979d53652d730a90ca4fc31dfdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for altertable_lakehouse-0.3.0-py3-none-any.whl:

Publisher: release-please.yml on altertable-ai/altertable-lakehouse-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page