我的目标是随着时间的推移跟踪我的 BigQuery 存储库的受欢迎程度。
我想使用公开可用的 BigQuery 数据集,例如GitHub Archive或GitHub 数据集
GitHub 数据集sample_repos
不包含星数的快照:
SELECT
watch_count
FROM
[bigquery-public-data:github_repos.sample_repos]
WHERE
repo_name == 'angular/angular'
Run Code Online (Sandbox Code Playgroud)
返回 5318。
GitHub Archive 是事件的时间线。我可以尝试将它们全部相加,但这些数字与 GitHub UI 中的数字不匹配。我猜是因为它不计算 unstar 动作。这是我使用的查询:
SELECT
COUNT(*)
FROM
[githubarchive:year.2011],
[githubarchive:year.2012],
[githubarchive:year.2013],
[githubarchive:year.2014],
[githubarchive:year.2015],
[githubarchive:year.2016],
TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('2017-01-01'), TIMESTAMP('2017-03-30') )
WHERE
repo.name == 'angular/angular'
AND type = "WatchEvent"
Run Code Online (Sandbox Code Playgroud)
返回 24144
实际值为 21,921