2016-07-19 30 views
1

我無法從BigQuery訪問GitHub時間軸。如何從BigQuery中提取github時間軸數據

我用下面的查詢:

SELECT repository_name, actor_attributes_company, payload_ref_type, payload_action, type, created_at FROM githubarchive:github.timeline WHERE repository_organization = 'foo' and created_at > '2014-07-01'

,一切是偉大的工作。現在,它看起來像githubarchive:github.timeline表不再可用。我一直環顧四周,我發現了另一個表:

SELECT repository_name, actor_attributes_company, payload_ref_type, payload_action, type, created_at FROM publicdata:samples.github_timeline WHERE repository_organization = 'foo' and created_at > '2014-07-01'

這個查詢工作,但返回零行。當我刪除created_at限制它工作,但只從2012年返回幾行,因此它看起來像這只是示例數據。

有誰知道如何從GitHub提取實時時間線數據?

回答

1

事實上,publicdata:samples.github_timeline只有樣本數據。

對於真正的GitHub的存檔文件,看看http://www.githubarchive.org/

昨天我寫了一篇文章有​​關查詢它:

樣品查詢:

SELECT repo.name, 
     JSON_EXTRACT_SCALAR(payload, '$.action') action, 
     COUNT(*) c, 
FROM [githubarchive:month.201606] 
WHERE type IN ('IssuesEvent') 
AND repo.name IN ('kubernetes/kubernetes', 'docker/docker', 'tensorflow/tensorflow') 
GROUP BY 1,2 
ORDER BY 2 DESC 

正如米哈伊爾p oints出來,也有一個與所有的GitHub的代碼另一數據集:

+0

好的,謝謝。你能確認githubarchive:github.timeline已被刪除嗎?這真是我問題的核心。 –

+0

已經有一些重大的變動https://medium.com/google-cloud/github-archive-fully-updated-notice-some-breaking-changes-64e7e7cd0967。 –

0

退房githubarchive的BigQuery項目
它有三個數據集:日,月,年用各自的每日,每月和每年的數據

退房https://cloudplatform.googleblog.com/2016/06/GitHub-on-BigQuery-analyze-all-the-open-source-code.html更多細節

+0

是的,謝謝。我讀了那篇文章。但是,它只允許我獲取歷史數據。 .timeline表用來給你一個完整的feed。這就是我正在尋找的東西,所以我可以寫一些報告。 –

+0

如果您檢查日期數據集 - 您甚至會看到每小時更新一次的今天數據表。和昨天和前一天等不是你在找什麼? –

+0

是的,我認爲是。我將重新編寫報告,將「日」表格編譯成單個視圖。這之前更簡單了。我不是一個非常熟練的SQL人,所以我只是在打獵和啄食。 –