Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/BigQuery/BigQuery_Read_Table.ipynb
2973 views
Kernel: Python 3 (ipykernel)

Naas

BigQuery - Read Table

Give Feedback | Bug report

Tags: #bigquery #database #snippet #operations #dataframe

Last update: 2023-04-12 (Created: 2022-08-08)

Description: This notebook provides an example of how to read data from a BigQuery table.

Input

Import libraries

from naas_drivers import bigquery

Variable

service_account_file = "big-query-777777-ffffff777777.json" project_id = "big-query-777777" dataset = "example_ds" table_name = "iris"

Model

Connect to BigQuery

conn = bigquery.connect(service_account_file, project_id)

Output

Read the table

df = conn.execute_query(f"SELECT * FROM {dataset}.{table_name}")
df