I have a python file that uses datalab.bigquery to execute a SQL query that is written out. However, I have this SQL query saved down in the same GitHub repository so am wondering if there is a way to run the github SQL file without having to copy and paste the query.
Currently it looks like this:
import datalab
import datalab.bigquery as bq
import pandas as pd
df = bq.Query('''
SELECT
CASE
WHEN advance_date IS NULL
AND release_date IS NULL
AND resale_close_date IS NULL
THEN TRUE
...
'''_.to_dataframe()
This works fine, but when updates are made to the SQL script they are not reflected in this python script, which creates an issue. I would like it to call the SQL query that is saved in the Github repository. Is there a way to do this? Like df = bq.execute(sql_file.sql).to_dataframe().