SamWheating commented on issue #33694:
URL: https://github.com/apache/airflow/issues/33694#issuecomment-1692508666

   Also one more suggestion (not sure why I didn't think of this earlier 
today), I think that this simple fix allows you to selectively disable template 
fields and extensions on a task-by-task basis - since `template_ext` is an 
attribute on the operator class but not exposed in the `__init__` method:
   
   ```python
   to_gcs_task = BigQueryInsertJobOperator(
           dag=dag,
           task_id='to_gcs',
           gcp_conn_id='xxxx',
           configuration={
               "extract": {
                   "destinationUris": ['gs://xxx/yyy/*.json'],
                   "sourceTable": {
                       "projectId": "abc",
                       "datasetId": "def",
                       "tableId": "ghi"
                   },
                   "destinationFormat": "NEWLINE_DELIMITED_JSON"
               }
           }
       )
       
   to_gcs_task.template_ext = ()
   ```
   
   I tested it locally and it appeared to work just fine, both at run-time and 
when displaying the rendered-task-instances in the UI:
   
   <img width="613" alt="image" 
src="https://github.com/apache/airflow/assets/16950874/5d1ac6c8-3949-441d-a6b6-04e2e9e7088a";>
   
   With this in mind, is there still need to surface overrides in the 
`__init__` method? Or can we just recommend this as a workaround.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to