apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.79k stars 14.23k forks source link

GoogleDisplayVideo360 (hooks|operators|sensors) aren't compatible with v2 of the Display & Video 360 API #28045

Closed github-sang closed 1 year ago

github-sang commented 1 year ago

Apache Airflow Provider(s)

google

Versions of Apache Airflow Providers

apache-airflow-providers-google 8.4.0

Apache Airflow version

airflow-2.3.4

Operating System

Ubuntu 18.04.6 LTS

Deployment

Composer

Deployment details

Create a new Google Cloud Composer environment (image version composer-1.19.15-airflow-2.3.4)

What happened

Attempting to run any DAG that uses the GoogleDisplayVideo360 (hooks|operators|sensors) trying to connect to v2 of the API (https://developers.google.com/bid-manager/reference/rest) results in the DAG failing with the following error in the log:

[2022-12-01, 23:54:02 UTC] {base.py:68} INFO - Using connection ID 'google_cloud_default' for task execution. [2022-12-01, 23:54:02 UTC] {display_video.py:103} INFO - Creating Display & Video 360 report. [2022-12-01, 23:54:02 UTC] {credentials_provider.py:325} INFO - Getting connection using google.auth.default() since no key file is defined for hook. [2022-12-01, 23:54:02 UTC] {taskinstance.py:1904} ERROR - Task failed with exception Traceback (most recent call last): File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/marketing_platform/operators/display_video.py", line 104, in execute response = hook.create_query(query=self.body) File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/google/marketing_platform/hooks/display_video.py", line 96, in create_query response = self.get_conn().queries().createquery(body=query).execute(num_retries=self.num_retries) AttributeError: 'Resource' object has no attribute 'createquery' [2022-12-01, 23:54:02 UTC] {taskinstance.py:1408} INFO - Marking task as FAILED. dag_id=dv360_v2_report, task_id=create_dv2_report, execution_date=20221201T235355, start_date=20221201T235401, end_date=20221201T235402 [2022-12-01, 23:54:02 UTC] {standard_task_runner.py:92} ERROR - Failed to execute job 9 for task create_dv2_report ('Resource' object has no attribute 'createquery'; 866) [2022-12-01, 23:54:02 UTC] {local_task_job.py:156} INFO - Task exited with return code 1

What you think should happen instead

The operator should connect to version 2 of the Display & Video 360 API successfully and execute the operation

How to reproduce

  1. Create a Cloud Composer instance
  2. Create a DAG that calls a GoogleDisplayVideo360 operator (e.g. GoogleDisplayVideo360CreateReportOperator) with api_version='v2' as a param
  3. Upload DAG to Composer DAG folder
  4. Trigger DAG

Anything else

No response

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template!

potiuk commented 1 year ago

cc: @bhirsz

bhirsz commented 1 year ago

Thanks for the report, I will pass it to the team. I can see that the hardcoded api_version isn't up to date anyway (https://developers.google.com/doubleclick-advertisers/deprecation) and it should be handled better. I can't promise the support for v2 since it is long deprecated (depends on how much work is required to fix it).

github-sang commented 1 year ago

Hi @bhirsz,

That link is the deprecation schedule for Campaign Manager 360 which yes sunset v2 a long time ago.

For Display & Video 360 (https://developers.google.com/bid-manager/release-notes), v2 is the latest version with v1.1 being deprecated.

Here is the instructions on the difference between v1.1 and v2 (https://developers.google.com/bid-manager/how-tos/v2-migration)

Cheers.

jonheysek commented 1 year ago

Looks like DV360 v1.1 API will be fully sunsetted on Feb 28, 2022, at which point the current, stable GoogleDisplayVideo360 operators won't work.

https://ads-developers.googleblog.com/2022/08/deprecation-of-bid-manager-api-v11.html

eladkal commented 1 year ago

PRs are welcome

eladkal commented 1 year ago

I'm closing this issue as completed after https://github.com/apache/airflow/pull/30326 as this issue is about v1 -> v2

if there are problems with latest Google provider please open new issue with reproduce example