user3502355
user3502355

Reputation: 177

Airflow throws warning "Import from airflow.hooks.[operator_module] instead"

I am relatively new to airflow and I keep hitting warnings that say

DeprecationWarning: Importing 'MsSqlHook' directly from 'airflow.hooks' has been deprecated. Please import from 'airflow.hooks.[operator_module]' instead. Support for direct imports will be dropped entirely in Airflow 2.0.

Can someone tell me what I am doing wrong here and what will be changed? I typically write my database login into PythonOperator functions using hooks to connect to the DB. Is this no longer allowed in 2.0? I am missing some contextual information it seems.

Upvotes: 1

Views: 1852

Answers (1)

y2k-shubham
y2k-shubham

Reputation: 11607

What version of Airflow are you using? (answer might change based on that)


Here's what i think


Do note that

  • even this updated import statement will itself get deprecated in future releases (v2.0) of Airflow.
  • then you might have to (again) update your import statement to from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook

Upvotes: 2

Related Questions