File tree Expand file tree Collapse file tree
airflow/providers/google/cloud/operators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1664,6 +1664,7 @@ class BigQueryInsertJobOperator(BaseOperator):
16641664 """
16651665
16661666 template_fields = ("configuration" , "job_id" )
1667+ template_ext = (".json" , )
16671668 ui_color = BigQueryUIColors .QUERY .value
16681669
16691670 def __init__ (
@@ -1685,6 +1686,12 @@ def __init__(
16851686 self .gcp_conn_id = gcp_conn_id
16861687 self .delegate_to = delegate_to
16871688
1689+ def prepare_template (self ) -> None :
1690+ # If .json is passed then we have to read the file
1691+ if isinstance (self .configuration , str ) and self .configuration .endswith ('.json' ):
1692+ with open (self .configuration , 'r' ) as file :
1693+ self .configuration = json .loads (file .read ())
1694+
16881695 def execute (self , context : Any ):
16891696 hook = BigQueryHook (
16901697 gcp_conn_id = self .gcp_conn_id ,
You can’t perform that action at this time.
0 commit comments