Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Go vendoring BigQuery
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE 'Godeps/_workspace/%'
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE 'Godeps/Godeps.json'
AND f.repo_name NOT IN (
SELECT f_repo_name FROM github.workspace_repos
)
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE '%vendor/manifest'
AND f.repo_name NOT IN (
SELECT repo_name
FROM [copper-diorama-131213:github.go_repos_files]
WHERE path LIKE 'src/%.go'
)
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE (
f.path LIKE 'vendor/manifest'
OR f.path LIKE 'vendor/src/%.go'
) AND f.repo_name IN (
SELECT repo_name
FROM [copper-diorama-131213:github.go_repos_files]
WHERE path LIKE 'src/%.go'
)
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE 'glide.yaml'
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.path LIKE 'vendor/vendor.json'
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT f.repo_name, s.num_stars
FROM [copper-diorama-131213:github.go_repos_files] AS f
JOIN [copper-diorama-131213:github.2015_2016_stars] AS s
ON f.repo_name = s.repo_name
WHERE f.repo_name NOT IN (
SELECT f_repo_name FROM [github.gb_repos], [github.gvt_repos],
[github.godeps_repos], [github.govendor_repos], [github.glide_repos]
) AND (f.path LIKE "vendor/%.go" OR f.path LIKE "cmd/vendor/%.go")
GROUP BY f.repo_name, s.num_stars
ORDER BY s.num_stars DESC
SELECT repo_name
FROM [github.go_repos_files]
WHERE path LIKE "%vendor/%.go" OR path LIKE "%Godeps/%.go"
GROUP BY repo_name
SELECT
f.*, l.language
FROM
`bigquery-public-data.github_repos.files` AS f
JOIN
`bigquery-public-data.github_repos.languages` AS l
ON
f.repo_name = l.repo_name
WHERE
EXISTS(SELECT * FROM l.language WHERE name = 'Go')
SELECT
repo.id,
repo.name,
COUNT(*) AS num_stars
FROM
TABLE_DATE_RANGE([githubarchive:day.], TIMESTAMP('2015-01-01'), TIMESTAMP('2016-12-31'))
WHERE
type = "WatchEvent"
GROUP BY repo.id, repo.name
ORDER BY num_stars DESC
SELECT * FROM
(SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "gb" name FROM `github.gb_repos`)
UNION ALL (SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "gvt" name FROM `github.gvt_repos`)
UNION ALL (SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "other" name FROM `github.other_repos`)
UNION ALL (SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "godeps" name FROM `github.godeps_repos`)
UNION ALL (SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "govendor" name FROM `github.govendor_repos`)
UNION ALL (SELECT SUM(s_num_stars) stars, COUNT(*) number, COUNTIF(f_repo_name IN (SELECT repo_name FROM `github.check_in_repos`)) checked_in, "glide" name FROM `github.glide_repos`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment