sql - Google BigQuery: how to find the repo owner's github username for all github repos that contain a string? -
i'm exploring cool github repos open dataset on bigquery, , hit query can image can't quite write.
curious, bigquery query return:
- the github username
- of author
- of each github repo
- with javascript file or html file
- that contains string
d3
- that contains string
- with javascript file or html file
- of each github repo
- of author
?
here approximate answer, minus constraint file match should javascript or html file (have filename ends in .js
or .html
)
#standardsql create temp function reponameshaved3(reponames array<string>) returns int64 language js """ return reponames.some(namehasd3) ? 1 : 0; function namehasd3(name) { var normalized = name.tolowercase(); return normalized.indexof('d3') === 0 || normalized.indexof('-d3') !== -1; } """; select author.name, repo_name `bigquery-public-data.github_repos.commits` reponameshaved3(repo_name) = 1 -- limit 10
credit @deathmtn on twitter query
Comments
Post a Comment