powerpipe query

List, view, and run Powerpipe queries. You can run named queries or any arbitrary SQL.

Usage

Sub-Commands

CommandDescription
listList queries from the current mod and its direct dependents.
runRun a query from the current mod or its direct dependents.
showShow 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

FlagDescription
--arg string=stringSpecify the value for a query param. Multiple --arg arguments may be passed.
--databaseDEPRECATED - 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 stringExport 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 stringSpecify whether to include column headers in csv output/export (default true).
--inputEnable/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-installSpecify whether to install mod dependencies before running the query (default true)
--output stringSelect the console output format. Defaults to text. Possible values are csv, line, json,pps (snapshot), pretty, plain.
--pipes-hostSets the Turbot Pipes host used when connecting to Turbot Pipes workspaces. See PIPES_HOST for details.
--pipes-tokenSets the Turbot Pipes authentication token used when connecting to Turbot Pipes workspaces. See PIPES_TOKEN for details.
--progressEnable or disable progress information. By default, progress information is shown - set --progress=false to hide the progress bar.
--query-timeout intThe query timeout, in seconds. The default is 300.
--search-path stringsSet a comma-separated list of connections to use as a custom search path for the query run.
--search-path-prefix stringsSet a comma-separated list of connections to use as a prefix to the current search path for the query run.
--separator stringA single character to use as a separator string for csv output (defaults to ,)
--shareCreate snapshot in Turbot Pipes with anyone_with_link visibility.
--snapshotCreate snapshot in Turbot Pipes with the default (workspace) visibility.
--snapshot-location stringThe location to write snapshots - either a local file path or a Turbot Pipes workspace
--snapshot-tag string=stringSpecify tags to set on the snapshot. Multiple --snapshot-tag arguments may be passed.
--snapshot-title string=stringThe title to give a snapshot when uploading to Turbot Pipes.
--timingTurn on the query timer.
--var string=stringSpecify the value of a variable. Multiple --var arguments may be passed.
--var-file stringsSpecify 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: