-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(bigquery): add support for sheets ranges #9416
Conversation
# Use a shareable link or grant viewing access to the email address you | ||
# used to authenticate with BigQuery (this example Sheet is public). | ||
sheet_url = ( | ||
"https://docs.google.com/spreadsheets/" |
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.
Actually, let's continue using the previous sheet. https://docs.google.com/spreadsheets/d/1i_QCL-7HcSyUZmIbP9E6lO_T5u3HnpLe7dnpHaijg_E/edit?usp=sharing
I was thinking we'd want a different set of data for the range queries, but if we're still querying US States, we should just use the existing sheet.
external_config.source_uris = [sheet_url] | ||
external_config.options.skip_leading_rows = 1 # Optionally skip header row. | ||
external_config.options.range = ( | ||
"Sheet1!A10:B30" |
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.
Let's use a range that is more possible to verify the correct behavior. Since the original sheet is sorted alphabetically, the range A1:B48
should only get "Washington".
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.
I decided to use A20:B49
range. To show that it can be used not from the beginning of the sheet.
|
||
# Wait for the query to complete. | ||
w_states = list(query_job) | ||
print("There are {} states with names starting with W.".format(len(w_states))) |
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.
Let's update the print statement to indicate that we used a range: ... starting with W in the selected range.
Closes: #9082
List of changes:
range
snippets
query_external_sheets_permanent_table
+ testquery_external_sheets_temporary_table
+ test