docs(samples): add more clustering code snippets#330
docs(samples): add more clustering code snippets#330gcf-merge-on-green[bot] merged 7 commits intogoogleapis:masterfrom
Conversation
e15442f to
2ca69be
Compare
tswast
left a comment
There was a problem hiding this comment.
Thanks for the contribution! A couple of nits
|
|
||
| def client_query_destination_table_clustered(table_id): | ||
|
|
||
| # [START bigquery_query_destination_table_clustered] |
There was a problem hiding this comment.
We need to standardize with what the other languages are using.
| # [START bigquery_query_destination_table_clustered] | |
| # [START bigquery_query_clustered_table] |
| table = client.get_table(table_id) # Make an API request. | ||
| if table.clustering_fields == cluster_fields: | ||
| print("The destination table is written using the cluster_fields configuration.") | ||
| # [END bigquery_query_destination_table_clustered] |
There was a problem hiding this comment.
| # [END bigquery_query_destination_table_clustered] | |
| # [END bigquery_query_clustered_table] |
samples/load_table_clustered.py
Outdated
| source_format=bigquery.SourceFormat.CSV, | ||
| ) | ||
|
|
||
| with open(file_path, "rb") as source_file: |
There was a problem hiding this comment.
Nit: The Go sample loads from GCS "gs://cloud-samples-data/bigquery/sample-transactions/transactions.csv"
It'd be nice if we had some consistency across languages. Also, it's a little bit simpler to run the sample without the need for local files.
Go sample:
|
Here is the summary of changes. You added 4 region tags.This comment is generated by snippet-bot. |
|
@tswast thanks for the review and changes. |
Add sample code for creating a clustered table from a query result.
File: samples/client_query_destination_table_clustered.py
Section: https://cloud.google.com/bigquery/docs/creating-clustered-tables#creating_a_clustered_table_from_a_query_result
Add sample code for creating a clustered table when you load data.
File: samples/load_table_clustered.py
Section: https://cloud.google.com/bigquery/docs/creating-clustered-tables#creating_a_clustered_table_when_you_load_data
Fixes #329 🦕