Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

steampipe accepts the query on STDIN #499

Closed
suhlig opened this issue May 23, 2021 · 2 comments · Fixed by #516
Closed

steampipe accepts the query on STDIN #499

suhlig opened this issue May 23, 2021 · 2 comments · Fixed by #516
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@suhlig
Copy link

suhlig commented May 23, 2021

Today, when running a query from the command line, steampipe query takes the query as parameter. When composing pipelines, I would like to provide the query on STDIN:

cat <<EOQ | steampipe query --output json                                                                                                                                           
  select
    title, url
  from
    hackernews_top
  order by
    score desc
  limit
    10
EOQ

This is already possible with psql (after steampipe service start):

cat <<EOQ | psql 'postgres://steampipe:********@localhost:9193/steampipe?sslmode=disable'
  select
    title, url
  from
    hackernews_top
  order by
    score desc
  limit
    10
EOQ

In the examples above, cat is used as a placeholder for other commands generating a query.

Thanks for steampipe, please keep up the good work!

@suhlig suhlig added the enhancement New feature or request label May 23, 2021
@e-gineer
Copy link
Contributor

Nice suggestion @suhlig - thanks!

We'd need to make sure this is limited to input on the steampipe query subcommand only, but agree it would be good to accept stdin.

In the meantime, steampipe query accepts the query directly as the argument ... are you able to use that instead? For example:

steampipe query --output json "
  select
    title, url
  from
    hackernews_top
  order by
    score desc
  limit
    10
"

@suhlig
Copy link
Author

suhlig commented May 24, 2021

Thanks - I can sure use the argument. I just think it's easier to read the command line and understand the whole pipeline when constructed the way I propose (especially if it becomes more complex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants