Skip to content

Commit 38ac3a7

Browse files
chore: bump jmespath-extensions to v0.7.0 (#516)
Update to jmespath-extensions v0.7.0 which adds: - CSV/TSV formatting functions (to_csv, to_tsv, to_csv_table) - Utility functions (pretty, html_escape, env) Convert remaining @csv jq examples in docs to use native JMESPath: - to_csv() for single row output - to_csv_table() for multi-row with headers Update function categories reference to include new Format category.
1 parent a911615 commit 38ac3a7

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

Cargo.lock

Lines changed: 25 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/redisctl/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ thiserror = { workspace = true }
5151
serde_yaml = { workspace = true }
5252
comfy-table = { workspace = true }
5353
jmespath = { workspace = true }
54-
jmespath_extensions = { version = "0.6", features = ["full"] }
54+
jmespath_extensions = { version = "0.7", features = ["full"] }
5555
config = { workspace = true }
5656

5757
# Keyring for Files.com API key storage (separate from profile credentials)

docs/src/common-features/jmespath-queries.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ redisctl enterprise database get 1 -q 'json_diff(current_config, desired_config)
330330
| Object | `keys`, `values`, `pick`, `omit`, `deep_merge` |
331331
| Math | `round`, `floor`, `ceil`, `sum`, `avg`, `max`, `min`, `stddev` |
332332
| Type | `type_of`, `is_array`, `is_string`, `to_boolean` |
333-
| Utility | `if`, `coalesce`, `default`, `now` |
333+
| Utility | `if`, `coalesce`, `default`, `now`, `env` |
334334
| DateTime | `format_date`, `time_ago`, `relative_time`, `is_weekend` |
335335
| Duration | `format_duration`, `parse_duration` |
336336
| Network | `is_private_ip`, `cidr_contains`, `ip_to_int` |
@@ -342,6 +342,7 @@ redisctl enterprise database get 1 -q 'json_diff(current_config, desired_config)
342342
| Semver | `semver_compare`, `semver_satisfies`, `semver_parse` |
343343
| Fuzzy | `levenshtein`, `soundex`, `jaro_winkler` |
344344
| JSON Patch | `json_diff`, `json_patch`, `json_merge_patch` |
345+
| Format | `to_csv`, `to_tsv`, `to_csv_table`, `pretty`, `html_escape` |
345346

346347
For the complete list, see the [jmespath-extensions documentation](https://docs.rs/jmespath_extensions).
347348

docs/src/enterprise/monitoring/usage-report.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,10 @@ mkdir -p "$REPORT_DIR"
172172
# Export full report
173173
redisctl enterprise usage-report export -o "$REPORT_DIR/usage-$DATE.json"
174174

175-
# Create summary CSV
176-
redisctl enterprise usage-report get -q '{
177-
date: report_date,
178-
databases: usage.total_databases,
179-
shards: usage.total_shards,
180-
memory_gb: usage.total_memory_gb,
181-
nodes: usage.total_nodes
182-
}' | jq -r '[.date, .databases, .shards, .memory_gb, .nodes] | @csv' >> "$REPORT_DIR/usage-summary.csv"
175+
# Create summary CSV using JMESPath to_csv()
176+
redisctl enterprise usage-report get -q '
177+
to_csv([report_date, usage.total_databases, usage.total_shards, usage.total_memory_gb, usage.total_nodes])
178+
' --raw >> "$REPORT_DIR/usage-summary.csv"
183179

184180
# Email report
185181
echo "Redis Enterprise Usage Report for $MONTH" | \
@@ -240,9 +236,10 @@ Tabular format for spreadsheet analysis:
240236
# Export to CSV
241237
redisctl enterprise usage-report export -o report.csv -f csv
242238

243-
# Export specific data as CSV
244-
redisctl enterprise usage-report get -q 'databases' | \
245-
jq -r '["name","memory_mb","shards"], (.[] | [.name, .memory_mb, .shard_count]) | @csv' > databases.csv
239+
# Export specific data as CSV using JMESPath to_csv_table()
240+
redisctl enterprise usage-report get -q '
241+
to_csv_table(databases, [`"name"`, `"memory_mb"`, `"shard_count"`])
242+
' --raw > databases.csv
246243

247244
# Import to Google Sheets
248245
redisctl enterprise usage-report export -o /tmp/usage.csv -f csv

0 commit comments

Comments
 (0)