Skip to content

Instantly share code, notes, and snippets.

@jy2k
Created May 2, 2021 11:40
Show Gist options
  • Save jy2k/0d3f18ef9b46dacfc45e86d7db530053 to your computer and use it in GitHub Desktop.
Save jy2k/0d3f18ef9b46dacfc45e86d7db530053 to your computer and use it in GitHub Desktop.
Simple Kubeflow component funtion
def bigquery_to_csv(filter_param: str ="50"):
#a. importing dependencies
from google.cloud import bigquery
import google.auth
#b. creating credentials
creds, project = google.auth.default()
client = bigquery.Client(project='demo-project', credentials=creds)
#c. preforming query
query = """
SELECT * FROM `demo-project.health.disease` WHERE age>{}
""".format(filter_param)
dataframe = client.query(query).to_dataframe()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment