-
Notifications
You must be signed in to change notification settings - Fork 1.6k
refactor(bigquery): update code samples to use strings for table and dataset IDs #9136
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
Merged
Merged
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
6b3a2a3
Merge pull request #26 from googleapis/master
mf2199 4c6d7b4
Move every snippet to it's own file. Create test templates.
377310c
list_datasets_by_label
emar-kar 5ce976f
Merge remote-tracking branch 'upstream/master'
emar-kar a7b2376
manage_dataset_labels
emar-kar 0de5d8b
add_empty_column
emar-kar 5e05cd8
browse_table_data
emar-kar f6b60a0
dataset_exists
emar-kar a773251
complete change of dataset_exists
emar-kar 8375877
Merge remote-tracking branch 'upstream/master'
emar-kar a0792bd
five updated snippets
emar-kar 95dc8f8
Update datasets.rst
emar-kar cf7576e
cosmetic chgs
emar-kar 0645e33
client_list_jobs
emar-kar 92efd59
client_query
emar-kar 1814821
copy_table
emar-kar a31bc1f
cosmetic chgs
emar-kar 725c515
Update datasets.rst
emar-kar 6ffc123
cosmetic chgs
emar-kar 5654dcd
cosmetic chgs
emar-kar 2ff376c
table_exists
emar-kar 948ddb5
Update test_copy_table.py
emar-kar e8d62c4
Update test_table_exists.py
emar-kar 28251ec
Update snippets.py
emar-kar ad623ba
update client_list_jobs
emar-kar ec67aee
table_insert_rows
emar-kar c8c0f70
Update client_query.py
emar-kar 42204ed
Merge remote-tracking branch 'upstream/master'
emar-kar b4dade6
Merge commit '2d622fd2de8654c0e82a53f709bd377ab3e0a1ff' into snippets…
emar-kar febfa11
update client_query
emar-kar c66ba4b
five updated snippets
emar-kar 0e7ccf5
*.rst files correction
emar-kar d5ab15d
Update tables.rst
emar-kar 7704ad3
update copy_table
emar-kar 6dd1174
update first-five
emar-kar 50c4aed
update second-five
emar-kar 7a654c3
Update test_dataset_exists.py
emar-kar 8e26115
update imports
emar-kar 0cf0071
update list_datasets_by_label
emar-kar f602e3f
Update test_browse_table_data.py
emar-kar 0bf9aab
The update of the first-five according to the requested chgs
emar-kar 2e50a81
snippets file reformatted
emar-kar 9e77624
Update tables.rst
emar-kar 7d99673
update_client_query
emar-kar e37f5a2
update manage_dataset_labels
emar-kar af27c29
update browse_table_data
emar-kar 47ee156
deleted extra spaces
emar-kar b78f6c9
update import settings
emar-kar 6ee351e
reformate samples/
emar-kar 9a65dae
general update second five
emar-kar 0913f6a
five updated snippets
emar-kar 14757f6
minor update
emar-kar 9941957
cosmetic chgs
emar-kar 4ca71e5
Merge branch 'first-five' into second-five-v2
emar-kar cd78ed2
Merge branch 'master' into second-five-v2
emar-kar 9cc5661
Merge branch 'master' into first-five
emar-kar 7e42411
Merge branch 'first-five' into second-five-v2
emar-kar 056f357
Update tables.rst
emar-kar 70c032f
Update test_list_datasets_by_label.py
emar-kar cde3e62
update delete_dataset_labels
emar-kar 9d3c1aa
Update test_dataset_label_samples.py
emar-kar 99a5bd5
Merge branch 'first-five' into second-five-v2
emar-kar 2ba305b
Merge branch 'master' into second-five-v2
emar-kar f3607c1
Update conftest.py
emar-kar 1040fba
update test files
emar-kar edac824
cosmetic chgs
emar-kar ea94915
Update test_client_list_jobs.py
emar-kar 92fca34
Update test_table_exists.py
emar-kar 17fb644
cosmetic chgs
emar-kar 2dfcc3d
Update test_client_list_jobs.py
emar-kar c4e3f7c
Merge branch 'master' into second-five-v2
emar-kar 902fdd9
cosmetic chgs
emar-kar 2483f55
Merge branch 'master' into second-five-v2
emar-kar df4f6c1
Merge branch 'master' into second-five-v2
emar-kar ccf3dcd
update client_list_jobs
emar-kar b87e7d0
Merge branch 'master' into second-five-v2
emar-kar 150bcf2
cosmetic update
emar-kar ab504bf
comments rephrasing
emar-kar 176395e
Merge branch 'master' into second-five-v2
emar-kar e67d172
updated as requested
emar-kar da4a2bc
comment lines update
emar-kar 8852951
lint fix
emar-kar 6d533b3
comments update
emar-kar 327373c
Merge branch 'master' into second-five-v2
emar-kar e55f698
Update update_dataset_access.py
emar-kar ef884b8
revert commit with -s
emar-kar 50394cd
delete -s from comment lines
emar-kar 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright 2019 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
|
|
||
| def client_list_jobs(client): | ||
|
|
||
| # [START bigquery_list_jobs] | ||
| # TODO(developer): Import the client library. | ||
| # from google.cloud import bigquery | ||
|
|
||
| import datetime | ||
|
|
||
| # TODO(developer): Construct a BigQuery client object. | ||
| # client = bigquery.Client() | ||
|
|
||
| # List the 10 most recent jobs in reverse chronological order. | ||
| # Omit the max_results parameter to list jobs from the past 6 months. | ||
| print("Last 10 jobs:") | ||
| for job in client.list_jobs(max_results=10): # API request(s) | ||
| print("{}".format(job.job_id)) | ||
|
|
||
| # The following are examples of additional optional parameters: | ||
|
|
||
| # Use min_creation_time and/or max_creation_time to specify a time window. | ||
| print("Jobs from the last ten minutes:") | ||
| ten_mins_ago = datetime.datetime.utcnow() - datetime.timedelta(minutes=10) | ||
| for job in client.list_jobs(min_creation_time=ten_mins_ago): | ||
| print("{}".format(job.job_id)) | ||
|
|
||
| # Use all_users to include jobs run by all users in the project. | ||
| print("Last 10 jobs run by all users:") | ||
| for job in client.list_jobs(max_results=10, all_users=True): | ||
| print("{} run by user: {}".format(job.job_id, job.user_email)) | ||
|
|
||
| # Use state_filter to filter by job state. | ||
| print("Last 10 jobs done:") | ||
| for job in client.list_jobs(max_results=10, state_filter="DONE"): | ||
| print("{}".format(job.job_id)) | ||
| # [END bigquery_list_jobs] |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.