![]() |
Python Connector for Google BigQuery Using the module - Python Connector for Google BigQuery |
![]() |
To retrieve data from Google BigQuery:
import devart.bigquery as bigquery
connect()
module method and obtain a connection
object.
response = bigquery.signin()
my_connection = bigquery.connect(
ProjectId="your_project_id",
DataSetId="your_dataset_id",
RefreshToken=response["Refresh Token"]
)
cursor
object using the cursor()
connection method.
my_cursor = my_connection.cursor()
execute()
cursor method.
my_cursor.execute("SELECT * FROM employees")
fetch*()
cursor methods.
for row in my_cursor.fetchall():
print(row)