-
Notifications
You must be signed in to change notification settings - Fork 312
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
docs(samples): add more clustering code snippets #330
docs(samples): add more clustering code snippets #330
Conversation
e15442f
to
2ca69be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# [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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
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 🦕