Skip to content

Instantly share code, notes, and snippets.

@salvadorgascon
Created February 23, 2024 12:41
Show Gist options
  • Save salvadorgascon/656c953544f119e4e8897aa4a91bf6c4 to your computer and use it in GitHub Desktop.
Save salvadorgascon/656c953544f119e4e8897aa4a91bf6c4 to your computer and use it in GitHub Desktop.
Python connection to Google Cloud BigQuery
import os
from pathlib import Path
from google.cloud import storage
# Use Google Cloude IAM to generate valida keys and set permissions
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(Path(__file__).parent,"google-keys.json")
print("Connecting to Google Cloud BigQuery ...", end="")
bigquery_client = bigquery.Client()
print("OK")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment