Skip to content

Commit 6f46cd7

Browse files
tswastcrwilcox
authored andcommitted
BigQuery: limit list_jobs sample to 10 most recent jobs (googleapis#5209)
* BigQuery: limit job listing snippet to 10 results Listing all jobs can take a very long time, especially on a project used by CI which starts many jobs every test run.
1 parent 7872d93 commit 6f46cd7

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

docs/bigquery/snippets.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,11 +2003,8 @@ def test_client_list_jobs(client):
20032003
# from google.cloud import bigquery
20042004
# client = bigquery.Client(project='my_project')
20052005

2006-
# List all accessible jobs in a project
2007-
for job in client.list_jobs(): # API request(s)
2008-
print(job.job_id)
2009-
2010-
# Optionally, limit the results to 10 jobs
2006+
# List the 10 most recent jobs in reverse chronological order.
2007+
# Omit the max_results parameter to list jobs from the past 6 months.
20112008
for job in client.list_jobs(max_results=10): # API request(s)
20122009
print(job.job_id)
20132010
# [END bigquery_list_jobs]

0 commit comments

Comments
 (0)