-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathquery.sql
More file actions
34 lines (34 loc) · 753 Bytes
/
query.sql
File metadata and controls
34 lines (34 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SELECT
repo.id,
releases.name,
COUNT(*) AS star_count,
releases.made_public_at,
FROM (
SELECT
*
FROM
[githubarchive:year.2015],
TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('2016-01-01'), CURRENT_TIMESTAMP())) AS events
JOIN (
SELECT
repo.id AS id,
repo.name AS name,
created_at AS made_public_at
FROM
[githubarchive:year.2015],
TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('2016-01-01'), CURRENT_TIMESTAMP())
WHERE
type = 'PublicEvent') AS releases
ON
releases.id = events.repo.id
WHERE
events.type = 'WatchEvent'
AND events.created_at < DATE_ADD(releases.made_public_at, 7, "DAY")
GROUP BY
repo.id,
releases.name,
releases.made_public_at
ORDER BY
star_count DESC
LIMIT
20;