Registry / workflow / apache-airflow-providers-ftp

apache-airflow-providers-ftp

JSON →
library3.14.2pypypiunverified

The `apache-airflow-providers-ftp` package provides operators and hooks to interact with FTP and FTPS servers within Apache Airflow DAGs. It enables tasks like uploading, downloading, and deleting files from remote FTP/FTPS locations. The current version is 3.14.2, and provider packages release independently from core Airflow, typically for bug fixes, new features, or compatibility with new Airflow versions.

workflowdatahttp-networking
pip install apache-airflow-providers-ftp
Install & Compatibility
Where this runs
tested against v3.15.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/6 runs
4/6 runs
py 3.11
4/6 runs
4/6 runs
py 3.12
4/6 runs
4/6 runs
py 3.13
4/6 runs
4/6 runs
py 3.9
4/6 runs
4/6 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FTPOperator
from airflow.providers.ftp.operators.ftp import FTPOperator
from airflow.providers.ftp.operators.ftp import FTPOperator

This quickstart defines an Airflow DAG that demonstrates uploading a file to an FTP server using the `FTPOperator`. It first creates a local dummy file, then uploads it to the configured FTP server, and finally cleans up the local file. Remember to configure an 'FTP' type connection in the Airflow UI with `conn_id='ftp_default'` and appropriate host, login, and password.

from __future__ import annotations import pendulum from airflow.decorators import dag from airflow.operators.bash import BashOperator from apache_airflow_providers_ftp.operators.ftp import FTPOperator # Ensure you have an FTP connection configured in Airflow UI (Admin -> Connections) # with conn_id='ftp_default'. # Set: Conn Id = ftp_default, Conn Type = FTP # Host: your_ftp_host (e.g., 'localhost' or 'ftp.example.com') # Port: 21 (or 22 for SFTP if using an SFTP provider, 990 for implicit FTPS) # Login: your_username # Password: your_password @dag( dag_id="ftp_example_dag", start_date=pendulum.datetime(2023, 10, 26, tz="UTC"), catchup=False, schedule=None, tags=["ftp", "example", "provider"], ) def ftp_dag(): # Create a dummy local file to upload create_local_file = BashOperator( task_id="create_local_file", bash_command="echo 'Hello from Airflow FTP provider!' > /tmp/airflow_ftp_test.txt" ) # Upload the file to FTP upload_file_to_ftp = FTPOperator( task_id="upload_file_to_ftp", ftp_conn_id="ftp_default", local_filepath="/tmp/airflow_ftp_test.txt", remote_filepath="/remote_airflow_test.txt", operation="put", # 'put' (upload), 'get' (download), 'delete' (delete remote) create_intermediate_dirs=True, ) # Clean up the local dummy file clean_local_file = BashOperator( task_id="clean_local_file", bash_command="rm /tmp/airflow_ftp_test.txt" ) create_local_file >> upload_file_to_ftp >> clean_local_file ftp_dag()
airflow --version
Debug
Known issues
gotchaIncorrect Airflow connection configuration for FTP/FTPS. Users often use a generic 'HTTP' or 'SFTP' connection type, or fail to set the 'Conn Type' to 'FTP' for FTP/FTPS operations.
fix
In Airflow UI (Admin -> Connections), create a connection with 'Conn Type' explicitly set to 'FTP'. Ensure 'Host', 'Port', 'Login', and 'Password' fields are correctly filled. For FTPS, specify parameters like `explicit_ftp` and `ssl_context_kw` in the 'Extra' field as JSON.
affects: All versions
gotchaDistinction between FTP and FTPS, and explicit vs. implicit FTPS. The `FTPOperator` and `FTPHook` default to FTP. For FTPS, you must use `FTPSFileTransferOperator` or `FTPSHook` and configure the connection accordingly.
fix
For FTPS, use `FTPSFileTransferOperator` or `FTPSHook`. Configure the Airflow connection's 'Extra' field with JSON parameters like `{"explicit_ftp": true}` for explicit FTPS, or specific `ssl_context_kw` for advanced SSL settings. The port for FTPS is typically 21 for explicit or 990 for implicit.
affects: All versions
gotchaFile transfer mode (binary vs. ASCII). Issues can arise when transferring text files in binary mode, or vice versa, especially across different operating systems with varying line endings.
fix
The `FTPOperator` and `FTPSFileTransferOperator` have a `transfer_mode` parameter (default is 'binary'). Explicitly set `transfer_mode='ascii'` when dealing with plain text files to ensure correct line ending handling during transfer.
affects: All versions
gotchaLarge file transfers may encounter network timeouts, leading to task failures. The default FTP connection timeout might be too short for very large files or slow networks.
fix
Consider implementing retries for your Airflow tasks. For longer timeouts, you might need to specify a `timeout` parameter when initializing the Hook (e.g., `FTPHook(ftp_conn_id, timeout=300)`). If not directly exposed by the operator, you might need to extend the hook or pass it via the 'Extra' field of the Airflow connection if supported by the underlying library.
affects: All versions
breakingThe `apache-airflow-providers-ftp` package is not installed, leading to a `ModuleNotFoundError`. The Python environment running the Airflow DAG or script does not have the necessary provider installed.
fix
Install the provider package using pip: `pip install apache-airflow-providers-ftp`. If you're using a containerized Airflow setup (e.g., Docker, Kubernetes), ensure this command is included in your `Dockerfile` or entrypoint script to install the provider into the Airflow environment.
affects: All versions
breakingThe `apache-airflow-providers-ftp` library (or its specific components like `apache_airflow_providers_ftp.operators.ftp`) could not be found. This often indicates the provider package is not installed in the Airflow environment, or there's a typo in the import path.
fix
Ensure the `apache-airflow-providers-ftp` package is installed in your Airflow environment using `pip install apache-airflow-providers-ftp`. Verify that the import statement `from apache_airflow_providers_ftp.operators.ftp import FTPOperator` (or similar) is correct and matches the installed package structure.
affects: All versions
Upgrade
Version history
3.15.0latest on PyPI
Audit
Dependencies
apache-airflowrequiredThis is an Airflow provider and requires Apache Airflow to run.
Agent activity
81 hits · last 30 days
node
8
ahrefsbot
2
amazonbot
2
bytedance
2
Amazon
1
seranking-bot
1
Resources