.. This file is automatically generated. Do not edit this file directly. Google BigQuery Python Samples =============================================================================== .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigquery/cloud-client/README.rst This directory contains samples for Google BigQuery. `Google BigQuery`_ is Google's fully managed, petabyte scale, low cost analytics data warehouse. BigQuery is NoOps—there is no infrastructure to manage and you don't need a database administrator—so you can focus on analyzing data to find meaningful insights, use familiar SQL, and take advantage of our pay-as-you-go model. .. _Google BigQuery: https://cloud.google.com/bigquery/docs To run the sample, you need to have the `BigQuery Admin` role. Setup ------------------------------------------------------------------------------- Authentication ++++++++++++++ This sample requires you to have authentication setup. Refer to the `Authentication Getting Started Guide`_ for instructions on setting up credentials for applications. .. _Authentication Getting Started Guide: https://cloud.google.com/docs/authentication/getting-started Install Dependencies ++++++++++++++++++++ #. Clone python-docs-samples and change directory to the sample directory you want to use. .. code-block:: bash $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git #. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. .. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup #. Create a virtualenv. Samples are compatible with Python 3.7+. .. code-block:: bash $ virtualenv env $ source env/bin/activate #. Install the dependencies needed to run the samples. .. code-block:: bash $ pip install -r requirements.txt .. _pip: https://pip.pypa.io/ .. _virtualenv: https://virtualenv.pypa.io/ Samples ------------------------------------------------------------------------------- Quickstart +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigquery/cloud-client/quickstart.py,bigquery/cloud-client/README.rst To run this sample: .. code-block:: bash $ python quickstart.py Simple Application +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigquery/cloud-client/simple_app.py,bigquery/cloud-client/README.rst To run this sample: .. code-block:: bash $ python simple_app.py User Credentials +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=bigquery/cloud-client/user_credentials.py,bigquery/cloud-client/README.rst To run this sample: .. code-block:: bash $ python user_credentials.py usage: user_credentials.py [-h] [--launch-browser] project Command-line application to run a query using user credentials. You must supply a client secrets file, which would normally be bundled with your application. positional arguments: project Project to use for BigQuery billing. optional arguments: -h, --help show this help message and exit --launch-browser Use a local server flow to authenticate. The client library ------------------------------------------------------------------------------- This sample uses the `Google Cloud Client Library for Python`_. You can read the documentation for more details on API usage and use GitHub to `browse the source`_ and `report issues`_. .. _Google Cloud Client Library for Python: https://googlecloudplatform.github.io/google-cloud-python/ .. _browse the source: https://github.com/GoogleCloudPlatform/google-cloud-python .. _report issues: https://github.com/GoogleCloudPlatform/google-cloud-python/issues .. _Google Cloud SDK: https://cloud.google.com/sdk/