@@ -55,22 +55,6 @@ Install Dependencies
5555Samples
5656-------------------------------------------------------------------------------
5757
58- Simple Application
59- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60-
61- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
62- :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
63-
64-
65-
66-
67- To run this sample:
68-
69- .. code-block :: bash
70-
71- $ python simple_app.py
72-
73-
7458Quickstart
7559+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7660
@@ -87,92 +71,11 @@ To run this sample:
8771 $ python quickstart.py
8872
8973
90- Query
91- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
92-
93- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
94- :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
95-
96-
97-
98-
99- To run this sample:
100-
101- .. code-block :: bash
102-
103- $ python query.py
104-
105- usage: query.py [-h] [--use_standard_sql]
106- [--destination_table DESTINATION_TABLE]
107- query
108-
109- Command-line application to perform queries in BigQuery.
110-
111- For more information, see the README.rst.
112-
113- Example invocation:
114- $ python query.py ' #standardSQL
115- SELECT corpus
116- FROM `bigquery-public-data.samples.shakespeare`
117- GROUP BY corpus
118- ORDER BY corpus'
119-
120- positional arguments:
121- query BigQuery SQL Query.
122-
123- optional arguments:
124- -h, --help show this help message and exit
125- --use_standard_sql Use standard SQL syntax.
126- --destination_table DESTINATION_TABLE
127- Destination table to use for results. Example:
128- my_dataset.my_table
129-
130-
131-
132- Parameterized Query
133- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
134-
135- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
136- :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
137-
138-
139-
140-
141- To run this sample:
142-
143- .. code-block :: bash
144-
145- $ python query_params.py
146-
147- usage: query_params.py [-h] {named,positional,array,timestamp,struct} ...
148-
149- Command-line app to perform queries with parameters in BigQuery.
150-
151- For more information, see the README.rst.
152-
153- Example invocation:
154- $ python query_params.py named ' romeoandjuliet' 100
155- $ python query_params.py positional ' romeoandjuliet' 100
156-
157- positional arguments:
158- {named,positional,array,timestamp,struct}
159- samples
160- named Run a query with named parameters.
161- positional Run a query with positional parameters.
162- array Run a query with an array parameter.
163- timestamp Run a query with a timestamp parameter.
164- struct Run a query with a struct parameter.
165-
166- optional arguments:
167- -h, --help show this help message and exit
168-
169-
170-
171- Snippets
74+ Simple Application
17275+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17376
17477.. image :: https://gstatic.com/cloudssh/images/open-btn.png
175- :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
78+ :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
17679
17780
17881
@@ -181,56 +84,14 @@ To run this sample:
18184
18285.. code-block :: bash
18386
184- $ python snippets.py
185-
186- usage: snippets.py [-h] [--project PROJECT]
187- {list-projects,list-datasets,list-tables,create-table,list-rows,copy-table,delete-table}
188- ...
189-
190- Samples that demonstrate basic operations in the BigQuery API.
191-
192- For more information, see the README.rst.
193-
194- Example invocation:
195- $ python snippets.py list-datasets
196-
197- The dataset and table should already exist.
198-
199- positional arguments:
200- {list-projects,list-datasets,list-tables,create-table,list-rows,copy-table,delete-table}
201- list-projects
202- list-datasets Lists all datasets in a given project. If no project
203- is specified, then the currently active project is
204- used.
205- list-datasets Lists all datasets in a given project. If no project
206- is specified, then the currently active project is
207- used.
208- list-tables Lists all of the tables in a given dataset. If no
209- project is specified, then the currently active
210- project is used.
211- create-table Creates a simple table in the given dataset. If no
212- project is specified, then the currently active
213- project is used.
214- list-rows Prints rows in the given table. Will print 25 rows at
215- most for brevity as tables can contain large amounts
216- of rows. If no project is specified, then the
217- currently active project is used.
218- copy-table Copies a table. If no project is specified, then the
219- currently active project is used.
220- delete-table Deletes a table in a given dataset. If no project is
221- specified, then the currently active project is used.
222-
223- optional arguments:
224- -h, --help show this help message and exit
225- --project PROJECT
226-
87+ $ python simple_app.py
22788
22889
229- Load data from a file
90+ User Credentials
23091+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23192
23293.. image :: https://gstatic.com/cloudssh/images/open-btn.png
233- :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
94+ :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
23495
23596
23697
@@ -239,140 +100,22 @@ To run this sample:
239100
240101.. code-block :: bash
241102
242- $ python load_data_from_file.py
243-
244- usage: load_data_from_file.py [-h] dataset_id table_id source_file_name
245-
246- Loads data into BigQuery from a local file.
103+ $ python user_credentials.py
247104
248- For more information, see the README.rst.
105+ usage: user_credentials.py [-h] [--launch-browser] project query
249106
250- Example invocation:
251- $ python load_data_from_file.py example_dataset example_table \
252- example-data.csv
107+ Command-line application to run a query using user credentials.
253108
254- The dataset and table should already exist.
109+ You must supply a client secrets file, which would normally be bundled with
110+ your application.
255111
256112 positional arguments:
257- dataset_id
258- table_id
259- source_file_name Path to a .csv file to upload.
113+ project Project to use for BigQuery billing.
114+ query BigQuery SQL Query.
260115
261116 optional arguments:
262117 -h, --help show this help message and exit
263-
264-
265-
266- Load data from Cloud Storage
267- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
268-
269- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
270- :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
271-
272-
273-
274-
275- To run this sample:
276-
277- .. code-block :: bash
278-
279- $ python load_data_from_gcs.py
280-
281- usage: load_data_from_gcs.py [-h] dataset_id table_id source
282-
283- Loads data into BigQuery from an object in Google Cloud Storage.
284-
285- For more information, see the README.rst.
286-
287- Example invocation:
288- $ python load_data_from_gcs.py example_dataset example_table \
289- gs://example-bucket/example-data.csv
290-
291- The dataset and table should already exist.
292-
293- positional arguments:
294- dataset_id
295- table_id
296- source The Google Cloud Storage object to load. Must be in the format
297- gs://bucket_name/object_name
298-
299- optional arguments:
300- -h, --help show this help message and exit
301-
302-
303-
304- Load streaming data
305- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
306-
307- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
308- :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
309-
310-
311-
312-
313- To run this sample:
314-
315- .. code-block :: bash
316-
317- $ python stream_data.py
318-
319- usage: stream_data.py [-h] dataset_id table_id json_data
320-
321- Loads a single row of data directly into BigQuery.
322-
323- For more information, see the README.rst.
324-
325- Example invocation:
326- $ python stream_data.py example_dataset example_table \
327- ' ["Gandalf", 2000]'
328-
329- The dataset and table should already exist.
330-
331- positional arguments:
332- dataset_id
333- table_id
334- json_data The row to load into BigQuery as an array in JSON format.
335-
336- optional arguments:
337- -h, --help show this help message and exit
338-
339-
340-
341- Export data to Cloud Storage
342- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
343-
344- .. image :: https://gstatic.com/cloudssh/images/open-btn.png
345- :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
346-
347-
348-
349-
350- To run this sample:
351-
352- .. code-block :: bash
353-
354- $ python export_data_to_gcs.py
355-
356- usage: export_data_to_gcs.py [-h] dataset_id table_id destination
357-
358- Exports data from BigQuery to an object in Google Cloud Storage.
359-
360- For more information, see the README.rst.
361-
362- Example invocation:
363- $ python export_data_to_gcs.py example_dataset example_table \
364- gs://example-bucket/example-data.csv
365-
366- The dataset and table should already exist.
367-
368- positional arguments:
369- dataset_id
370- table_id
371- destination The destination Google Cloud Storage object. Must be in the
372- format gs://bucket_name/object_name
373-
374- optional arguments:
375- -h, --help show this help message and exit
118+ --launch-browser Use a local server flow to authenticate.
376119
377120
378121
0 commit comments