BigData / Apache Airflow Interview Questions
What are Hooks in Apache Airflow?
Hooks are interfaces to external platforms and databases. They abstract connection handling, authentication, and API calls so operators and tasks don't need to manage those details directly. Hooks use Connections (stored in the metadata DB) to retrieve credentials.
Example using the S3Hook:
from airflow.providers.amazon.aws.hooks.s3 import S3Hook hook = S3Hook(aws_conn_id='my_aws') hook.load_file(filename='/tmp/data.csv', key='uploads/data.csv', bucket_name='my-bucket')
Common built-in hooks include PostgresHook, MySqlHook, HttpHook, S3Hook, BigQueryHook, and many provider-contributed hooks.
More Related questions...