oleander-cli 0.0.0-stage → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +318 -2
- package/dist/index.cjs +47102 -0
- package/package.json +53 -4
package/README.md
CHANGED
|
@@ -1,3 +1,319 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Oleander CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Oleander CLI uploads, submits, and manages Spark jobs and accesses the Oleander lake.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
### macOS and Linux
|
|
8
|
+
|
|
9
|
+
The install script installs a standalone `oleander` binary, so you don't need Node.js:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
curl -fsSL https://oleander.dev/install.sh | sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It installs to `~/.oleander/bin` and adds that folder to PATH in your shell's startup file. Re-run it, or run `oleander upgrade`, to upgrade. On Alpine and other musl distros, install the C++ runtime first with `apk add libstdc++ libgcc`.
|
|
16
|
+
|
|
17
|
+
### Windows
|
|
18
|
+
|
|
19
|
+
PowerShell installs a standalone `oleander.exe`, so you don't need Node.js:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
irm https://oleander.dev/install.ps1 | iex
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It installs to `~\.oleander\bin` and adds that folder to your user PATH. Re-run it, or run `oleander upgrade`, to upgrade.
|
|
26
|
+
|
|
27
|
+
With [Scoop](https://scoop.sh):
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
scoop bucket add oleander https://github.com/OleanderHQ/scoop-bucket
|
|
31
|
+
scoop install oleander
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Upgrade with `scoop update oleander`.
|
|
35
|
+
|
|
36
|
+
### npm (any OS, Node.js 18+)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g oleander-cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### macOS (Homebrew)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
brew tap OleanderHQ/tap
|
|
46
|
+
brew install oleander-cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Standalone binaries
|
|
50
|
+
|
|
51
|
+
Every release also publishes self-contained executables for `windows-x64`, `windows-arm64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `darwin-x64`, and `darwin-arm64`, with a `SHA256SUMS` file to check them against:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
https://oleander-cli-releases.s3.amazonaws.com/binaries/v{version}/oleander-{platform}.zip (Windows)
|
|
55
|
+
https://oleander-cli-releases.s3.amazonaws.com/binaries/v{version}/oleander-{platform}.tar.gz (macOS, Linux)
|
|
56
|
+
https://oleander-cli-releases.s3.amazonaws.com/binaries/v{version}/SHA256SUMS
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`https://oleander-cli-releases.s3.amazonaws.com/binaries/latest.txt` holds the newest version.
|
|
60
|
+
|
|
61
|
+
### Ubuntu or Debian
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -fsSL https://oleander-cli-releases.s3.amazonaws.com/keys/oleander-archive-keyring.gpg \
|
|
65
|
+
| sudo tee /usr/share/keyrings/oleander-archive-keyring.gpg >/dev/null
|
|
66
|
+
|
|
67
|
+
sudo tee /etc/apt/sources.list.d/oleander.sources >/dev/null <<'EOF'
|
|
68
|
+
Types: deb
|
|
69
|
+
URIs: https://oleander-cli-releases.s3.amazonaws.com/apt
|
|
70
|
+
Suites: stable
|
|
71
|
+
Components: main
|
|
72
|
+
Signed-By: /usr/share/keyrings/oleander-archive-keyring.gpg
|
|
73
|
+
EOF
|
|
74
|
+
|
|
75
|
+
sudo apt update
|
|
76
|
+
sudo apt install oleander-cli
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Start here
|
|
80
|
+
|
|
81
|
+
Every command has nested help. Check it before scripting a command:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
oleander --help
|
|
85
|
+
oleander spark --help
|
|
86
|
+
oleander spark jobs --help
|
|
87
|
+
oleander spark jobs submit --help
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Configure an API key, create a project, upload its entrypoint, and submit a job:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
oleander configure --profile acme
|
|
94
|
+
oleander spark init ./my-spark-project
|
|
95
|
+
oleander spark jobs upload ./my-spark-project/entrypoint.py
|
|
96
|
+
oleander spark jobs submit entrypoint.py \
|
|
97
|
+
--namespace analytics \
|
|
98
|
+
--name daily-rollup \
|
|
99
|
+
--wait
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`--namespace` and `--name` are required for submission. Batch is the default mode. `--wait` waits for a batch job to finish and is ignored for streaming jobs.
|
|
103
|
+
|
|
104
|
+
## Profiles
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
oleander configure --profile acme
|
|
108
|
+
oleander configure --profile sandbox
|
|
109
|
+
oleander switch acme
|
|
110
|
+
oleander whoami
|
|
111
|
+
oleander query "SELECT 1" --profile sandbox
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`oleander configure --profile <name>` prompts for an API key from https://oleander.dev/app/settings/api-keys.
|
|
115
|
+
`oleander switch` changes the default profile. `oleander whoami` prints the current profile and organization. `--profile` on any other command is for that invocation only.
|
|
116
|
+
|
|
117
|
+
Environment variables are available to scripts:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
oleander env list
|
|
121
|
+
oleander env set DATABASE_URL
|
|
122
|
+
oleander env delete DATABASE_URL
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Other useful commands
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# List, inspect, delete, or stop Spark jobs
|
|
129
|
+
oleander spark jobs list
|
|
130
|
+
oleander spark jobs get <entrypoint>
|
|
131
|
+
oleander spark jobs delete <entrypoint>
|
|
132
|
+
oleander spark jobs stop <run-id>
|
|
133
|
+
|
|
134
|
+
# List or register customer-managed Spark clusters
|
|
135
|
+
oleander spark clusters list
|
|
136
|
+
oleander spark clusters register --help
|
|
137
|
+
|
|
138
|
+
# Query Iceberg data (oleander picks the engine and capacity)
|
|
139
|
+
oleander query "SELECT * FROM runs LIMIT 10"
|
|
140
|
+
oleander query "SELECT * FROM runs" --explain
|
|
141
|
+
oleander query submit "SELECT * FROM runs" --destination analytics.recent_runs
|
|
142
|
+
|
|
143
|
+
# Or call an engine directly
|
|
144
|
+
oleander polars --script ./job.py
|
|
145
|
+
oleander duckdb
|
|
146
|
+
|
|
147
|
+
# Save, list, and run saved queries
|
|
148
|
+
oleander queries save daily_runs "SELECT * FROM runs LIMIT 10"
|
|
149
|
+
oleander queries list
|
|
150
|
+
oleander queries get daily_runs
|
|
151
|
+
oleander query "$(oleander queries get daily_runs --query-only)"
|
|
152
|
+
|
|
153
|
+
# Profiles (one API key each)
|
|
154
|
+
oleander configure --profile acme
|
|
155
|
+
oleander switch acme
|
|
156
|
+
oleander whoami
|
|
157
|
+
oleander query "SELECT 1" --profile sandbox
|
|
158
|
+
|
|
159
|
+
# Work with catalogs
|
|
160
|
+
oleander catalogs list
|
|
161
|
+
oleander catalogs namespaces list
|
|
162
|
+
oleander catalogs namespaces list --catalog <catalog-name> -o json
|
|
163
|
+
oleander catalogs namespaces create my_namespace
|
|
164
|
+
oleander catalogs namespaces create my_namespace --catalog <catalog-name>
|
|
165
|
+
oleander catalogs register --help
|
|
166
|
+
oleander catalogs credentials <catalog-name> -o json
|
|
167
|
+
oleander catalogs tables create events \
|
|
168
|
+
--schema '{"type":"struct","fields":[{"id":1,"name":"id","required":true,"type":"long"}]}'
|
|
169
|
+
oleander catalogs tables load \
|
|
170
|
+
--table events \
|
|
171
|
+
--source ./events.parquet
|
|
172
|
+
oleander catalogs tables load \
|
|
173
|
+
--catalog <catalog-name> \
|
|
174
|
+
--namespace analytics \
|
|
175
|
+
--table events \
|
|
176
|
+
--source https://example.com/events.csv \
|
|
177
|
+
--source-format csv
|
|
178
|
+
oleander catalogs tables add-columns \
|
|
179
|
+
--catalog oleander --namespace default --table events \
|
|
180
|
+
--input '{"columns":[{"path":["age"],"type":"int"}]}'
|
|
181
|
+
oleander catalogs tables rename-column \
|
|
182
|
+
--catalog oleander --namespace default --table events \
|
|
183
|
+
--input '{"path":["age"],"new_name":"customer_age"}'
|
|
184
|
+
oleander catalogs tables drop-columns \
|
|
185
|
+
--catalog oleander --namespace default --table events \
|
|
186
|
+
--input '{"paths":[["customer_age"]]}'
|
|
187
|
+
oleander catalogs tables delete events
|
|
188
|
+
oleander catalogs tables --help
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Table commands default to `oleander.default`. Use `--catalog` and `--namespace`
|
|
192
|
+
to target another catalog namespace. `tables create --schema` accepts inline JSON
|
|
193
|
+
or a path to a JSON file; `--partition-spec` supports the same formats.
|
|
194
|
+
`tables load` accepts either a local file path or an absolute URI. Local files
|
|
195
|
+
are uploaded to temporary staging storage before the load job is submitted.
|
|
196
|
+
Files larger than 100 MiB use multipart upload; smaller files use a single PUT.
|
|
197
|
+
`--table` and `--source` are required. `--source-format` defaults to `parquet`.
|
|
198
|
+
|
|
199
|
+
Schema evolution commands require an explicit catalog, namespace, and table.
|
|
200
|
+
Their `--input` option accepts either inline JSON or a JSON file containing the
|
|
201
|
+
complete API request body. Nested paths use arrays such as
|
|
202
|
+
`["address", "state"]`.
|
|
203
|
+
|
|
204
|
+
## Querying the lake
|
|
205
|
+
|
|
206
|
+
`oleander query` sends SQL to the query router. Oleander parses it, estimates
|
|
207
|
+
how much data the referenced tables hold, and picks the engine and machine size
|
|
208
|
+
to match, so there is nothing to size by hand. Every result prints the engine it
|
|
209
|
+
chose and the reasons behind it. Pin an engine with `--engine duckdb|polars|bloom`.
|
|
210
|
+
For a Polars script or cluster size, use `oleander polars`. For an interactive
|
|
211
|
+
DuckDB shell attached to your catalogs, use `oleander duckdb`.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Read: rows come back on this call
|
|
215
|
+
oleander query "SELECT * FROM runs LIMIT 10"
|
|
216
|
+
|
|
217
|
+
# Same read, from a SQL file
|
|
218
|
+
oleander query --file ./daily_runs.sql
|
|
219
|
+
|
|
220
|
+
# Rows as JSON (array of objects) or CSV
|
|
221
|
+
oleander query --file ./daily_runs.sql -o json
|
|
222
|
+
oleander query --file ./daily_runs.sql -o csv
|
|
223
|
+
|
|
224
|
+
# See the engine, estimated input size, and reasons without running anything
|
|
225
|
+
oleander query "SELECT * FROM runs" --explain
|
|
226
|
+
|
|
227
|
+
# Force an engine instead of letting the router choose
|
|
228
|
+
oleander query "SELECT * FROM runs LIMIT 10" --engine duckdb
|
|
229
|
+
|
|
230
|
+
# Call Polars or DuckDB directly (skip the router)
|
|
231
|
+
oleander polars --script ./job.py --table events=analytics.events
|
|
232
|
+
oleander duckdb
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`oleander query` only reads. Anything that changes data goes to
|
|
236
|
+
`oleander query submit`, either a SELECT or `--script` plus a `--destination`
|
|
237
|
+
or a statement that names its own target:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Write a result to a table
|
|
241
|
+
oleander query submit "SELECT * FROM runs" --destination analytics.recent_runs
|
|
242
|
+
oleander query submit --file ./daily_runs.sql --destination analytics.recent_runs
|
|
243
|
+
|
|
244
|
+
# Append instead of replacing
|
|
245
|
+
oleander query submit "SELECT * FROM runs" \
|
|
246
|
+
--destination analytics.recent_runs \
|
|
247
|
+
--write-mode append
|
|
248
|
+
|
|
249
|
+
# A statement that writes on its own needs no destination
|
|
250
|
+
oleander query submit "DELETE FROM analytics.recent_runs WHERE id IS NULL"
|
|
251
|
+
|
|
252
|
+
# Plan a write or a --script without submitting
|
|
253
|
+
oleander query submit --script ./job.py --explain
|
|
254
|
+
|
|
255
|
+
# Return as soon as an asynchronous run is submitted
|
|
256
|
+
oleander query submit "SELECT * FROM runs" \
|
|
257
|
+
--destination analytics.recent_runs \
|
|
258
|
+
--no-wait
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Whether a write finishes on the call is the router's choice, not yours, so read
|
|
262
|
+
the state it reports: `Write complete` means it already landed, while a run id
|
|
263
|
+
means a job is going and the write is not visible yet. Submit waits for that
|
|
264
|
+
run by default; pass `--no-wait` to return immediately. `-o json` on
|
|
265
|
+
`query submit` prints the write result. On reads, `-o json` and `-o csv` print
|
|
266
|
+
only the result rows (a JSON array of objects, or CSV); `-o table` is the
|
|
267
|
+
default.
|
|
268
|
+
|
|
269
|
+
A 402 or 403 is a billing decision, not a transient failure. The CLI prints what
|
|
270
|
+
it asks for; retrying the same query fails identically.
|
|
271
|
+
|
|
272
|
+
## Saved queries
|
|
273
|
+
|
|
274
|
+
Save SQL in the lake editor, then reuse it from the CLI or in scripts:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
oleander queries save daily_runs "SELECT * FROM runs WHERE started_at > now() - interval '1 day'"
|
|
278
|
+
oleander queries save daily_runs --file ./daily_runs.sql
|
|
279
|
+
oleander queries list
|
|
280
|
+
oleander queries get daily_runs
|
|
281
|
+
oleander queries get daily_runs -o json
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Run a saved query (pipe SQL into `query`)
|
|
285
|
+
|
|
286
|
+
`queries get --query-only` prints only the SQL (no spinner, colors, or metadata), so it is safe inside command substitution:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
oleander query "$(oleander queries get daily_runs --query-only)"
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Save the result set as an Iceberg table in the same step:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
oleander query submit "$(oleander queries get daily_runs --query-only)" \
|
|
296
|
+
--destination daily_runs_snapshot
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Use `-o json` on `queries list` or `queries get` when scripting against ids or metadata.
|
|
300
|
+
|
|
301
|
+
Note: `oleander query submit --destination` writes **query results** to a table.
|
|
302
|
+
`oleander queries save` stores the **SQL text** as a named saved query. The old
|
|
303
|
+
`oleander query --save` and `--table-name` flags are gone; a read no longer
|
|
304
|
+
writes a table.
|
|
305
|
+
|
|
306
|
+
## Guidance for coding agents
|
|
307
|
+
|
|
308
|
+
See [`AGENTS.md`](AGENTS.md) for command discovery, safe automation, and output-handling rules.
|
|
309
|
+
|
|
310
|
+
## Development
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
yarn install
|
|
314
|
+
yarn dev --help
|
|
315
|
+
yarn build
|
|
316
|
+
node dist/index.cjs --help
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Requires Node.js 18 or newer.
|