TypeScript SDK for oleander: query lake, list and launch Spark jobs
npm install @oleanderhq/sdkUse the oleander API from TypeScript: run lake queries, list Spark jobs, and launch Spark jobs.
``bash`
npm install @oleanderhq/sdk
yarn add @oleanderhq/sdk
pnpm add @oleanderhq/sdk
Create an API key in oleander settings, or run oleander configure if you use the CLI. You can pass the key when creating the client or set the OLEANDER_API_KEY environment variable (Node only).
`ts
import { Oleander } from "@oleanderhq/sdk";
const oleander = new Oleander();
const list = await oleander.listSparkJobs();
console.log(list.scripts);
`
Run a SQL query against the oleander lake. The second parameter is optional; save defaults to false. Use save: true to persist results as a table.
`ts`
const result = await oleander.query(
"SELECT * FROM public.iris_dataset LIMIT 10",
);
console.log(result.results?.columns, result.results?.rows);
console.log(result.row_count, result.execution_time);
if (result.saved_table_name) console.log("Saved to:", result.saved_table_name);
Paginated list of your Spark job scripts. Options: limit (default 20), offset (default 0).
`ts
const list = await oleander.listSparkJobs();
console.log(list.scripts, list.hasMore);
const next = await oleander.listSparkJobs({ offset: 20 });
`
Submit a Spark job. Required: namespace, name, scriptName. Other options (e.g. args, machine types, tags) have defaults.
`ts`
const { runId } = await oleander.submitSparkJob({
namespace: "my-namespace",
name: "my-job-name",
scriptName: "my_script.py",
});
console.log("Run ID:", runId);
Submit and poll until the run completes. Optional: pollIntervalMs (default 10000), timeoutMs (default 600000).
`ts`
const { runId, state, run } = await oleander.submitSparkJobAndWait({
namespace: "my-namespace",
name: "my-job-name",
scriptName: "my_script.py",
});
console.log(runId, state); // COMPLETE | FAIL | ABORT
`ts`
const run = await oleander.getRun(runId);
console.log(run.state, run.duration);
- Constructor: new Oleander({ apiKey?, baseUrl? }). Omit apiKey to use OLEANDER_API_KEY. Set baseUrl to use a different endpoint (e.g. http://localhost:3000).optionsSchema
- Schemas: The package exports Zod schemas (e.g. , submitOptionsSchema`) if you want to validate config or options yourself.