Skip to main content

Onehouse Python SDK — modular data-plane clients for LakeBase and beyond

Project description

onehouse-python-sdk

Python SDK for connecting to Onehouse data-plane services.

The base package has zero required dependencies. Drivers ship as optional extras so you only install what you need.

pip install onehouse-python-sdk[lakebase]

LakeBase

LakeBase is Onehouse's PostgreSQL-compatible managed lakehouse engine. This SDK provides a psycopg2-backed client that handles the browser-based and federated authentication flows LakeBase clusters require, on top of standard username/password auth.

Installation

pip install onehouse-python-sdk[lakebase]

Requires Python 3.9+.

Quickstart

from onehouse_python_sdk import LakebaseClient

# Username / password
with LakebaseClient().connect(
    host="<cluster-host>",
    port=5432,
    dbname="mydb",
    user="admin",
    password="secret",
) as client:
    rows = client.fetchall("SELECT * FROM mytable WHERE id = %s", (42,))

Authentication flows

Flow Parameters
Username / password user, password
OIDC Device Flow (Okta / Auth0) browser_auth=true, oidc_client_id, oidc_issuer_url, oidc_iam_role
Azure AD OAuth2 browser_auth=true, azure_oauth_tenant_id, azure_oauth_client_id, azure_oauth_client_secret
Azure Entra ID SAML browser_auth=true, azure_tenant_id, azure_entity_id
Built-in login form browser_auth=true (default when no IdP params are set)
External redirect browser_auth=true, auth_redirect_url
# OIDC Device Flow
client = LakebaseClient().connect(
    host="<cluster-host>",
    port=5432,
    dbname="mydb",
    browser_auth="true",
    oidc_client_id="0oaXXXXX",
    oidc_issuer_url="https://myorg.okta.com",
    oidc_iam_role="arn:aws:iam::123456789012:role/LakeBaseRole",
)

# Azure AD OAuth2
client = LakebaseClient().connect(
    host="<cluster-host>",
    port=5432,
    dbname="mydb",
    browser_auth="true",
    azure_oauth_tenant_id="your-tenant-id",
    azure_oauth_client_id="your-client-id",
    azure_oauth_client_secret="your-client-secret",
)

DSN string form is also supported:

client = LakebaseClient().connect(
    "postgresql://<cluster-host>:5432/mydb"
    "?browser_auth=true"
    "&oidc_client_id=0oaXXXX"
    "&oidc_issuer_url=https://myorg.okta.com"
    "&oidc_iam_role=arn:aws:iam::123456789012:role/LakeBaseRole"
)

Client API

All clients implement the SqlClient interface:

Method Description
connect(dsn=None, **kwargs) → self Establish connection, returns self for chaining
execute(sql, params) Run a statement, return rowcount
fetchall(sql, params) Run a query, return list[tuple]
fetchone(sql, params) Run a query, return first row or None
cursor() Raw cursor for advanced use
raw_connection Underlying psycopg2 connection
close() Close the connection
__enter__ / __exit__ Context manager — closes on exit

Notes

  • Credential caching — auth tokens are cached for 4 minutes per connection parameters to avoid repeated browser prompts within the same process.
  • Callback port — the local auth callback server defaults to port 8888 at path /lakebase. Override with auth_callback_port and auth_callback_path.

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

onehouse_python_sdk-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

onehouse_python_sdk-0.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file onehouse_python_sdk-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for onehouse_python_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9482ae0cbe11d0a9617a42fddae401d76d311a591edaa2b83500078d2472d951
MD5 6ffb299659ecde0c3181c5f087732ed5
BLAKE2b-256 f9f8cad7d15c8fede79d97cf6bdc3a0dd09b44445b8d00c7e3735659b1cae867

See more details on using hashes here.

Provenance

The following attestation bundles were made for onehouse_python_sdk-0.1.0.tar.gz:

Publisher: publish.yml on onehouseinc/onehouse-python-sdk

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

File details

Details for the file onehouse_python_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for onehouse_python_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a5aab9e9ac7727fa8ea7d3bf8eda376242e1f267d4ec3af899039a958c8e0d
MD5 b04d8bce9ee5737d2e6580c9a640a5bf
BLAKE2b-256 1dead0b38e7260e749b39d5e3c2d0d9f04aa15fc2bcf4bf8b6e3f18b3d6146d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for onehouse_python_sdk-0.1.0-py3-none-any.whl:

Publisher: publish.yml on onehouseinc/onehouse-python-sdk

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