powerpipe query
List, view, and run Powerpipe queries. You can run named queries or any arbitrary SQL.
Usage
Sub-Commands
Command | Description |
---|---|
list | List queries from the current mod and its direct dependents. |
run | Run a query from the current mod or its direct dependents. |
show | Show details of a query from the current mod or its direct dependents. |
powerpipe query list
List queries from the current mod and its direct dependents.
Examples
List queries:
List all queries in JSON format:
List queries using settings from a workspace:
powerpipe query show
Show details of a query from the current mod or its direct dependents.
Examples
Show details of a single query in the current mod:
Show details of a single query in a direct dependency mod:
Show details of a query in JSON format:
Show details of a query using settings from a workspace:
powerpipe query run
Run a query from the current mod or its direct dependents.
Arguments
Flag | Description |
---|---|
--arg string=string | Specify the value for a query param. Multiple --arg arguments may be passed. |
--database | DEPRECATED - See Setting the Database for the new syntax. Sets the database that Powerpipe will connect to. This defaults to the local Steampipe database, but can be any PostgreSQL, MySQL, DuckDB, or SQLite database. |
--export string | Export query output to a file. You may export multiple output formats for a single query run 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 csv, line, json,pps (snapshot), pretty, plain. |
--header string | Specify whether to include column headers in csv output/export (default true). |
--input | Enable/Disable interactive prompts for missing variables. To disable prompts and fail on missing variables, use --input=false. This is useful when running from scripts. (default true) |
--mod-install | Specify whether to install mod dependencies before running the query (default true) |
--output string | Select the console output format. Defaults to text. Possible values are csv, line, json,pps (snapshot), pretty, plain. |
--pipes-host | Sets the Turbot Pipes host used when connecting to Turbot Pipes workspaces. See PIPES_HOST for details. |
--pipes-token | Sets the Turbot Pipes authentication token used when connecting to Turbot Pipes workspaces. See 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 300. |
--search-path strings | Set a comma-separated list of connections to use as a custom search path for the query run. |
--search-path-prefix strings | Set a comma-separated list of connections to use as a prefix to the current search path for the query run. |
--separator string | A single character to use as a separator string for csv output (defaults to ,) |
--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=string | The title to give a snapshot when uploading to Turbot Pipes. |
--timing | Turn on the query timer. |
--var string=string | Specify the value of a variable. Multiple --var arguments may be passed. |
--var-file strings | Specify a .ppvar file containing variable values. |
Examples
Run a named query:
Run an ad-hoc query:
Run a query and return CSV:
Run a query and export results to a CSV file:
Run a query and export results to a CSV file with a specific name:
Run a query and export results in multiple formats:
Run a named query and pass arguments:
Run an ad-hoc query and create a snapshot file:
Run a query against a pipes workspace:
Run a query and upload a snapshot with workspace visibility in your user workspace.
Run a query and upload a snapshot with anyone_with_link visibility in your default workspace.
Run a query and upload a snapshot with anyone_with_link visibility to a specific workspace.
Run a query, upload a snapshot with workspace visibility in your user workspace, and tag the snapshot:
Run a query with a specific search_path:
Run a query with a specific search_path_prefix: