(use 'clj-bq.core)
;; Check Google's API console for the credentials
(def *credentials* { :client-id "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
:client-secret "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
:scope "https://www.googleapis.com/auth/bigquery"
:user-agent "clj-bq test client" })
;; OAuth dance
(start-authentication *credentials*)
;; Follow the URL printed in stdout and authorize the client
(def cred "browser introduced credential")
;; Finish OAuth
(continue-authentication cred)
;; Big Query client
(def bq (big-query))
;; list of projects
(projects bq)
;; datasets for a project
(datasets bq "Test Project")
;; creates an asynchronous job
(async-job bq "Test Project"
"SELECT word, word_count FROM publicdata:samples.shakespeare LIMIT 10")
;; Check the status of the jobs
(jobs bq "Test Project")
;; Retrieve results
(def job (first (jobs bq "Test Project")))
(map as-tuples
(take 20 (job-results bq "API Project" (:id job))))
-
Notifications
You must be signed in to change notification settings - Fork 0
forward/clj-bq
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Google BigQuery Clojure wrapper
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published