Deprecated airflow.utils.timezone import in SFTPSensor triggers warnings with Airflow 3.x
#65.419 aberto em 17 de abr. de 2026
Description
Under which category would you file this issue?
Providers
Apache Airflow version
3.1.8
What happened and how to reproduce it?
Summary
Importing SFTPSensor (from apache-airflow-providers-sftp) on Airflow 3.1.8 with Python 3.11 causes DeprecatedImportWarning due to usage of airflow.utils.timezone in SFTP provider code.
Current Behavior
On importing or using SFTPSensor, log shows:
[2026-04-17 18:35:28] INFO - Filling up the DagBag from /mnt/local/airflow/dagcodes/dags/utility/test.py
[2026-04-17 18:35:28] WARNING - The airflow.utils.timezone.convert_to_utc attribute is deprecated. Please use 'airflow.sdk.timezone.convert_to_utc'. category=DeprecatedImportWarning
[2026-04-17 18:35:28] WARNING - The airflow.utils.timezone.convert_to_utc attribute is deprecated. Please use 'airflow.sdk.timezone.convert_to_utc'. category=DeprecatedImportWarning
[2026-04-17 18:35:28] WARNING - The airflow.utils.timezone.parse attribute is deprecated. Please use 'airflow.sdk.timezone.parse'. category=DeprecatedImportWarning
Reproduction Steps
- Airflow version:
3.1.8 - Python version:
3.11 - Executor/environment:
Celery - Minimal DAG:
from datetime import datetime
from airflow.sdk import DAG
from airflow.providers.sftp.sensors.sftp import SFTPSensor
with DAG(
dag_id="repro_sftp_timezone_warning",
start_date=datetime(2024, 1, 1),
schedule=None,
catchup=False,
):
SFTPSensor(
task_id="wait_for_file",
path="/tmp/somefile.txt",
sftp_conn_id="sftp_default",
)
Analysis
providers/sftp/src/airflow/providers/sftp/sensors/sftp.py imports deprecated timezone path. Link: sftp.py Same behavior observed in provider releases including apache-airflow-providers-sftp==5.7.0 and 5.7.3. Link: sftp_5.7.3.py
What you think should happen instead?
No DeprecatedImportWarning should be emitted from provider internals on Airflow 3.x. Replace deprecated airflow.utils.timezone imports/usages with airflow.sdk.timezone in SFTP provider sensor(s).
Operating System
No response
Deployment
Docker-Compose
Apache Airflow Provider(s)
sftp
Versions of Apache Airflow Providers
apache-airflow-providers-sftp 5.7.0
Official Helm Chart version
Not Applicable
Kubernetes Version
No response
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct