יצירת DataFrame ב-BigQuery ממשימת שאילתה שהסתיימה

אפשר להשתמש ב-BigQuery DataFrames API כדי לבדוק את התוצאות של עבודת שאילתה שאולי הופעלה במקום אחר, למשל מ-BigQuery Console או מ-bq CLI.

דוגמת קוד

Python

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי Pythonהוראות ההגדרה שבמדריך למתחילים של BigQuery באמצעות ספריות לקוח. מידע נוסף מופיע במאמרי העזרה של BigQuery Python API.

כדי לבצע אימות ב-BigQuery, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לספריות לקוח.

from google.cloud import bigquery

import bigframes.pandas as bpd

# Project ID inserted based on the query results selected to explore
project = your_project_id
# Location inserted based on the query results selected to explore
location = "us"
client = bigquery.Client(project=project, location=location)

# Job ID inserted based on the query results selcted to explore
job_id = JOB_ID
job = client.get_job(job_id)
destination = str(job.destination)

# Load data from a BigQuery table using BigFrames DataFrames:
bq_df = bpd.read_gbq_table(destination)

המאמרים הבאים

כדי לחפש ולסנן דוגמאות קוד למוצרים אחרים של Google Cloud , אפשר להיעזר בדפדפן לדוגמאות שלGoogle Cloud .