-
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
refactor(bigquery): update code samples to use strings for table and dataset IDs #9495
Conversation
The parameter can sometimes confuse new BigQuery developers. Since location autodetection now works pretty well, the parameter can be removed from code samples for better clarity, except where the samples want to explicitly demonstrate its usage.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
||
copy_table_multiple_source.copy_table_multiple_source( | ||
client, random_table_id, table_ids | ||
) |
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 call dest_table = client.get_table(random_table_id)
and then assert dest_table.num_rows > 0
so that we know that the job did what we expected it to do.
|
||
|
||
def test_get_routine(capsys, client, routine_id): | ||
def test_client_query_destination_table_legacy(capsys, client, table_id): |
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.
Use random_table_id
since we want to create a new table in the actual sample.
The table_id
creates a table before the tests run.
table = client.create_table(table) |
assert routine.body == "x * 4" | ||
query_job = client_query_dry_run.client_query_dry_run(client) | ||
out, err = capsys.readouterr() | ||
assert "This query will process 0 bytes." not in out |
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 got confused by this test.
I'd very much like to see a positive assertion that a non-zero number is present. not in
could happen for many different reasons.
assert "This query will process 0 bytes." not in out | |
assert "This query will process" in out | |
assert query_job.total_bytes_processed > 0 |
Towards #8989
Closes #9499.
List of changes:
New samples:
Comment lines in samples unified:
DEPRECATED tests
All those tests were united in the
test_routine_samples
file!