Skip to content

BigQuery: Remove unused samples #1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 13 additions & 270 deletions bigquery/cloud-client/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@ Install Dependencies
Samples
-------------------------------------------------------------------------------

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


Quickstart
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Expand All @@ -87,92 +71,11 @@ To run this sample:
$ python quickstart.py


Query
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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/query.py,bigquery/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python query.py

usage: query.py [-h] [--use_standard_sql]
[--destination_table DESTINATION_TABLE]
query

Command-line application to perform queries in BigQuery.

For more information, see the README.rst.

Example invocation:
$ python query.py '#standardSQL
SELECT corpus
FROM `bigquery-public-data.samples.shakespeare`
GROUP BY corpus
ORDER BY corpus'

positional arguments:
query BigQuery SQL Query.

optional arguments:
-h, --help show this help message and exit
--use_standard_sql Use standard SQL syntax.
--destination_table DESTINATION_TABLE
Destination table to use for results. Example:
my_dataset.my_table



Parameterized Query
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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/query_params.py,bigquery/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python query_params.py

usage: query_params.py [-h] {named,positional,array,timestamp,struct} ...

Command-line app to perform queries with parameters in BigQuery.

For more information, see the README.rst.

Example invocation:
$ python query_params.py named 'romeoandjuliet' 100
$ python query_params.py positional 'romeoandjuliet' 100

positional arguments:
{named,positional,array,timestamp,struct}
samples
named Run a query with named parameters.
positional Run a query with positional parameters.
array Run a query with an array parameter.
timestamp Run a query with a timestamp parameter.
struct Run a query with a struct parameter.

optional arguments:
-h, --help show this help message and exit



Snippets
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/snippets.py,bigquery/cloud-client/README.rst
: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



Expand All @@ -181,56 +84,14 @@ To run this sample:

.. code-block:: bash

$ python snippets.py

usage: snippets.py [-h] [--project PROJECT]
{list-projects,list-datasets,list-tables,create-table,list-rows,copy-table,delete-table}
...

Samples that demonstrate basic operations in the BigQuery API.

For more information, see the README.rst.

Example invocation:
$ python snippets.py list-datasets

The dataset and table should already exist.

positional arguments:
{list-projects,list-datasets,list-tables,create-table,list-rows,copy-table,delete-table}
list-projects
list-datasets Lists all datasets in a given project. If no project
is specified, then the currently active project is
used.
list-datasets Lists all datasets in a given project. If no project
is specified, then the currently active project is
used.
list-tables Lists all of the tables in a given dataset. If no
project is specified, then the currently active
project is used.
create-table Creates a simple table in the given dataset. If no
project is specified, then the currently active
project is used.
list-rows Prints rows in the given table. Will print 25 rows at
most for brevity as tables can contain large amounts
of rows. If no project is specified, then the
currently active project is used.
copy-table Copies a table. If no project is specified, then the
currently active project is used.
delete-table Deletes a table in a given dataset. If no project is
specified, then the currently active project is used.

optional arguments:
-h, --help show this help message and exit
--project PROJECT

$ python simple_app.py


Load data from a file
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/load_data_from_file.py,bigquery/cloud-client/README.rst
: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



Expand All @@ -239,140 +100,22 @@ To run this sample:

.. code-block:: bash

$ python load_data_from_file.py

usage: load_data_from_file.py [-h] dataset_id table_id source_file_name

Loads data into BigQuery from a local file.
$ python user_credentials.py

For more information, see the README.rst.
usage: user_credentials.py [-h] [--launch-browser] project query

Example invocation:
$ python load_data_from_file.py example_dataset example_table \
example-data.csv
Command-line application to run a query using user credentials.

The dataset and table should already exist.
You must supply a client secrets file, which would normally be bundled with
your application.

positional arguments:
dataset_id
table_id
source_file_name Path to a .csv file to upload.
project Project to use for BigQuery billing.
query BigQuery SQL Query.

optional arguments:
-h, --help show this help message and exit



Load data from Cloud Storage
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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/load_data_from_gcs.py,bigquery/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python load_data_from_gcs.py

usage: load_data_from_gcs.py [-h] dataset_id table_id source

Loads data into BigQuery from an object in Google Cloud Storage.

For more information, see the README.rst.

Example invocation:
$ python load_data_from_gcs.py example_dataset example_table \
gs://example-bucket/example-data.csv

The dataset and table should already exist.

positional arguments:
dataset_id
table_id
source The Google Cloud Storage object to load. Must be in the format
gs://bucket_name/object_name

optional arguments:
-h, --help show this help message and exit



Load streaming data
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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/stream_data.py,bigquery/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python stream_data.py

usage: stream_data.py [-h] dataset_id table_id json_data

Loads a single row of data directly into BigQuery.

For more information, see the README.rst.

Example invocation:
$ python stream_data.py example_dataset example_table \
'["Gandalf", 2000]'

The dataset and table should already exist.

positional arguments:
dataset_id
table_id
json_data The row to load into BigQuery as an array in JSON format.

optional arguments:
-h, --help show this help message and exit



Export data to Cloud Storage
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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/export_data_to_gcs.py,bigquery/cloud-client/README.rst




To run this sample:

.. code-block:: bash

$ python export_data_to_gcs.py

usage: export_data_to_gcs.py [-h] dataset_id table_id destination

Exports data from BigQuery to an object in Google Cloud Storage.

For more information, see the README.rst.

Example invocation:
$ python export_data_to_gcs.py example_dataset example_table \
gs://example-bucket/example-data.csv

The dataset and table should already exist.

positional arguments:
dataset_id
table_id
destination The destination Google Cloud Storage object. Must be in the
format gs://bucket_name/object_name

optional arguments:
-h, --help show this help message and exit
--launch-browser Use a local server flow to authenticate.



Expand Down
28 changes: 5 additions & 23 deletions bigquery/cloud-client/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ product:
name: Google BigQuery
short_name: BigQuery
url: https://cloud.google.com/bigquery/docs
description: >
description: >
`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
Expand All @@ -16,30 +16,12 @@ setup:
- install_deps

samples:
- name: Simple Application
file: simple_app.py
- name: Quickstart
file: quickstart.py
- name: Query
file: query.py
show_help: true
- name: Parameterized Query
file: query_params.py
show_help: true
- name: Snippets
file: snippets.py
show_help: true
- name: Load data from a file
file: load_data_from_file.py
show_help: true
- name: Load data from Cloud Storage
file: load_data_from_gcs.py
show_help: true
- name: Load streaming data
file: stream_data.py
show_help: true
- name: Export data to Cloud Storage
file: export_data_to_gcs.py
- name: Simple Application
file: simple_app.py
- name: User Credentials
file: user_credentials.py
show_help: true

cloud_client_library: true
Expand Down
Loading