Skip to content

Commit

Permalink
remove mod named query section from batch-query
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsmyth committed Mar 6, 2024
1 parent c6f7d59 commit 690776a
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions docs/query/batch-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,47 +93,3 @@ vpc-0bf2ca1f6a9319eea|172.16.0.0/16|available
vpc-9d7ae1e7|172.31.0.0/16|available
vpc-0de60777fdfd2ebc7|10.66.8.0/22|available
```


## Named Queries
Steampipe also allows you to run **named queries** defined in [mods](mods/overview).

Creating your own named queries is simple. First, you need to create a mod for your queries:

```bash
mkdir my-queries
```

By default, Steampipe looks for mods in the current directory, though you can specify a different directory with the `-mod-location` argument. Lets change to that directory and initialize the mod:

```bash
cd my-queries
steampipe mod init
```

Steampipe will create a **query** object for every `.sql` file in your mod directory, though you can also define [query](reference/mod-resources/query) resources using HCL in `.sp` files if you prefer.

If you have not done so already, create the `s3_versioning_disabled.sql` file from the previous example in your mod folder.

You can now run your query by name in an interactive session or from from command line.

Start the interactive query shell:
```bash
steampipe query
```

You can run your query by name:
```sql
query.s3_versioning_disabled
```

Your saved queries even show up in the auto-complete list, making them easier to find and recall!

You can even run the named query in batch mode:
```bash
steampipe query "query.s3_versioning_disabled"
```

Steampipe makes it easy to build a library of custom queries that you can effortlessly recall and re-use!


0 comments on commit 690776a

Please sign in to comment.