Skip to content
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

GCP Docs #952

Merged
merged 1 commit into from
Dec 8, 2023
Merged
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
16 changes: 12 additions & 4 deletions docs/google.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ We can now upload/query data.

# Table name should be project.dataset.table, or dataset.table, if
# working with the default project
table_name = project + '.' + dataset + '.' + table
table_name = f"`{project}.{dataset}.{table}`"

# Must be pre-existing bucket. Create via GoogleCloudStorage() or
# at https://console.cloud.google.com/storage/create-bucket. May be
Expand All @@ -117,13 +117,21 @@ We can now upload/query data.
{'name':'Bill', 'party':'I'}])

# Copy table in to create new BigQuery table
bigquery.copy(table_obj=parsons_table,
table_name=table_name,
tmp_gcs_bucket=gcs_temp_bucket)
bigquery.copy(
table_obj=parsons_table,
table_name=table_name,
tmp_gcs_bucket=gcs_temp_bucket
)

# Select from project.dataset.table
bigquery.query(f'select name from {table_name} where party = "D"')

# Query with parameters
bigquery.query(
f"select name from {table_name} where party = %s",
parameters=["D"]
)

# Delete the table when we're done
bigquery.client.delete_table(table=table_name)

Expand Down