提高python迭代器的速度



我已经在Python中实现了一个大查询工作应用程序,并在App Engine中部署了,并且需要一些帮助,以提高以下过滤器的效率,该过滤器将过滤器仅作为输入提供的用户电子邮件

credentials = GoogleCredentials.get_application_default()
bq_conn= discovery.build('bigquery', 'v2', credentials=credentials)
job_query_dict = []    

###Create the big query client
client =bigquery.Client(project=project_id)

###List the jobs in the client
jobs = client.list_jobs(all_users=True)   # API request
print( [job for job in list(client.list_jobs(all_users=True)) if job.user_email==user_email][0])

如何打印在用户_Email输入中给出的用户的作业?

访问作业数据,因为pandas dataframe比从列表

访问 更快
t=bigquery_service.jobs().list(projectId=project_id,allUsers=True,projection='full',stateFilter=job_state.lower()).execute()
try:
    tab = pd.DataFrame(t['jobs'])    
except:
    return "No jobs"

最新更新