@saptools/cf-hana 0.1.6 → 0.2.1
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/CHANGELOG.md +13 -0
- package/README.md +57 -9
- package/dist/cli.js +893 -27
- package/dist/cli.js.map +1 -1
- package/dist/index.js +34 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 - 2026-06-25
|
|
4
|
+
|
|
5
|
+
- Change CLI `query` output for `SELECT`/`WITH` statements to compact CSV and
|
|
6
|
+
remove `--format` from `query`.
|
|
7
|
+
- Default bare `SELECT` queries to at most 100 returned rows, with accurate
|
|
8
|
+
N+1 truncation detection.
|
|
9
|
+
- Limit visible SELECT data cells to 128 characters by default, configurable
|
|
10
|
+
with `--cell-limit <n>` up to 10,000.
|
|
11
|
+
- Add `query --save` and `cf-hana result` commands to save exact returned rows
|
|
12
|
+
for 60 minutes, inspect rows/cells/JSON paths by ref, search saved values,
|
|
13
|
+
export exact cells, and prune local result sessions.
|
|
14
|
+
- Keep programmatic query APIs and write backups full-fidelity.
|
|
15
|
+
|
|
3
16
|
## 0.1.6 - 2026-06-23
|
|
4
17
|
|
|
5
18
|
- Expand fake-backed E2E coverage for complex `UPDATE` and `DELETE` backups,
|
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ login on the hot path) and connections are pooled and reused within a process.
|
|
|
26
26
|
under `~/.saptools/cf-hana/histories/` with five-day retention.
|
|
27
27
|
- **Write backups** — CLI `UPDATE` and `DELETE` statements create a local CSV
|
|
28
28
|
backup of matching rows before the write runs.
|
|
29
|
+
- **Compact CLI results** — CLI `SELECT`/`WITH` output is compact CSV with
|
|
30
|
+
bounded cells and optional saved refs for exact follow-up inspection.
|
|
29
31
|
- **Safety guard** — opt-in read-only mode and a destructive-statement guard
|
|
30
32
|
(blocks `DROP`/`TRUNCATE`/`ALTER` and unscoped `UPDATE`/`DELETE`).
|
|
31
33
|
- **Typed results** — `query<TRow>()` returns typed rows.
|
|
@@ -83,24 +85,70 @@ cf-hana columns <selector> <schema.table> List the columns of a table
|
|
|
83
85
|
cf-hana count <selector> <schema.table> Count rows in a table
|
|
84
86
|
cf-hana ping <selector> Connect and measure round-trip latency
|
|
85
87
|
cf-hana info <selector> Print the resolved connection metadata
|
|
88
|
+
cf-hana result <command> Inspect saved query refs
|
|
86
89
|
```
|
|
87
90
|
|
|
88
|
-
Common options: `--
|
|
89
|
-
`--binding
|
|
90
|
-
`--
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
Common options: `--refresh`, `--role <runtime|hdi>`, `--binding <name>` /
|
|
92
|
+
`--binding-index <n>`, `--timeout <ms>`, `--read-only`, `--allow-destructive`,
|
|
93
|
+
`--limit <n>`, `--no-auto-limit`. The `query` command also accepts
|
|
94
|
+
`--param <value>` (repeatable), `--cell-limit <n>`, `--save`, and
|
|
95
|
+
`--result-ttl-minutes <n>`. `tables` and `columns` still support
|
|
96
|
+
`--format <table|json|csv>`. CLI `UPDATE` and `DELETE` statements are backed up
|
|
97
|
+
automatically before the write runs.
|
|
93
98
|
|
|
94
99
|
```bash
|
|
95
100
|
cf-hana query eu10/example-org/space-demo/app-demo "SELECT ID, STATUS FROM ORDERS WHERE STATUS = ?" \
|
|
96
|
-
--param OPEN --
|
|
101
|
+
--param OPEN --read-only --save
|
|
97
102
|
cf-hana query app-demo "UPDATE ORDERS SET STATUS = ? WHERE ID = ?" \
|
|
98
|
-
--param DONE --param 42
|
|
103
|
+
--param DONE --param 42
|
|
99
104
|
cf-hana tables app-demo
|
|
100
105
|
cf-hana columns app-demo ORDERS_APP.ORDERS
|
|
101
106
|
cf-hana ping eu10/example-org/space-demo/app-demo
|
|
102
107
|
```
|
|
103
108
|
|
|
109
|
+
## Compact query output and saved refs
|
|
110
|
+
|
|
111
|
+
For CLI `SELECT` and `WITH` statements, stdout is CSV. Bare reads return at most
|
|
112
|
+
100 rows by default; pass `--limit <n>` to request more, or `--no-auto-limit` to
|
|
113
|
+
disable the automatic cap. Data cells display at most 128 Unicode characters by
|
|
114
|
+
default; pass `--cell-limit <n>` to choose a value from 1 through 10,000.
|
|
115
|
+
|
|
116
|
+
Use `--save` when you need exact values later:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
cf-hana query app-demo "SELECT ID, CONTENT FROM ORDERS" --read-only --save
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Saved output starts with a control line, then CSV:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
ref=q7f3a9c2b
|
|
126
|
+
ID,CONTENT
|
|
127
|
+
1,first 128 visible characters
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The ref is not a CSV column. Exact returned rows are stored under
|
|
131
|
+
`~/.saptools/cf-hana/results/` for 60 minutes by default. Only returned rows are
|
|
132
|
+
stored; rows beyond the selected `--limit` are not fetched or saved.
|
|
133
|
+
|
|
134
|
+
Follow-up commands:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
cf-hana result show q7f3a9c2b
|
|
138
|
+
cf-hana result show q7f3a9c2b --row 1
|
|
139
|
+
cf-hana result show q7f3a9c2b --row 1 --column CONTENT --length 1000
|
|
140
|
+
cf-hana result show q7f3a9c2b --row 1 --column PAYLOAD --path /items/0
|
|
141
|
+
cf-hana result search q7f3a9c2b "ready"
|
|
142
|
+
cf-hana result export q7f3a9c2b --row 1 --column CONTENT --output content.txt
|
|
143
|
+
cf-hana result list
|
|
144
|
+
cf-hana result prune
|
|
145
|
+
cf-hana result clear
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`--save` is available only for `SELECT` and `WITH` statements. The programmatic
|
|
149
|
+
API keeps returning full-fidelity `QueryResult` values and does not write result
|
|
150
|
+
refs.
|
|
151
|
+
|
|
104
152
|
## Programmatic API
|
|
105
153
|
|
|
106
154
|
| Export | Purpose |
|
|
@@ -167,14 +215,14 @@ The backup is saved before the write runs:
|
|
|
167
215
|
`statement.sql` contains the original write statement. `backup.csv` contains the
|
|
168
216
|
rows returned by the derived `SELECT`. Backup folders are not deleted by
|
|
169
217
|
`cf-hana`; clean them up manually when they are no longer needed. The backup path
|
|
170
|
-
is printed to stderr so
|
|
218
|
+
is printed to stderr so stdout remains parseable.
|
|
171
219
|
|
|
172
220
|
## Safety
|
|
173
221
|
|
|
174
222
|
- **Read-only mode** (`readOnly` / `--read-only`) rejects every DML and DDL statement.
|
|
175
223
|
- **Destructive guard** blocks `DROP` / `TRUNCATE` / `ALTER` and `UPDATE` / `DELETE`
|
|
176
224
|
without a `WHERE` clause unless `allowDestructive` / `--allow-destructive` is set.
|
|
177
|
-
- **Auto-limit** appends a `LIMIT` to bare `SELECT` statements (default
|
|
225
|
+
- **Auto-limit** appends a `LIMIT` to bare `SELECT` statements (default 100);
|
|
178
226
|
`QueryResult.truncated` reports when it clipped the result. Disable with
|
|
179
227
|
`autoLimit: false` / `--no-auto-limit`.
|
|
180
228
|
|