Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update sample queries to use timeline

  • Loading branch information...
commit 37fe9035dafc451c6a5969ebf92c8073ac83f076 1 parent a9e1952
@igrigorik authored
View
14 bigquery/README.md
@@ -11,20 +11,20 @@ Have a clever query you would like to share? Fork the project, add it to the pro
```sql
/* distribution of different events on GitHub */
SELECT type, count(type) as cnt
-FROM [github.events]
+FROM [github.timeline]
GROUP BY type
ORDER BY cnt DESC
/* distribution of different events on GitHub for Ruby */
SELECT type, count(type) as cnt
-FROM [github.events]
+FROM [github.timeline]
WHERE repository_language="Ruby"
GROUP BY type
ORDER BY cnt DESC
/* watches for a specific language + date range */
SELECT repository_name, count(repository_name) as watches, repository_description, repository_url
-FROM github.events
+FROM github.timeline
WHERE type="WatchEvent"
AND repository_language="Ruby"
AND PARSE_UTC_USEC(created_at) >= PARSE_UTC_USEC('2012-04-01 00:00:00')
@@ -33,17 +33,17 @@ ORDER BY watches DESC
/* top 100 repos for Ruby by number of pushes */
SELECT repository_name, count(repository_name) as pushes, repository_description, repository_url
-FROM github.events
+FROM github.timeline
WHERE type="PushEvent"
AND repository_language="Ruby"
AND PARSE_UTC_USEC(created_at) >= PARSE_UTC_USEC('2012-04-01 00:00:00')
GROUP BY repository_name, repository_description, repository_url
-ORDER BY watches DESC
+ORDER BY pushes DESC
LIMIT 100
/* push events by language */
SELECT repository_language, count(repository_language) as pushes
-FROM github.events
+FROM github.timeline
WHERE type="PushEvent"
AND PARSE_UTC_USEC(created_at) >= PARSE_UTC_USEC('2012-04-01 00:00:00')
GROUP BY repository_language
@@ -51,7 +51,7 @@ ORDER BY pushes DESC
/* show recent push events for Go, sorted by time */
SELECT repository_name, repository_watchers, url, PARSE_UTC_USEC(created_at) as date
-FROM github.events
+FROM github.timeline
WHERE type="PushEvent"
AND repository_language="Go"
AND repository_watchers > 1
View
4 bigquery/queries/top_watches_by_language.sql
@@ -1,8 +1,8 @@
/* watches for a specific language + date range */
SELECT repository_name, count(repository_name) as watches, repository_description, repository_url
-FROM github.events
+FROM github.timeline
WHERE type="WatchEvent"
AND repository_language="Ruby"
AND PARSE_UTC_USEC(created_at) >= PARSE_UTC_USEC('2012-04-01 00:00:00')
GROUP BY repository_name, repository_description, repository_url
-ORDER BY watches DESC
+ORDER BY watches DESC
Please sign in to comment.
Something went wrong with that request. Please try again.