Deprecation warnings for PythonOperator and HttpHook

2,730 views
Skip to first unread message

Imran Hassanali

unread,
Aug 13, 2018, 5:26:35 PM8/13/18
to cloud-compo...@googlegroups.com
Hello,

I am getting the following warnings:

[2018-08-13 20:23:51,224] {base_task_runner.py:98} INFO - Subtask: /usr/local/lib/python2.7/site-packages/airflow/utils/helpers.py:351: DeprecationWarning: Importing HttpHook directly from <module 'airflow.hooks' from '/usr/local/lib/python2.7/site-packages/airflow/hooks/__init__.pyc'> has been deprecated. Please import from '<module 'airflow.hooks' from '/usr/local/lib/python2.7/site-packages/airflow/hooks/__init__.pyc'>.[operator_module]' instead. Support for direct imports will be dropped entirely in Airflow 2.0.
[2018-08-13 20:23:51,228] {base_task_runner.py:98} INFO - Subtask:   DeprecationWarning)
[2018-08-13 20:23:51,887] {base_task_runner.py:98} INFO - Subtask: /usr/local/lib/python2.7/site-packages/airflow/utils/helpers.py:351: DeprecationWarning: Importing PythonOperator directly from <module 'airflow.operators' from '/usr/local/lib/python2.7/site-packages/airflow/operators/__init__.pyc'> has been deprecated. Please import from '<module 'airflow.operators' from '/usr/local/lib/python2.7/site-packages/airflow/operators/__init__.pyc'>.[operator_module]' instead. Support for direct imports will be dropped entirely in Airflow 2.0.
[2018-08-13 20:23:51,893] {base_task_runner.py:98} INFO - Subtask:   DeprecationWarning)

Here are my import statements:

from airflow.hooks import HttpHook
from airflow.operators import PythonOperator

I understand from the error I am suppose to be importing from somewhere else but it is not clear to me where.  

Anyone know the correct way?  All the examples I see online use the above import statements

Thanks,

--
Imran Hassanali | im...@essential.com

Wilson Lian

unread,
Aug 13, 2018, 5:31:23 PM8/13/18
to Imran Hassanali, cloud-composer-discuss
You should use from airflow.operators.python_operator import PythonOperator instead.

best,
Wilson

--
You received this message because you are subscribed to the Google Groups "cloud-composer-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-composer-discuss+unsub...@googlegroups.com.
To post to this group, send email to cloud-composer-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-composer-discuss/CACtOZjowTNUsuLdMipi2ui8Puk5LmE0jUN1LOiC3cdtzntDz0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages