Skip to main content
The oleanderhq-sdk package provides an async client for the oleander API. It covers lake queries, Spark job management, and run polling.

Installation

pip install oleanderhq-sdk

Authentication

Create an API key in your oleander settings, or run oleander configure if you use the CLI. You can pass the key directly or set the OLEANDER_API_KEY environment variable.
from oleander_sdk import Oleander

# Option 1: pass the key directly
client = Oleander(api_key="your-api-key")

# Option 2: reads OLEANDER_API_KEY from the environment
client = Oleander()

Quick start

import asyncio
from oleander_sdk import Oleander, SubmitSparkJobAndWaitOptions

async def main():
    client = Oleander()

    # Query the lake and iterate over results
    result = await client.query("SELECT * FROM public.iris_dataset LIMIT 10")
    for row in result.results.rows:
        sepal_length, sepal_width = row[0], row[1]
        # process each row ...

    # List available Spark job scripts
    jobs = await client.list_spark_jobs()
    print(jobs.scripts, jobs.has_more)

    # Submit a Spark job and wait for it to finish
    result = await client.submit_spark_job_and_wait(
        SubmitSparkJobAndWaitOptions(
            namespace="my-namespace",
            name="daily-etl",
            script_name="etl_pipeline.py",
        )
    )

    if result.state == "FAIL":
        raise Exception(f"Run {result.run_id} failed after {result.run.duration}s")

asyncio.run(main())

Constructor options

ParameterTypeDefaultDescription
api_keystrOLEANDER_API_KEY env varYour oleander API key
base_urlstrhttps://oleander.devAPI base URL. Override for local development.