From 884be299e74bbb5ac858bd7752f268881adb56c6 Mon Sep 17 00:00:00 2001 From: Jon Udell Date: Mon, 27 Jan 2025 20:49:50 -0800 Subject: [PATCH] update cli usages/examples --- docs/reference/cli/collect.md | 3 +- docs/reference/cli/compact.md | 9 +---- docs/reference/cli/connect.md | 16 +++++++- docs/reference/cli/partition.md | 4 +- docs/reference/cli/query.md | 65 +++++++++++++++------------------ docs/reference/cli/table.md | 4 +- 6 files changed, 51 insertions(+), 50 deletions(-) diff --git a/docs/reference/cli/collect.md b/docs/reference/cli/collect.md index 7dd8840..42ee7ca 100644 --- a/docs/reference/cli/collect.md +++ b/docs/reference/cli/collect.md @@ -17,8 +17,7 @@ Run a **collection**. |-|- | `--compact` | Compact the Parquet files after collection (default true) | `--from string` | Collect days newer than a relative or absolute date. -| `--output output` | Output format; one of: json, table (default text) -| `--help` | Help for connect +| `--help` | Help for collect ## Examples diff --git a/docs/reference/cli/compact.md b/docs/reference/cli/compact.md index 66c704d..b96e68b 100644 --- a/docs/reference/cli/compact.md +++ b/docs/reference/cli/compact.md @@ -6,9 +6,6 @@ Compact multiple Parquet files per day to one per day. # tailpipe compact ->[!NOTE] -> Given that collect's --compact defaults to true, why would I use this? - # Usage ```bash tailpipe compact [table] [table.partition] [args] @@ -18,10 +15,8 @@ Compact multiple Parquet files per day to one per day. | Flag | Description |-|- -| `--from string` | Compact days newer than a relative or absolute date. -| `--to string` | Compact days older than a relative or absolute date. -| `--output output` | Output format; one of: json, table (default text) -| `--help` | Help for connect +| `--help` | Help for compact +| `--output` | Output format; one of: json, table (default text) ## Examples diff --git a/docs/reference/cli/connect.md b/docs/reference/cli/connect.md index c9bf0d3..89b640a 100644 --- a/docs/reference/cli/connect.md +++ b/docs/reference/cli/connect.md @@ -16,9 +16,11 @@ Return a connection string for a database, with a schema determined by the provi | Flag | Description |-|- | `--from string` | Specify the start time -| `--to string` | Specify the end time -| `--output output` | Output format; one of: json, table (default text) | `--help` | Help for connect +| `--index strings` | Specify the index(es) to use +| `--output` | Output format; one of: json, table (default text) +| `--partition strings` | Specify the partition(s) to use +| `--to string` | Specify the end time ## Examples @@ -34,6 +36,16 @@ tailpipe connect --from 2025-01-01 > > duckdb /home/jon/.tailpipe/data/default/tailpipe_20241212134120.db +```bash +tailpipe connect --from 2025-01-01 +/home/jon/.tailpipe/data/default/tailpipe_20250115140447.db +``` + +```bash +tailpipe connect --from 2025-01-01 +/home/jon/.tailpipe/data/default/tailpipe_20250115140447.db +``` + Show the filepath for the connected database: ```bash diff --git a/docs/reference/cli/partition.md b/docs/reference/cli/partition.md index 83b8417..066c477 100644 --- a/docs/reference/cli/partition.md +++ b/docs/reference/cli/partition.md @@ -8,18 +8,18 @@ List, show, and delete Tailpipe partitions. ## Usage ```bash +tailpipe partition delete table_name.partition_name [args] tailpipe partition list [args] tailpipe partition show table_name.partition_name [args] -tailpipe partition delete table_name.partition_name [args] ``` ## Sub-Commands | Command | Description |-|- +| [delete](#tailpipe-partition-delete) | Delete a partition. | [list](#tailpipe-partition-list) | List all partitions. | [show](#tailpipe-partition-show) | Show details of a partition. -| [delete](#tailpipe-partition-delete) | Delete a partition. ## tailpipe partition list diff --git a/docs/reference/cli/query.md b/docs/reference/cli/query.md index 6bdff6b..0996f1e 100644 --- a/docs/reference/cli/query.md +++ b/docs/reference/cli/query.md @@ -4,9 +4,6 @@ title: tailpipe query # tailpipe query ->[!NOTE] -> Cloned from Steampipe with minor variation. I took out search_path and search_path_pefix. Should also remove timing? query-timeout? - Query a Tailpipe table ## Usage @@ -36,22 +33,14 @@ tailpipe query {query} [flags] | Argument | Description |--|-- -| `--export string` | Export query output to a file. You may export multiple output formats by entering multiple `--export` arguments. If a file path is specified as an argument, its type will be inferred by the suffix. Supported export formats are `sps` (`snapshot`). +| `--from string` | Specify the start time | `--header string` | Specify whether to include column headers in csv and table output (default true`)| -| `--help` | Help for `tailpipe query`. -| `--output string` | Select the console output format. Possible values are `line, csv, json, table, snapshot` (default `table`). -| `--pipes-host` | Sets the Turbot Pipes host used when connecting to Turbot Pipes workspaces. See [PIPES_HOST](reference/env-vars/pipes_host) for details. - `--pipes-token` | Sets the Turbot Pipes authentication token used when connecting to Turbot Pipes workspaces. See [PIPES_TOKEN](reference/env-vars/pipes_token) for details. -| `--progress` | Enable or disable progress information. By default, progress information is shown - set `--progress=false` to hide the progress bar. -| `--query-timeout int` | The query timeout, in seconds. The default is `0` (no timeout). -| `--share` | Create snapshot in Turbot Pipes with `anyone_with_link` visibility. -| `--snapshot` | Create snapshot in Turbot Pipes with the default (`workspace`) visibility. -| `--snapshot-location string` | The location to write snapshots - either a local file path or a Turbot Pipes workspace. -| `--snapshot-tag string=string` | Specify tags to set on the snapshot. Multiple `--snapshot-tag` arguments may be passed. -| `--snapshot-title string` | The title to give a snapshot when uploading to Turbot Pipes. -| `--timing=string` | Enable or disable query execution timing: `off` (default), `on`, or `verbose`. -| `--workspace-database` | Sets the database that Tailpipe will connect to. This can be `local` (the default) or a remote Turbot Pipes database. See [STEAMPIPE_WORKSPACE_DATABASE](/docs/reference/env-vars/steampipe_workspace_database) for details. - +| `--help` | Help for `tailpipe query` +| `--index strings` | Specify the index(es) to use +| `--output output | Output format; one of: table, csv, json, line (default table) +| `--partition strings` | Specify the partition(s) to use +| `--separator string` | Separator string for csv output (default ",") +| `--to string` | Specify the end time ## Examples @@ -63,52 +52,58 @@ tailpipe query Run a specific query directly: ```bash -tailpipe query "select * from aws_cloudtrail_log" +tailpipe query "select count(*) from aws_cloudtrail_log" ``` -Run a query and save a [snapshot](/docs/snapshots/batch-snapshots): +Query from a date: ```bash -tailpipe query --snapshot "select * from aws_cloudtrail_log" +tailpipe query "select count(*) from aws_cloudtrail_log" --from 2025-01-01 ``` -Run a query and share a [snapshot](/docs/snapshots/batch-snapshots): +Query within a range of dates: ```bash -tailpipe query --share "select * from aws_cloudtrail_log" +tailpipe query "select count(*) from aws_cloudtrail_log" --from 2025-01-01 --to 2025-01-31 ``` -Run the SQL command in the `my_queries/my_query.sql` file: +Query a specific partition: ```bash -tailpipe query my_queries/my_query.sql +tailpipe query "select count(*) from aws_cloudtrail_log --partition flaws +``` + +Query two partitions: +```bash +tailpipe query "select count(*) from aws_cloudtrail_log --partition flaws,prod ``` -Run the SQL commands in all `.sql` files in the `my_queries` directory and concatenate the results: +Query a specific index: ```bash -tailpipe query my_queries/*.sql +tailpipe query "select count(*) from aws_cloudtrail_log --index 605491513981 ``` -Run a query and report the query execution time: +Run a query and save a [snapshot](/docs/snapshots/batch-snapshots): ```bash -tailpipe query "select * from aws_cloudtrail_log" --timing +tailpipe query --snapshot "select * from aws_cloudtrail_log" ``` -Run a query and report the query execution time and details for each scan: +Run a query and share a [snapshot](/docs/snapshots/batch-snapshots): ```bash -tailpipe query "select * from aws_cloudtrail_log" --timing=verbose +tailpipe query --share "select * from aws_cloudtrail_log" ``` -Run a query and return output in json format: +Run the SQL command in the `my_queries/my_query.sql` file: ```bash -tailpipe query "select * from aws_cloudtrail_log" --output json +tailpipe query my_queries/my_query.sql ``` +``` Run a query and return output in CSV format: ```bash -tailpipe query "select * from aws_cloudtrail_log" --output csv +tailpipe query "select * from aws_cloudtrail_log limit 1000" --output csv ``` Run a query and return output in pipe-separated format: ```bash -tailpipe query "select * from aws_cloudtrail_log" --output csv --separator '|' +tailpipe query "select * from aws_cloudtrail_log limit 1000" --output csv --separator '|' ``` diff --git a/docs/reference/cli/table.md b/docs/reference/cli/table.md index 65ddd85..798dba6 100644 --- a/docs/reference/cli/table.md +++ b/docs/reference/cli/table.md @@ -45,11 +45,11 @@ Show details for a table. Show details in table format. ```bash -tailpipe table show github_audit_log.prod +tailpipe table show pipes_audit_log.prod ``` Show details in JSON format. ```bash -tailpipe table show github_audit_log.prod --output json +tailpipe table show pipes_audit_log.prod --output json ```