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

Join with net_http_request table fails to get quals to do the HTTP queries #227

Open
e-gineer opened this issue Aug 6, 2022 · 0 comments

Comments

@e-gineer
Copy link
Contributor

e-gineer commented Aug 6, 2022

Thought I'd try joining the hackernews_new table with the net_http_request table to try and send slack messages for new items ... fun idea, but unfortunately it doesn't work because of the postgres plan. I couldn't find a way to trick it either.

with new_posts as (
  select
    '{"text": "' || title || '"}' as slack_msg
  from
    hackernews_new
  where
    time > now() - interval '1 min'
  order by
    time desc
)
select
  r.url,
  r.method,
  r.response_status_code,
  jsonb_pretty(r.request_headers) as request_headers,
  r.response_body
from
  net_http_request as r,
  new_posts as p
where
  r.url = 'https://hooks.slack.com/services/<redacted>/<redacted>/<redacted>'
  and r.method = 'POST'
  and r.request_body = p.slack_msg
  and r.request_headers = '{"content-type": "application/json"}'::jsonb

Here is the quals log I see:

2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes: urls=["https://hooks.slack.com/services/<redacted>/<redacted>/<redacted>"]
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes:
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   query cols=
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | request_body = ?
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | url = https://hooks.slack.com/services/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
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | method = POST
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | request_headers = {
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   |     "content-type": "application/json"
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | }
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin: [DEBUG] 165980314538: listBaseRequestAttributes:
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   request headers=
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | {
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   |     "content-type": "application/json"
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   | }
2022-08-06 16:25:45.345 UTC [DEBUG] steampipe-plugin-net.plugin:   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant