hackernews_dashboard_ask_and_show_by_hourhackernews_dashboard_ask_counthackernews_dashboard_avg_ask_scorehackernews_dashboard_avg_scorehackernews_dashboard_avg_show_scorehackernews_dashboard_max_scorehackernews_dashboard_mentionshackernews_dashboard_show_counthackernews_dashboard_stories_by_hourhackernews_dashboard_user_with_greater_than_50_scorehackernews_dashboard_user_with_greater_than_5_posthackernews_jobs_by_dayshackernews_jobs_by_technologyhackernews_jobs_by_typehackernews_jobs_searchhackernews_sources_detailhackernews_sources_domain_inputhackernews_sources_domainshackernews_sources_top_10_domains_by_counthackernews_sources_top_10_domains_by_max_scorehackernews_stories_avg_commentshackernews_stories_detailshackernews_stories_max_comments
Query: hackernews_sources_domains
Usage
powerpipe query hackernews_insights.query.hackernews_sources_domains
Steampipe Tables
SQL
with domains as ( select url, substring(url from 'http[s]*://([^/$]+)') as domain from hackernews_new where $1 = 'New' and url != '<null>' union select url, substring(url from 'http[s]*://([^/$]+)') as domain from hackernews_top where $1 = 'Top' and url != '<null>' union select url, substring(url from 'http[s]*://([^/$]+)') as domain from hackernews_best where $1 = 'Best' and url != '<null>'),avg_and_max as ( select substring(url from 'http[s]*://([^/$]+)') as domain, avg(score) as avg_score, max(score) as max_score, avg(descendants) as avg_comments, max(descendants) as max_comments from hackernews_new --where --descendants is not null group by substring(url from 'http[s]*://([^/$]+)')),counted as ( select domain, count(*) from domains group by domain order by count desc)select a.domain as "Domain", c.count as "Count", a.max_score as "Max Score", round(a.avg_score, 1) as "Avg Score", a.max_comments as "Max Comments", round(a.avg_comments, 1) as "Avg Comments"from avg_and_max ajoin counted cusing (domain)order by count desc
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | story_type |
Dashboards
The query is used in the dashboards: