You can use the Google Cloud Client Library for Python to run a query on BigQuery
from google.cloud import bigquery # Create a client object client = bigquery.Client() # Set the name of the dataset and table to query dataset_id = 'my_dataset' table_id = 'my_table' # Create the SQL query query = 'SELECT * FROM `{}.{}`'.format(dataset_id, table_id) # Run the query query_job = client.query(query) # Retrieve the results results = query_job.result() # Print the results for row in results: print(row)
You'll need to have the Google Cloud SDK installed and authenticated to use the client library. For more information on how to get set up, check out the Google Cloud Client Library for Python documentation: https://googleapis.github.io/google-cloud-python/latest/bigquery/index.html