Interactive Query Shell
Steampipe provides an interactive query shell that provides features like auto-complete, syntax highlighting, and command history to assist you in writing queries.
To open the query shell, run steampipe query with no arguments:
Notice that the prompt changes, indicating that you are in the Steampipe shell.
You can exit the query shell by pressing Ctrl+d on a blank line, or using the .exit command.
Autocomplete
The query shell includes an autocomplete feature that will suggest words as you type. Type . (period). Notice that the autocomplete appears with a list of the Steampipe meta-commands commands that start with .:
As you continue to type, the autocomplete will continue to narrow down the list of tables to only those that match.
You can cycle forward through the list with the Tab key, or backward with Shift+Tab. Tab to select .tables and hit enter. The .tables command is executed, and lists all the tables that are installed and available to query.
History
The query shell supports command history, allowing you to retrieve, run, and edit previous commands. The command history works like typical unix shell command history, and persists across query sessions. When on a new line, you can cycle back through the history with the Up Arrow or Ctrl+p and forward with Down Arrow or Ctrl+n.
Key bindings
The query shell supports standard emacs-style key bindings:
Keys | Description |
---|---|
Ctrl+a | Move the cursor to the beginning of the line |
Ctrl+e | Move the cursor to the end of the line |
Ctrl+f | Move the cursor forward 1 character |
Ctrl+b | Move the cursor backward 1 character |
Ctrl+w | Delete a word backwards |
Ctrl+d | Delete a character forwards. On a blank line, Ctrl+d will exit the console |
Backspace | Delete a character backwards |
Ctrl+p, Up Arrow | Go to the previous command in your history |
Ctrl+n, Down Arrow | Go to the next command in your history |
Exploring Tables & Connections
Connections
A Steampipe Connection represents a set of tables for a single data source. Each connection is represented as a distinct Postgres schema.
A connection is associated with a single instance of a single plugin type. The boundary and scope of the connection varies by plugin, but is typically aligned with the vendor's CLI tool or API:
- An azure connection contains tables for a single Azure subscription
- An aws connection contains tables for a single AWS account
To view the installed connections, you can use the .connections :
Alternately, you can use .inspect command with no arguments. The output is the same:
Tables
Steampipe tables provide an interface for querying dynamic data using standard SQL. Steampipe tables do not actually store data, they query the source on the fly. The details are hidden from you though - you just query them like any other table!
To view the tables in all active connections, you can use the .tables command:
To view only the tables in a specific connection, you can use the .inspect command with a connection name. For example, to show all the tables in the aws connection:
Columns
To get information about the columns in a table, run .inspect {connection}.{table}: