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)

Upsert

from altertable_lakehouse.models import UpsertMode

with open("data.csv", "rb") as f:
    client.upsert(
        catalog="my_cat", 
        schema="my_schema", 
        table="my_table", 
        mode=UpsertMode.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.1.tar.gz (5.4 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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: altertable_lakehouse-0.3.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 edcccdcac67676c5be2f513b3d3523a6a1bc942313d64e4e03cb46bbd1766d7d
MD5 117f10865a32f1b7d04e5da680db2750
BLAKE2b-256 c30035d2d5f0c1d561c7e8fa13f26218abef92ef5ad741c8a28630c40cc4f9a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for altertable_lakehouse-0.3.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for altertable_lakehouse-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42a6b7115bf06cfbfa8963ce84a7cbe4c35ae914c5c11e68244b39a8c005ae1a
MD5 46ef9bd3681ed22297f8dc92212b08cb
BLAKE2b-256 1499b10531edb1fc4473a711582bffb90844a0760be6dfb934fedf47043edaf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for altertable_lakehouse-0.3.1-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