turbot/hackernews_insights

Query: hackernews_dashboard_mentions

Usage

powerpipe query hackernews_insights.query.hackernews_dashboard_mentions

SQL

with data as (
(select * from hackernews_new where $1 = 'New')
union
(select * from hackernews_top where $1 = 'Top')
union
(select * from hackernews_best where $1 = 'Best')
),
names as (
select
unnest( $2::text[] ) as name
),
counts as (
select
name,
(
select
count(*)
from
data
where
title ~* name
and (extract(epoch from now() - time::timestamptz) / 60)::int between symmetric $3 and $4
) as mentions
from
names
)
select
replace(name, '\', '') as name,
mentions
from
counts
where
mentions > 0
order by
mentions desc

Params

ArgsNameDefaultDescriptionVariable
$1story_type
    $2names
      $3min_minutes_ago
        $4max_minutes_ago

          Dashboards

          The query is used in the dashboards: