Query Google Bigquery Through Python In Google App Engine -


i trying query bigquery table , display results webpage using google apps engine(biling enabled project). using python(3.4.3) development. here code found , trying work thru it, main.py file:

import httplib2    apiclient.discovery import build  oauth2client.client import signedjwtassertioncredentials    # replace project id  project_id = "725429xxxxxx"  # replace service account email google dev console  service_account_email = '725429xxxxxx-si4unlakcnr3mxxxxxxxxxx@developer.gserviceaccount.com'    f = file('key.p12', 'rb')  key = f.read()  f.close()    credentials = signedjwtassertioncredentials(      service_account_email,      key,      scope='https://www.googleapis.com/auth/bigquery')    http = httplib2.http()  http = credentials.authorize(http)    service = build('bigquery', 'v2', http=http)  datasets = service.datasets()  response = datasets.list(projectid=project_id).execute()    print('dataset list:\n')  dataset in response['datasets']:    print("%s\n" % dataset['id'])      # select data    query_data = {'query':'      select count(*) [sample.qcommrebate];  '}  query_request = service.jobs()  query_response = query_request.query(projectid=project_id,       body=query_data).execute()  pp.pprint(query_response)

however hard try not getting results on local page or on deployed page.

can tell me if doing wrong anywhere.

i got py developer real issue sql trying pass. group had no space in between.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -