Created
May 2, 2021 11:40
-
-
Save jy2k/0d3f18ef9b46dacfc45e86d7db530053 to your computer and use it in GitHub Desktop.
Simple Kubeflow component funtion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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