onehouse-cli 0.1.4__tar.gz → 0.3.0__tar.gz
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.
- onehouse_cli-0.3.0/PKG-INFO +297 -0
- onehouse_cli-0.3.0/README.md +274 -0
- onehouse_cli-0.3.0/onehouse_cli/__init__.py +32 -0
- onehouse_cli-0.3.0/onehouse_cli/cli.py +102 -0
- onehouse_cli-0.3.0/onehouse_cli/client.py +39 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/__init__.py +1 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/_base.py +60 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/api_token.py +48 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/catalog.py +88 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/cluster.py +114 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/database.py +63 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/flow.py +194 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/install.py +77 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/job.py +242 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/lake.py +89 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/service_principal.py +77 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/skill.py +86 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/source.py +91 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/sql.py +42 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/table.py +268 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/transformation.py +83 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/validation.py +83 -0
- {onehouse_cli-0.1.4 → onehouse_cli-0.3.0}/onehouse_cli/configure.py +12 -3
- onehouse_cli-0.3.0/onehouse_cli/output.py +84 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/SKILL.md +487 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/references/command-map.md +750 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/references/docs-links.md +134 -0
- onehouse_cli-0.3.0/onehouse_cli.egg-info/PKG-INFO +297 -0
- onehouse_cli-0.3.0/onehouse_cli.egg-info/SOURCES.txt +33 -0
- onehouse_cli-0.3.0/onehouse_cli.egg-info/entry_points.txt +6 -0
- onehouse_cli-0.3.0/onehouse_cli.egg-info/requires.txt +7 -0
- onehouse_cli-0.3.0/pyproject.toml +53 -0
- onehouse_cli-0.1.4/PKG-INFO +0 -92
- onehouse_cli-0.1.4/README.md +0 -72
- onehouse_cli-0.1.4/onehouse_cli/__init__.py +0 -21
- onehouse_cli-0.1.4/onehouse_cli/cli.py +0 -403
- onehouse_cli-0.1.4/onehouse_cli.egg-info/PKG-INFO +0 -92
- onehouse_cli-0.1.4/onehouse_cli.egg-info/SOURCES.txt +0 -11
- onehouse_cli-0.1.4/onehouse_cli.egg-info/entry_points.txt +0 -3
- onehouse_cli-0.1.4/onehouse_cli.egg-info/requires.txt +0 -4
- onehouse_cli-0.1.4/pyproject.toml +0 -33
- {onehouse_cli-0.1.4 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/dependency_links.txt +0 -0
- {onehouse_cli-0.1.4 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/top_level.txt +0 -0
- {onehouse_cli-0.1.4 → onehouse_cli-0.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onehouse-cli
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A command-line tool for the full Onehouse API
|
|
5
|
+
Author-email: Sagar Lakshmipathy <18vidhyasagar@gmail.com>
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Keywords: onehouse,cli
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: click>=8.0
|
|
18
|
+
Requires-Dist: requests>=2.28
|
|
19
|
+
Requires-Dist: onehouse-python-sdk[resources]
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-mock>=3.0; extra == "dev"
|
|
23
|
+
|
|
24
|
+
# Onehouse CLI (`oh`)
|
|
25
|
+
|
|
26
|
+
A command-line tool for managing your Onehouse project — clusters, lakes, databases, tables, flows, jobs, catalogs, sources, transformations, validations, service principals, and API tokens.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install onehouse-cli
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The SDK dependency (`onehouse-python-sdk[resources]`) is installed automatically.
|
|
35
|
+
|
|
36
|
+
## AI agent integration
|
|
37
|
+
|
|
38
|
+
The package bundles a skill that teaches AI coding agents how to use `oh`. Install it for your agent:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
oh install agent-skill --claude # ~/.claude/skills/onehouse-cli
|
|
42
|
+
oh install agent-skill --cursor # ~/.cursor/skills/onehouse-cli
|
|
43
|
+
oh install agent-skill --codex # ~/.agents/skills/onehouse-cli
|
|
44
|
+
oh install agent-skill --all # all of the above
|
|
45
|
+
oh install agent-skill --all --dry-run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Re-run the command after `pip install --upgrade onehouse-cli` to refresh the skill. To read the skill without installing it, run `oh skill`.
|
|
49
|
+
|
|
50
|
+
## Setup
|
|
51
|
+
|
|
52
|
+
**Configure credentials:**
|
|
53
|
+
```bash
|
|
54
|
+
oh-configure
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This prompts for your API credentials and saves them to `~/.onehouse/credentials`. You can create multiple named profiles and set a default.
|
|
58
|
+
|
|
59
|
+
Fields collected:
|
|
60
|
+
- Profile name
|
|
61
|
+
- Account UID
|
|
62
|
+
- Project UID
|
|
63
|
+
- API Key / API Secret
|
|
64
|
+
- Project Region
|
|
65
|
+
- User ID
|
|
66
|
+
- Request ID (link UID)
|
|
67
|
+
- API Endpoint (default: `https://api.onehouse.ai/v1`)
|
|
68
|
+
|
|
69
|
+
**Credentials are stored in:** `~/.onehouse/credentials`
|
|
70
|
+
|
|
71
|
+
Alternatively, set environment variables:
|
|
72
|
+
```bash
|
|
73
|
+
export ONEHOUSE_API_KEY=...
|
|
74
|
+
export ONEHOUSE_API_SECRET=...
|
|
75
|
+
export ONEHOUSE_ACCOUNT_UID=...
|
|
76
|
+
export ONEHOUSE_PROJECT_UID=...
|
|
77
|
+
export ONEHOUSE_REGION=...
|
|
78
|
+
export ONEHOUSE_USER_UID=...
|
|
79
|
+
export ONEHOUSE_LINK_UID=...
|
|
80
|
+
export ONEHOUSE_PROFILE=myprofile # select a profile from the credentials file
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Global Options
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
oh [--profile NAME] [--timeout MINS] [--output table|json] COMMAND
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Option | Default | Description |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `--profile` / `-p` | `_default` key in credentials file | Credentials profile to use |
|
|
92
|
+
| `--timeout` / `-t` | `10` | Minutes to wait for async operations |
|
|
93
|
+
| `--output` / `-o` | `table` | Output format: `table` or `json` |
|
|
94
|
+
|
|
95
|
+
Every command also accepts `--show-sql` to print the generated SQL statement without executing it.
|
|
96
|
+
|
|
97
|
+
> `onehouse-cli` and `onehouse-cli-configure` are kept as aliases for backward compatibility.
|
|
98
|
+
|
|
99
|
+
## Commands
|
|
100
|
+
|
|
101
|
+
### Clusters
|
|
102
|
+
```bash
|
|
103
|
+
oh cluster show
|
|
104
|
+
oh cluster describe CLUSTER_NAME
|
|
105
|
+
oh cluster create CLUSTER_NAME --type SQL --max-ocu 10 --min-ocu 2
|
|
106
|
+
oh cluster alter CLUSTER_NAME --state STOP
|
|
107
|
+
oh cluster alter CLUSTER_NAME --max-ocu 20
|
|
108
|
+
oh cluster alter CLUSTER_NAME --new-name NEW_NAME
|
|
109
|
+
oh cluster delete CLUSTER_NAME
|
|
110
|
+
```
|
|
111
|
+
Cluster types: `Managed`, `SQL`, `Spark`, `Open_Engines`, `Notebook`, `LakeBase`
|
|
112
|
+
|
|
113
|
+
### Lakes
|
|
114
|
+
```bash
|
|
115
|
+
oh lake show
|
|
116
|
+
oh lake create LAKE_NAME --type MANAGED --bucket-path s3://my-bucket/ --default-services-cluster mycluster
|
|
117
|
+
oh lake alter LAKE_NAME --default-services-cluster newcluster
|
|
118
|
+
oh lake delete LAKE_NAME [--cascade]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Databases
|
|
122
|
+
```bash
|
|
123
|
+
oh database show --lake LAKE_NAME
|
|
124
|
+
oh database create DB_NAME --lake LAKE_NAME
|
|
125
|
+
oh database delete DB_NAME --lake LAKE_NAME [--cascade]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Tables
|
|
129
|
+
```bash
|
|
130
|
+
oh table show --lake LAKE_NAME --database DB_NAME
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Table Services
|
|
134
|
+
```bash
|
|
135
|
+
oh table service create --lake L --database D --table T --service COMPACT --trigger-mode ON_DEMAND
|
|
136
|
+
oh table service alter --lake L --database D --table T --service COMPACT --trigger-mode AUTOMATIC
|
|
137
|
+
oh table service describe --lake L --database D --table T --service COMPACT
|
|
138
|
+
oh table service show --lake L --database D --table T
|
|
139
|
+
oh table service show-runs --lake L --database D --table T --service COMPACT
|
|
140
|
+
oh table service run --lake L --database D --table T --service COMPACT
|
|
141
|
+
oh table service pause --lake L --database D --table T --service COMPACT
|
|
142
|
+
oh table service resume --lake L --database D --table T --service COMPACT
|
|
143
|
+
oh table service cancel --lake L --database D --table T --service COMPACT
|
|
144
|
+
oh table service alter-cluster --lake L --database D --table T --services-cluster newcluster
|
|
145
|
+
```
|
|
146
|
+
Services: `CLUSTER`, `COMPACT`, `CLEAN`, `METASYNC`
|
|
147
|
+
Run-only services (for `run`): `CLUSTER`, `COMPACT`, `CLEAN`, `METASYNC`, `AUTOSAVEPOINT`, `RESTORE`
|
|
148
|
+
|
|
149
|
+
### Catalogs
|
|
150
|
+
```bash
|
|
151
|
+
oh catalog show
|
|
152
|
+
oh catalog describe CATALOG_NAME
|
|
153
|
+
oh catalog create CATALOG_NAME --type GLUE --credential-type CREDENTIAL_TYPE_ONEHOUSE
|
|
154
|
+
oh catalog delete CATALOG_NAME
|
|
155
|
+
```
|
|
156
|
+
Types: `GLUE`, `HIVE`, `BIGQUERY`, `DATAHUB`, `ONETABLE`, `DATAPROC`, `UNITY`, `SNOWFLAKE`, `ONELAKE`
|
|
157
|
+
|
|
158
|
+
### Sources
|
|
159
|
+
```bash
|
|
160
|
+
oh source show
|
|
161
|
+
oh source describe SOURCE_NAME
|
|
162
|
+
oh source create SOURCE_NAME --type S3 --credential-type CREDENTIAL_TYPE_ONEHOUSE [--if-not-exists]
|
|
163
|
+
oh source delete SOURCE_NAME
|
|
164
|
+
```
|
|
165
|
+
Types: `APACHE_KAFKA`, `MSK_KAFKA`, `CONFLUENT_KAFKA`, `S3`, `GCS`, `ONEHOUSE_TABLE`, `POSTGRES`, `MY_SQL`
|
|
166
|
+
|
|
167
|
+
### Flows
|
|
168
|
+
```bash
|
|
169
|
+
oh flow show
|
|
170
|
+
oh flow describe FLOW_NAME
|
|
171
|
+
oh flow create FLOW_NAME \
|
|
172
|
+
--source mysource --lake mylake --database mydb --table-name mytable \
|
|
173
|
+
--write-mode IMMUTABLE --cluster mycluster \
|
|
174
|
+
[--performance-profile BALANCED] \
|
|
175
|
+
[--record-key-fields id] \
|
|
176
|
+
[--partition-key-fields date:DATE_STRING] \
|
|
177
|
+
[--precombine-key-field ts] \
|
|
178
|
+
[--min-sync-frequency-mins 5] \
|
|
179
|
+
[--quarantine-enabled] \
|
|
180
|
+
[--catalogs cat1] [--transformations tx1] [--validations val1]
|
|
181
|
+
oh flow alter FLOW_NAME --state PAUSE # or RESUME, CLEAN_AND_RESTART
|
|
182
|
+
oh flow alter FLOW_NAME --cluster newcluster # exactly one option at a time
|
|
183
|
+
oh flow delete FLOW_NAME
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Partition key field format: `FIELD:TYPE:INPUT_FORMAT:OUTPUT_FORMAT`
|
|
187
|
+
Write modes: `IMMUTABLE`, `MUTABLE`
|
|
188
|
+
Performance profiles: `BALANCED`, `FASTEST_READ`, `FASTEST_WRITE`
|
|
189
|
+
|
|
190
|
+
### Transformations
|
|
191
|
+
```bash
|
|
192
|
+
oh transformation show
|
|
193
|
+
oh transformation describe TX_NAME
|
|
194
|
+
oh transformation create TX_NAME --type ROW_FILTERING [--options FILTER_SQL="col > 0"]
|
|
195
|
+
oh transformation delete TX_NAME
|
|
196
|
+
```
|
|
197
|
+
Types: `CONVERT_CDC`, `ROW_FILTERING`, `DERIVED_DATE`, `ADD_CURRENT_TIMESTAMP`, `USER_PROVIDED`, `DATA_MASKING`, `L_PARSE_JSON`, `FLATTEN_STRUCT`, `EXPLODE_ARRAY`, `VECTOR_EMBEDDING`
|
|
198
|
+
|
|
199
|
+
### Validations
|
|
200
|
+
```bash
|
|
201
|
+
oh validation show
|
|
202
|
+
oh validation describe VAL_NAME
|
|
203
|
+
oh validation create VAL_NAME --type SCHEMA
|
|
204
|
+
oh validation delete VAL_NAME
|
|
205
|
+
```
|
|
206
|
+
Types: `SCHEMA`, `TIMESTAMP`
|
|
207
|
+
|
|
208
|
+
### Jobs
|
|
209
|
+
```bash
|
|
210
|
+
oh job show
|
|
211
|
+
oh job describe JOB_NAME
|
|
212
|
+
oh job create JOB_NAME --type JAR --cluster mycluster --parameters arg1 --parameters arg2
|
|
213
|
+
oh job create-and-run JOB_NAME --type PYTHON --cluster mycluster --parameters script.py
|
|
214
|
+
oh job alter JOB_NAME --cluster newcluster # or --parameters (not both)
|
|
215
|
+
oh job run JOB_NAME
|
|
216
|
+
oh job cancel-run JOB_RUN_UUID --job-name JOB_NAME
|
|
217
|
+
oh job describe-run JOB_RUN_UUID --job-name JOB_NAME
|
|
218
|
+
oh job show-runs JOB_NAME
|
|
219
|
+
oh job upload-jar JAR_NAME --options FILE_PATH=/path/to/file.jar
|
|
220
|
+
oh job replace-jar JAR_NAME --options FILE_PATH=/path/to/file.jar
|
|
221
|
+
```
|
|
222
|
+
Job types: `JAR`, `PYTHON`
|
|
223
|
+
|
|
224
|
+
### Service Principals
|
|
225
|
+
```bash
|
|
226
|
+
oh service-principal show
|
|
227
|
+
oh service-principal create SP_NAME
|
|
228
|
+
oh service-principal alter SP_NAME --new-name NEW_NAME
|
|
229
|
+
oh service-principal delete SP_NAME
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### API Tokens
|
|
233
|
+
```bash
|
|
234
|
+
oh api-token create TOKEN_NAME --service-principal SP_NAME
|
|
235
|
+
oh api-token delete TOKEN_NAME --service-principal SP_NAME
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Raw SQL
|
|
239
|
+
```bash
|
|
240
|
+
# Execute any SQL statement
|
|
241
|
+
oh sql exec --command "SHOW CLUSTERS"
|
|
242
|
+
|
|
243
|
+
# Fire-and-forget (returns request ID immediately, no polling)
|
|
244
|
+
oh sql exec --command "SHOW CLUSTERS" --async-mode
|
|
245
|
+
|
|
246
|
+
# Check status of a previous request
|
|
247
|
+
oh sql status REQUEST_ID
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## WITH options
|
|
251
|
+
|
|
252
|
+
Commands that accept extra configuration take `--options KEY=VALUE` (repeatable):
|
|
253
|
+
```bash
|
|
254
|
+
oh catalog create mycat --type HIVE \
|
|
255
|
+
--credential-type CREDENTIAL_TYPE_ONEHOUSE \
|
|
256
|
+
--options METASTORE_URI=thrift://host:9083 \
|
|
257
|
+
--options DATABASE=default
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Show SQL
|
|
261
|
+
|
|
262
|
+
Any command can print its generated SQL without making a network call:
|
|
263
|
+
```bash
|
|
264
|
+
oh cluster create mycluster --type SQL --show-sql
|
|
265
|
+
# CREATE CLUSTER `mycluster`
|
|
266
|
+
# TYPE = 'SQL'
|
|
267
|
+
|
|
268
|
+
oh flow create myflow --source src --lake l --database d \
|
|
269
|
+
--table-name t --write-mode IMMUTABLE --cluster c --show-sql
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Examples
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Create a managed lake and database
|
|
276
|
+
oh lake create prod-lake --type MANAGED \
|
|
277
|
+
--bucket-path s3://my-data-lake/ \
|
|
278
|
+
--default-services-cluster services-cluster
|
|
279
|
+
oh database create analytics --lake prod-lake
|
|
280
|
+
|
|
281
|
+
# Create a Kafka flow
|
|
282
|
+
oh source create kafka-src --type APACHE_KAFKA \
|
|
283
|
+
--credential-type CREDENTIAL_TYPE_ONEHOUSE \
|
|
284
|
+
--options BOOTSTRAP_SERVERS=kafka:9092
|
|
285
|
+
oh flow create orders-flow \
|
|
286
|
+
--source kafka-src --lake prod-lake \
|
|
287
|
+
--database analytics --table-name orders \
|
|
288
|
+
--write-mode MUTABLE --cluster ingest-cluster \
|
|
289
|
+
--record-key-fields order_id
|
|
290
|
+
|
|
291
|
+
# Monitor a table's compaction service
|
|
292
|
+
oh table service show --lake prod-lake --database analytics --table orders
|
|
293
|
+
oh table service run --lake prod-lake --database analytics --table orders --service COMPACT
|
|
294
|
+
|
|
295
|
+
# JSON output for scripting
|
|
296
|
+
oh --output json cluster show | jq '.'
|
|
297
|
+
```
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Onehouse CLI (`oh`)
|
|
2
|
+
|
|
3
|
+
A command-line tool for managing your Onehouse project — clusters, lakes, databases, tables, flows, jobs, catalogs, sources, transformations, validations, service principals, and API tokens.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install onehouse-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The SDK dependency (`onehouse-python-sdk[resources]`) is installed automatically.
|
|
12
|
+
|
|
13
|
+
## AI agent integration
|
|
14
|
+
|
|
15
|
+
The package bundles a skill that teaches AI coding agents how to use `oh`. Install it for your agent:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
oh install agent-skill --claude # ~/.claude/skills/onehouse-cli
|
|
19
|
+
oh install agent-skill --cursor # ~/.cursor/skills/onehouse-cli
|
|
20
|
+
oh install agent-skill --codex # ~/.agents/skills/onehouse-cli
|
|
21
|
+
oh install agent-skill --all # all of the above
|
|
22
|
+
oh install agent-skill --all --dry-run
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Re-run the command after `pip install --upgrade onehouse-cli` to refresh the skill. To read the skill without installing it, run `oh skill`.
|
|
26
|
+
|
|
27
|
+
## Setup
|
|
28
|
+
|
|
29
|
+
**Configure credentials:**
|
|
30
|
+
```bash
|
|
31
|
+
oh-configure
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This prompts for your API credentials and saves them to `~/.onehouse/credentials`. You can create multiple named profiles and set a default.
|
|
35
|
+
|
|
36
|
+
Fields collected:
|
|
37
|
+
- Profile name
|
|
38
|
+
- Account UID
|
|
39
|
+
- Project UID
|
|
40
|
+
- API Key / API Secret
|
|
41
|
+
- Project Region
|
|
42
|
+
- User ID
|
|
43
|
+
- Request ID (link UID)
|
|
44
|
+
- API Endpoint (default: `https://api.onehouse.ai/v1`)
|
|
45
|
+
|
|
46
|
+
**Credentials are stored in:** `~/.onehouse/credentials`
|
|
47
|
+
|
|
48
|
+
Alternatively, set environment variables:
|
|
49
|
+
```bash
|
|
50
|
+
export ONEHOUSE_API_KEY=...
|
|
51
|
+
export ONEHOUSE_API_SECRET=...
|
|
52
|
+
export ONEHOUSE_ACCOUNT_UID=...
|
|
53
|
+
export ONEHOUSE_PROJECT_UID=...
|
|
54
|
+
export ONEHOUSE_REGION=...
|
|
55
|
+
export ONEHOUSE_USER_UID=...
|
|
56
|
+
export ONEHOUSE_LINK_UID=...
|
|
57
|
+
export ONEHOUSE_PROFILE=myprofile # select a profile from the credentials file
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Global Options
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
oh [--profile NAME] [--timeout MINS] [--output table|json] COMMAND
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Option | Default | Description |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `--profile` / `-p` | `_default` key in credentials file | Credentials profile to use |
|
|
69
|
+
| `--timeout` / `-t` | `10` | Minutes to wait for async operations |
|
|
70
|
+
| `--output` / `-o` | `table` | Output format: `table` or `json` |
|
|
71
|
+
|
|
72
|
+
Every command also accepts `--show-sql` to print the generated SQL statement without executing it.
|
|
73
|
+
|
|
74
|
+
> `onehouse-cli` and `onehouse-cli-configure` are kept as aliases for backward compatibility.
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
### Clusters
|
|
79
|
+
```bash
|
|
80
|
+
oh cluster show
|
|
81
|
+
oh cluster describe CLUSTER_NAME
|
|
82
|
+
oh cluster create CLUSTER_NAME --type SQL --max-ocu 10 --min-ocu 2
|
|
83
|
+
oh cluster alter CLUSTER_NAME --state STOP
|
|
84
|
+
oh cluster alter CLUSTER_NAME --max-ocu 20
|
|
85
|
+
oh cluster alter CLUSTER_NAME --new-name NEW_NAME
|
|
86
|
+
oh cluster delete CLUSTER_NAME
|
|
87
|
+
```
|
|
88
|
+
Cluster types: `Managed`, `SQL`, `Spark`, `Open_Engines`, `Notebook`, `LakeBase`
|
|
89
|
+
|
|
90
|
+
### Lakes
|
|
91
|
+
```bash
|
|
92
|
+
oh lake show
|
|
93
|
+
oh lake create LAKE_NAME --type MANAGED --bucket-path s3://my-bucket/ --default-services-cluster mycluster
|
|
94
|
+
oh lake alter LAKE_NAME --default-services-cluster newcluster
|
|
95
|
+
oh lake delete LAKE_NAME [--cascade]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Databases
|
|
99
|
+
```bash
|
|
100
|
+
oh database show --lake LAKE_NAME
|
|
101
|
+
oh database create DB_NAME --lake LAKE_NAME
|
|
102
|
+
oh database delete DB_NAME --lake LAKE_NAME [--cascade]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Tables
|
|
106
|
+
```bash
|
|
107
|
+
oh table show --lake LAKE_NAME --database DB_NAME
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Table Services
|
|
111
|
+
```bash
|
|
112
|
+
oh table service create --lake L --database D --table T --service COMPACT --trigger-mode ON_DEMAND
|
|
113
|
+
oh table service alter --lake L --database D --table T --service COMPACT --trigger-mode AUTOMATIC
|
|
114
|
+
oh table service describe --lake L --database D --table T --service COMPACT
|
|
115
|
+
oh table service show --lake L --database D --table T
|
|
116
|
+
oh table service show-runs --lake L --database D --table T --service COMPACT
|
|
117
|
+
oh table service run --lake L --database D --table T --service COMPACT
|
|
118
|
+
oh table service pause --lake L --database D --table T --service COMPACT
|
|
119
|
+
oh table service resume --lake L --database D --table T --service COMPACT
|
|
120
|
+
oh table service cancel --lake L --database D --table T --service COMPACT
|
|
121
|
+
oh table service alter-cluster --lake L --database D --table T --services-cluster newcluster
|
|
122
|
+
```
|
|
123
|
+
Services: `CLUSTER`, `COMPACT`, `CLEAN`, `METASYNC`
|
|
124
|
+
Run-only services (for `run`): `CLUSTER`, `COMPACT`, `CLEAN`, `METASYNC`, `AUTOSAVEPOINT`, `RESTORE`
|
|
125
|
+
|
|
126
|
+
### Catalogs
|
|
127
|
+
```bash
|
|
128
|
+
oh catalog show
|
|
129
|
+
oh catalog describe CATALOG_NAME
|
|
130
|
+
oh catalog create CATALOG_NAME --type GLUE --credential-type CREDENTIAL_TYPE_ONEHOUSE
|
|
131
|
+
oh catalog delete CATALOG_NAME
|
|
132
|
+
```
|
|
133
|
+
Types: `GLUE`, `HIVE`, `BIGQUERY`, `DATAHUB`, `ONETABLE`, `DATAPROC`, `UNITY`, `SNOWFLAKE`, `ONELAKE`
|
|
134
|
+
|
|
135
|
+
### Sources
|
|
136
|
+
```bash
|
|
137
|
+
oh source show
|
|
138
|
+
oh source describe SOURCE_NAME
|
|
139
|
+
oh source create SOURCE_NAME --type S3 --credential-type CREDENTIAL_TYPE_ONEHOUSE [--if-not-exists]
|
|
140
|
+
oh source delete SOURCE_NAME
|
|
141
|
+
```
|
|
142
|
+
Types: `APACHE_KAFKA`, `MSK_KAFKA`, `CONFLUENT_KAFKA`, `S3`, `GCS`, `ONEHOUSE_TABLE`, `POSTGRES`, `MY_SQL`
|
|
143
|
+
|
|
144
|
+
### Flows
|
|
145
|
+
```bash
|
|
146
|
+
oh flow show
|
|
147
|
+
oh flow describe FLOW_NAME
|
|
148
|
+
oh flow create FLOW_NAME \
|
|
149
|
+
--source mysource --lake mylake --database mydb --table-name mytable \
|
|
150
|
+
--write-mode IMMUTABLE --cluster mycluster \
|
|
151
|
+
[--performance-profile BALANCED] \
|
|
152
|
+
[--record-key-fields id] \
|
|
153
|
+
[--partition-key-fields date:DATE_STRING] \
|
|
154
|
+
[--precombine-key-field ts] \
|
|
155
|
+
[--min-sync-frequency-mins 5] \
|
|
156
|
+
[--quarantine-enabled] \
|
|
157
|
+
[--catalogs cat1] [--transformations tx1] [--validations val1]
|
|
158
|
+
oh flow alter FLOW_NAME --state PAUSE # or RESUME, CLEAN_AND_RESTART
|
|
159
|
+
oh flow alter FLOW_NAME --cluster newcluster # exactly one option at a time
|
|
160
|
+
oh flow delete FLOW_NAME
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Partition key field format: `FIELD:TYPE:INPUT_FORMAT:OUTPUT_FORMAT`
|
|
164
|
+
Write modes: `IMMUTABLE`, `MUTABLE`
|
|
165
|
+
Performance profiles: `BALANCED`, `FASTEST_READ`, `FASTEST_WRITE`
|
|
166
|
+
|
|
167
|
+
### Transformations
|
|
168
|
+
```bash
|
|
169
|
+
oh transformation show
|
|
170
|
+
oh transformation describe TX_NAME
|
|
171
|
+
oh transformation create TX_NAME --type ROW_FILTERING [--options FILTER_SQL="col > 0"]
|
|
172
|
+
oh transformation delete TX_NAME
|
|
173
|
+
```
|
|
174
|
+
Types: `CONVERT_CDC`, `ROW_FILTERING`, `DERIVED_DATE`, `ADD_CURRENT_TIMESTAMP`, `USER_PROVIDED`, `DATA_MASKING`, `L_PARSE_JSON`, `FLATTEN_STRUCT`, `EXPLODE_ARRAY`, `VECTOR_EMBEDDING`
|
|
175
|
+
|
|
176
|
+
### Validations
|
|
177
|
+
```bash
|
|
178
|
+
oh validation show
|
|
179
|
+
oh validation describe VAL_NAME
|
|
180
|
+
oh validation create VAL_NAME --type SCHEMA
|
|
181
|
+
oh validation delete VAL_NAME
|
|
182
|
+
```
|
|
183
|
+
Types: `SCHEMA`, `TIMESTAMP`
|
|
184
|
+
|
|
185
|
+
### Jobs
|
|
186
|
+
```bash
|
|
187
|
+
oh job show
|
|
188
|
+
oh job describe JOB_NAME
|
|
189
|
+
oh job create JOB_NAME --type JAR --cluster mycluster --parameters arg1 --parameters arg2
|
|
190
|
+
oh job create-and-run JOB_NAME --type PYTHON --cluster mycluster --parameters script.py
|
|
191
|
+
oh job alter JOB_NAME --cluster newcluster # or --parameters (not both)
|
|
192
|
+
oh job run JOB_NAME
|
|
193
|
+
oh job cancel-run JOB_RUN_UUID --job-name JOB_NAME
|
|
194
|
+
oh job describe-run JOB_RUN_UUID --job-name JOB_NAME
|
|
195
|
+
oh job show-runs JOB_NAME
|
|
196
|
+
oh job upload-jar JAR_NAME --options FILE_PATH=/path/to/file.jar
|
|
197
|
+
oh job replace-jar JAR_NAME --options FILE_PATH=/path/to/file.jar
|
|
198
|
+
```
|
|
199
|
+
Job types: `JAR`, `PYTHON`
|
|
200
|
+
|
|
201
|
+
### Service Principals
|
|
202
|
+
```bash
|
|
203
|
+
oh service-principal show
|
|
204
|
+
oh service-principal create SP_NAME
|
|
205
|
+
oh service-principal alter SP_NAME --new-name NEW_NAME
|
|
206
|
+
oh service-principal delete SP_NAME
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### API Tokens
|
|
210
|
+
```bash
|
|
211
|
+
oh api-token create TOKEN_NAME --service-principal SP_NAME
|
|
212
|
+
oh api-token delete TOKEN_NAME --service-principal SP_NAME
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Raw SQL
|
|
216
|
+
```bash
|
|
217
|
+
# Execute any SQL statement
|
|
218
|
+
oh sql exec --command "SHOW CLUSTERS"
|
|
219
|
+
|
|
220
|
+
# Fire-and-forget (returns request ID immediately, no polling)
|
|
221
|
+
oh sql exec --command "SHOW CLUSTERS" --async-mode
|
|
222
|
+
|
|
223
|
+
# Check status of a previous request
|
|
224
|
+
oh sql status REQUEST_ID
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## WITH options
|
|
228
|
+
|
|
229
|
+
Commands that accept extra configuration take `--options KEY=VALUE` (repeatable):
|
|
230
|
+
```bash
|
|
231
|
+
oh catalog create mycat --type HIVE \
|
|
232
|
+
--credential-type CREDENTIAL_TYPE_ONEHOUSE \
|
|
233
|
+
--options METASTORE_URI=thrift://host:9083 \
|
|
234
|
+
--options DATABASE=default
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Show SQL
|
|
238
|
+
|
|
239
|
+
Any command can print its generated SQL without making a network call:
|
|
240
|
+
```bash
|
|
241
|
+
oh cluster create mycluster --type SQL --show-sql
|
|
242
|
+
# CREATE CLUSTER `mycluster`
|
|
243
|
+
# TYPE = 'SQL'
|
|
244
|
+
|
|
245
|
+
oh flow create myflow --source src --lake l --database d \
|
|
246
|
+
--table-name t --write-mode IMMUTABLE --cluster c --show-sql
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Examples
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Create a managed lake and database
|
|
253
|
+
oh lake create prod-lake --type MANAGED \
|
|
254
|
+
--bucket-path s3://my-data-lake/ \
|
|
255
|
+
--default-services-cluster services-cluster
|
|
256
|
+
oh database create analytics --lake prod-lake
|
|
257
|
+
|
|
258
|
+
# Create a Kafka flow
|
|
259
|
+
oh source create kafka-src --type APACHE_KAFKA \
|
|
260
|
+
--credential-type CREDENTIAL_TYPE_ONEHOUSE \
|
|
261
|
+
--options BOOTSTRAP_SERVERS=kafka:9092
|
|
262
|
+
oh flow create orders-flow \
|
|
263
|
+
--source kafka-src --lake prod-lake \
|
|
264
|
+
--database analytics --table-name orders \
|
|
265
|
+
--write-mode MUTABLE --cluster ingest-cluster \
|
|
266
|
+
--record-key-fields order_id
|
|
267
|
+
|
|
268
|
+
# Monitor a table's compaction service
|
|
269
|
+
oh table service show --lake prod-lake --database analytics --table orders
|
|
270
|
+
oh table service run --lake prod-lake --database analytics --table orders --service COMPACT
|
|
271
|
+
|
|
272
|
+
# JSON output for scripting
|
|
273
|
+
oh --output json cluster show | jq '.'
|
|
274
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Onehouse CLI - A command-line tool for executing SQL commands against the Onehouse API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# For Python 3.8+
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
except ImportError:
|
|
9
|
+
# For Python 3.7
|
|
10
|
+
from importlib_metadata import version
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
__version__ = version("onehouse-cli")
|
|
14
|
+
except Exception:
|
|
15
|
+
# Fallback version if package is not installed
|
|
16
|
+
__version__ = "0.0.0.dev"
|
|
17
|
+
|
|
18
|
+
__all__ = ["cli_main", "configure_main"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Imported lazily (PEP 562) so that pulling in a leaf module does not drag in
|
|
22
|
+
# the whole command tree — and with it the SDK dependency. This keeps
|
|
23
|
+
# `oh-skill` readable on an install where onehouse-python-sdk is missing,
|
|
24
|
+
# which is precisely when someone needs the usage guide.
|
|
25
|
+
def __getattr__(name):
|
|
26
|
+
if name == "cli_main":
|
|
27
|
+
from .cli import main
|
|
28
|
+
return main
|
|
29
|
+
if name == "configure_main":
|
|
30
|
+
from .configure import main
|
|
31
|
+
return main
|
|
32
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Onehouse CLI — top-level Click entry point.
|
|
3
|
+
|
|
4
|
+
Global options (--profile, --timeout, --output) are propagated to every
|
|
5
|
+
subcommand via the Click context object (ctx.obj).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
|
|
10
|
+
from . import __version__
|
|
11
|
+
from .commands import (
|
|
12
|
+
cluster,
|
|
13
|
+
lake,
|
|
14
|
+
database,
|
|
15
|
+
table,
|
|
16
|
+
catalog,
|
|
17
|
+
source,
|
|
18
|
+
flow,
|
|
19
|
+
transformation,
|
|
20
|
+
validation,
|
|
21
|
+
job,
|
|
22
|
+
service_principal,
|
|
23
|
+
api_token,
|
|
24
|
+
install,
|
|
25
|
+
skill as skill_cmd,
|
|
26
|
+
sql as sql_cmd,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_EPILOG = """\
|
|
31
|
+
Agents and new users: run `oh skill` for a complete usage guide covering
|
|
32
|
+
credential setup, the SQL each command emits, and destructive-operation safety.
|
|
33
|
+
|
|
34
|
+
Note: deletes execute immediately with no confirmation prompt. Use --show-sql
|
|
35
|
+
on any command to preview the statement without running it.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CliContext:
|
|
40
|
+
def __init__(self, profile: str | None, timeout: int, output: str):
|
|
41
|
+
self.profile = profile
|
|
42
|
+
self.timeout = timeout
|
|
43
|
+
self.output = output
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@click.group(
|
|
47
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
48
|
+
epilog=_EPILOG,
|
|
49
|
+
)
|
|
50
|
+
@click.version_option(__version__, "-v", "--version")
|
|
51
|
+
@click.option(
|
|
52
|
+
"--profile", "-p",
|
|
53
|
+
default=None,
|
|
54
|
+
envvar="ONEHOUSE_PROFILE",
|
|
55
|
+
help="Credentials profile to use (default: profile named in _default key).",
|
|
56
|
+
)
|
|
57
|
+
@click.option(
|
|
58
|
+
"--timeout", "-t",
|
|
59
|
+
default=10,
|
|
60
|
+
show_default=True,
|
|
61
|
+
type=int,
|
|
62
|
+
help="Timeout in minutes for async operations.",
|
|
63
|
+
)
|
|
64
|
+
@click.option(
|
|
65
|
+
"--output", "-o",
|
|
66
|
+
default="table",
|
|
67
|
+
show_default=True,
|
|
68
|
+
type=click.Choice(["table", "json"], case_sensitive=False),
|
|
69
|
+
help="Output format for results.",
|
|
70
|
+
)
|
|
71
|
+
@click.pass_context
|
|
72
|
+
def cli(ctx: click.Context, profile: str | None, timeout: int, output: str) -> None:
|
|
73
|
+
"""Onehouse CLI — manage your Onehouse project from the command line."""
|
|
74
|
+
ctx.ensure_object(dict)
|
|
75
|
+
ctx.obj = CliContext(profile=profile, timeout=timeout, output=output)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
cli.add_command(cluster.cluster)
|
|
79
|
+
cli.add_command(lake.lake)
|
|
80
|
+
cli.add_command(database.database)
|
|
81
|
+
cli.add_command(table.table)
|
|
82
|
+
cli.add_command(catalog.catalog)
|
|
83
|
+
cli.add_command(source.source)
|
|
84
|
+
cli.add_command(flow.flow)
|
|
85
|
+
cli.add_command(transformation.transformation)
|
|
86
|
+
cli.add_command(validation.validation)
|
|
87
|
+
cli.add_command(job.job)
|
|
88
|
+
cli.add_command(service_principal.service_principal, name="service-principal")
|
|
89
|
+
cli.add_command(api_token.api_token, name="api-token")
|
|
90
|
+
cli.add_command(sql_cmd.sql)
|
|
91
|
+
cli.add_command(skill_cmd.skill)
|
|
92
|
+
cli.add_command(install.install)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def main() -> None:
|
|
96
|
+
# Standalone mode turns Click errors into a one-line `Error: ...` message
|
|
97
|
+
# and the conventional exit code (1 = failure, 2 = usage error).
|
|
98
|
+
cli()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
main()
|