-
Notifications
You must be signed in to change notification settings - Fork 6.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
fix: address issues with concurrent BigQuery tests #3426
Merged
shollyman
merged 6 commits into
GoogleCloudPlatform:master
from
shollyman:refactor_terrible_tests
Apr 17, 2020
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9bd879c
EXPERIMENT: another pass at improving testability of BQ samples
shollyman 48092e0
finish cloud-client changes
shollyman 69e1794
Merge branch 'master' into refactor_terrible_tests
leahecole ca985b0
reorder imports
shollyman 2edddd2
Merge branch 'refactor_terrible_tests' of github.com:shollyman/python…
shollyman 2ffe585
Merge branch 'master' into refactor_terrible_tests
shollyman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
# limitations under the License. | ||
|
||
|
||
def run_authorized_view_tutorial(): | ||
def run_authorized_view_tutorial(override_values={}): | ||
# Note to user: This is a group email for testing purposes. Replace with | ||
# your own group email address when running this code. | ||
analyst_group_email = '[email protected]' | ||
|
@@ -28,6 +28,14 @@ def run_authorized_view_tutorial(): | |
client = bigquery.Client() | ||
source_dataset_id = 'github_source_data' | ||
|
||
# [END bigquery_authorized_view_tutorial] | ||
# [END bigquery_avt_create_source_dataset] | ||
# To facilitate testing, we replace values with alternatives | ||
# provided by the testing harness. | ||
source_dataset_id = override_values.get("source_dataset_id", source_dataset_id) | ||
# [START bigquery_authorized_view_tutorial] | ||
# [START bigquery_avt_create_source_dataset] | ||
|
||
source_dataset = bigquery.Dataset(client.dataset(source_dataset_id)) | ||
# Specify the geographic location where the dataset should reside. | ||
source_dataset.location = 'US' | ||
|
@@ -57,6 +65,15 @@ def run_authorized_view_tutorial(): | |
# Create a separate dataset to store your view | ||
# [START bigquery_avt_create_shared_dataset] | ||
shared_dataset_id = 'shared_views' | ||
|
||
# [END bigquery_authorized_view_tutorial] | ||
# [END bigquery_avt_create_shared_dataset] | ||
# To facilitate testing, we replace values with alternatives | ||
# provided by the testing harness. | ||
shared_dataset_id = override_values.get("shared_dataset_id", shared_dataset_id) | ||
# [START bigquery_authorized_view_tutorial] | ||
# [START bigquery_avt_create_shared_dataset] | ||
|
||
shared_dataset = bigquery.Dataset(client.dataset(shared_dataset_id)) | ||
shared_dataset.location = 'US' | ||
shared_dataset = client.create_dataset(shared_dataset) # API request | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you do the following?
Usually imports should be 1) standard libs 2) 3rd party libs and 3) package local libs, separated by an empty line.