From f74b8fe37656bbb8011951d0fca6b0e2678c23c3 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 13 Jul 2015 15:59:11 -0400 Subject: [PATCH 1/4] Start DX docs for bigquery: client authorization / configuration. --- docs/bigquery-usage.rst | 49 +++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 2 files changed, 50 insertions(+) create mode 100644 docs/bigquery-usage.rst diff --git a/docs/bigquery-usage.rst b/docs/bigquery-usage.rst new file mode 100644 index 000000000000..53a3495f193f --- /dev/null +++ b/docs/bigquery-usage.rst @@ -0,0 +1,49 @@ +Using the API +============= + +Authorization / Configuration +----------------------------- + +- Use :class:`Client ` objects to configure + your applications. + +- :class:`Client ` objects hold both a ``project`` + and an authenticated connection to the PubSub service. + +- The authentication credentials can be implicitly determined from the + environment or directly via + :meth:`from_service_account_json ` + and + :meth:`from_service_account_p12 `. + +- After setting ``GOOGLE_APPLICATION_CREDENTIALS`` and ``GCLOUD_PROJECT`` + environment variables, create an instance of + :class:`Client `. + + .. doctest:: + + >>> from gcloud import bigquery + >>> client = bigquery.Client() + +- Override the credentials inferred from the environment by passing explicit + ``credentials`` to one of the alternative classmethods, `from_service_account_json`: + + .. doctest:: + + >>> from gcloud import bigquery + >>> client = bigquery.Client.from_service_account_json('/path/to/creds.json') + + or `from_service_account_p12`: + + .. doctest:: + + >>> from gcloud import bigquery + >>> client = bigquery.Client.from_service_account_p12('/path/to/creds.p12') + +- Override the project inferred from the environment by passing an explicit + ``project`` to the constructor, or to either of the alternative classmethods: + + .. doctest:: + + >>> from gcloud import bigquery + >>> client = bigquery.Client(project='PROJECT_ID') diff --git a/docs/index.rst b/docs/index.rst index 64b2340cd102..aee033827e74 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,6 +18,7 @@ pubsub-usage pubsub-subscription pubsub-topic + bigquery-usage Getting started From 590519e171ae36793a545a1b7e3669fa087f83c0 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 20 Jul 2015 15:33:36 -0400 Subject: [PATCH 2/4] Pass required 'client_email' to 'Client.from_service_account_p12'. --- docs/bigquery-usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bigquery-usage.rst b/docs/bigquery-usage.rst index 53a3495f193f..9366f5e8d305 100644 --- a/docs/bigquery-usage.rst +++ b/docs/bigquery-usage.rst @@ -38,7 +38,7 @@ Authorization / Configuration .. doctest:: >>> from gcloud import bigquery - >>> client = bigquery.Client.from_service_account_p12('/path/to/creds.p12') + >>> client = bigquery.Client.from_service_account_p12('/path/to/creds.p12', 'jrandom@example.com') - Override the project inferred from the environment by passing an explicit ``project`` to the constructor, or to either of the alternative classmethods: From ebcdc920e605c34ea72e0984a5d1365d0bd903f3 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 20 Jul 2015 15:44:34 -0400 Subject: [PATCH 3/4] Get BigQuery positioned correctly in left-side navbar. --- docs/_static/js/main.js | 10 ++++++++-- docs/bigquery-usage.rst | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/_static/js/main.js b/docs/_static/js/main.js index 11b8202481a0..8a838ab667ee 100755 --- a/docs/_static/js/main.js +++ b/docs/_static/js/main.js @@ -15,8 +15,10 @@ $('.headerlink').parent().each(function() { $('.side-nav').children('ul:nth-child(2)').children().each(function() { var itemName = $(this).text(); - if (itemName !== 'Datastore' && itemName !== 'Storage' && - itemName !== 'Pub/Sub') { + if (itemName !== 'Datastore' && + itemName !== 'Storage' && + itemName !== 'Pub/Sub' && + itemName !== 'Big Query') { $(this).css('padding-left','2em'); } }); @@ -27,6 +29,10 @@ if ($('#cloud-datastore-in-10-seconds').length) apiQsSection = $('#cloud-datastore-in-10-seconds'); else if ($('#cloud-storage-in-10-seconds').length) apiQsSection = $('#cloud-storage-in-10-seconds'); +else if ($('#cloud-pubsub-in-10-seconds').length) + apiQsSection = $('#cloud-pubsub-in-10-seconds'); +else if ($('#cloud-bigquery-in-10-seconds').length) + apiQsSection = $('#cloud-bigquery-in-10-seconds'); if(apiQsSection) { var apiQsSubSections = apiQsSection.children('div'); diff --git a/docs/bigquery-usage.rst b/docs/bigquery-usage.rst index 9366f5e8d305..a6086efb6585 100644 --- a/docs/bigquery-usage.rst +++ b/docs/bigquery-usage.rst @@ -1,3 +1,11 @@ +.. toctree:: + :maxdepth: 0 + :hidden: + +========= +Big Query +========= + Using the API ============= From 4c0bc4f8753251b9b119d16568750119cb809c29 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Mon, 20 Jul 2015 16:38:31 -0400 Subject: [PATCH 4/4] Treat 'BigQuery' as one word. --- docs/_static/js/main.js | 2 +- docs/bigquery-usage.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/_static/js/main.js b/docs/_static/js/main.js index 8a838ab667ee..35a57b701d32 100755 --- a/docs/_static/js/main.js +++ b/docs/_static/js/main.js @@ -18,7 +18,7 @@ $('.side-nav').children('ul:nth-child(2)').children().each(function() { if (itemName !== 'Datastore' && itemName !== 'Storage' && itemName !== 'Pub/Sub' && - itemName !== 'Big Query') { + itemName !== 'BigQuery') { $(this).css('padding-left','2em'); } }); diff --git a/docs/bigquery-usage.rst b/docs/bigquery-usage.rst index a6086efb6585..ee12c3422f87 100644 --- a/docs/bigquery-usage.rst +++ b/docs/bigquery-usage.rst @@ -2,9 +2,9 @@ :maxdepth: 0 :hidden: -========= -Big Query -========= +======== +BigQuery +======== Using the API =============