1
votes

I have used Lambda Hook with Airflow v1.10.11 which was under contrib section. With v2.0 out can someone please suggest how to use the Lambda Hooks. I can also not access the airflow links now. (https://airflow.apache.org/docs/apache-airflow/stable/_modules/airflow/contrib/hooks/aws_lambda_hook.html)

Links: Airflow 2.0 supported Hooks: https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/hooks/index.html

2

2 Answers

2
votes

Airflow 2.0 has been divided into two parts:

  • Apache Airflow Core, which includes webserver, scheduler, CLI and other components that are needed for minimal Airflow installation.

  • Providers packages - Providers packages include integrations with third party integrations. They are updated independently of the Apache Airflow core.

It was described in detail on the blog of one of the PMCs: https://www.polidea.com/blog/airflow-2-providers/

In your case, you should look at the list of operators that are in provider packages:

https://airflow.apache.org/docs/apache-airflow-providers/operators-and-hooks-ref/index.html

Thus, you can find that the new class location is:

airflow.providers.amazon.aws.hooks.lambda_function.AwsLambdaHook

Documentation: https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/hooks/lambda_function/index.html#module-airflow.providers.amazon.aws.hooks.lambda_function

You can also try to load the old class which should display a message.

>>> import airflow.contrib.hooks.aws_lambda_hook

/Users/X/airflow/airflow/contrib/hooks/aws_lambda_hook.py:29 DeprecationWarning: This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.lambda_function`.