Reputation: 305
I have the results from a query obtained through Python:
<google.cloud.bigquery.table.RowIterator object at 0x00000289E881C670>
I'd like to convert them to a pandas Dataframe.
I'm trying things like df = pd.read_sql_query(query, connection)
, but I don't have the connection
.
My code to get the query results is
import pandas as pd
from google.cloud import bigquery
from google.oauth2 import service_account
# Load BigQuery credentials
credentials_json_file = r"credentials.json"
credentials = service_account.Credentials.from_service_account_file(credentials_json_file)
project_id = "idi-rewan"
client = bigquery.Client(credentials=credentials, project=project_id)
# Define query
query_string = """
SELECT * FROM `database.table`
"""
query_job = client.query(query_string)
results = query_job.result()
Upvotes: 0
Views: 3248