Reputation: 33
I'm trying to access my data using the BigQuery API Python Library but can't seem to do so. My code is below. The data that I used in the code was also used here and it worked there but in my code throws a TypeError: 'HttpRequest' object has no attribute '__getitem__'
error.
If I just do a print response
instead, output is <googleapiclient.http.HttpRequest object at 0x1031d0d50>
.
Any help will be much appreciated.
from apiclient.discovery import build
import logging
from oauth2client.client import GoogleCredentials
logging.basicConfig()
credentials = GoogleCredentials.get_application_default()
bigquery_service = build('bigquery', 'v2', credentials=credentials)
tables = bigquery_service.tables()
response= tables.get(projectId=project_id, datasetId=dataset_id, tableId=table_id)
print response['kind'] #causes TypeError: 'HttpRequest' object has no attribute '__getitem__'
Upvotes: 1
Views: 822
Reputation: 14781
You are missing .execute()
at the end of LN 8:
[..]
response= tables.get(projectId=project_id, datasetId=dataset_id, tableId=table_id).execute()
[..]
Upvotes: 2