main website asks for credit card, console/web ui just doesn't work.
- create a project: https://console.developers.google.com/projectcreate
- create credential ("everything" "project -> owner") (store json file as "secret/bigquery.json")
gem install google-cloud-bigquery
.env:
BIGQUERY_PROJECT="everything-000000"
BIGQUERY_CREDENTIALS="secret/bigquery.json"
require "google/cloud/bigquery"
require "dotenv/load"
bigquery = Google::Cloud::Bigquery.new
results = bigquery.query(<<~QUERY)
SELECT *
FROM `bigquery-public-data.hacker_news.full`
WHERE REGEXP_CONTAINS(text, '@ycombinator.com')
QUERY
EMAIL = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
results.each do |row|
puts row[:text].scan(EMAIL)
endthat's it :)