efolgar commented on a change in pull request #9566:
URL: https://github.com/apache/airflow/pull/9566#discussion_r447075206



##########
File path: 
airflow/providers/google/marketing_platform/operators/campaign_manager.py
##########
@@ -298,6 +299,12 @@ def __init__(
         self.gcp_conn_id = gcp_conn_id
         self.delegate_to = delegate_to
 
+    def prepare_template(self) -> None:
+        # If .json is passed then we have to read the file
+        if isinstance(self.report, str) and self.report.endswith('.json'):

Review comment:
       This would work for templates passed in with a *.json extension, but 
doesn't cover the case where report is passed as a JSON string template.  For 
example:
   
   ```
   create_report = GoogleCampaignManagerInsertReportOperator(
           task_id="create_report",
           gcp_conn_id=self.config.get("gcp_connection_id"),
           profile_id=self.config.get("cm_profile_id"),
           report="""
               {
                  'name': '{{ params.title }}',
                  'accountId': '{{ params.account }}',
                  'fileName': '{{ params.file_name }}',
                  'type': 'STANDARD',
                  'criteria': {
                  ...""",
           params=report_params,
           dag=self.dag)
   ```
   
   Safest approach may be to parse the json string within the execute method.

##########
File path: 
airflow/providers/google/marketing_platform/operators/display_video.py
##########
@@ -75,6 +76,12 @@ def __init__(
         self.gcp_conn_id = gcp_conn_id
         self.delegate_to = delegate_to
 
+    def prepare_template(self) -> None:

Review comment:
       Issue should also be fixed in the GoogleSearchAdsInsertReportOperator.




----------------------------------------------------------------
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.

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


Reply via email to