Skip to content

SNOW-2158999: Airflow: New DAGs not loading #2362

Closed
@IH-Miller

Description

@IH-Miller

Python version

3.11.10

Operating system and processor architecture

Linux-5.15.0-1059-azure-x86_64-with-glibc2.31

Installed packages

adal==1.2.7
adlfs==2024.7.0
aiohttp==3.9.3
aiosignal==1.3.1
alembic==1.13.1
anyio==4.3.0
apache-airflow==2.8.4
apache-airflow-providers-common-io==1.3.0
apache-airflow-providers-common-sql==1.19.0
apache-airflow-providers-ftp==3.7.0
apache-airflow-providers-http==4.10.0
apache-airflow-providers-imap==3.5.0
apache-airflow-providers-microsoft-azure==10.2.0
apache-airflow-providers-microsoft-mssql==3.9.1
apache-airflow-providers-odbc==4.7.1
apache-airflow-providers-salesforce==5.8.0
apache-airflow-providers-smtp==1.6.1
apache-airflow-providers-snowflake==5.6.0
apache-airflow-providers-sqlite==3.7.1
apispec==6.6.0
argcomplete==3.2.3
asgiref==3.7.2
asn1crypto==1.5.1
attrs==23.2.0
Authlib==1.3.1
azure-batch==14.2.0
azure-common==1.1.28
azure-core==1.30.1
azure-cosmos==4.7.0
azure-datalake-store==0.0.53
azure-identity==1.13.0
azure-keyvault==1.1.0
azure-keyvault-secrets==4.8.0
azure-kusto-data==4.6.1
azure-mgmt-authorization==0.61.0
azure-mgmt-containerinstance==10.1.0
azure-mgmt-containerregistry==10.3.0
azure-mgmt-core==1.4.0
azure-mgmt-cosmosdb==9.6.0
azure-mgmt-datafactory==9.0.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-resource==23.2.0
azure-mgmt-storage==21.0.0
azure-nspkg==3.0.2
azure-servicebus==7.12.3
azure-storage-blob==12.23.1
azure-storage-file-datalake==12.17.0
azure-storage-file-share==12.19.0
azure-synapse-artifacts==0.19.0
azure-synapse-spark==0.7.0
Babel==2.14.0
blinker==1.7.0
boto3==1.38.36
botocore==1.38.36
cachelib==0.9.0
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
click-completion==0.5.2
clickclick==20.10.2
colorama==0.4.6
colorlog==4.8.0
configobj==5.0.6
ConfigUpdater==3.2
connexion==2.14.2
crayons==0.4.0
cron-descriptor==1.4.3
croniter==2.0.3
cryptography==41.0.7
dbus-python==1.2.16
Deprecated==1.2.14
dill==0.3.1.1
distlib==0.3.0
distro==1.4.0
dnspython==2.6.1
docutils==0.20.1
email-validator==1.3.1
filelock==3.16.1
Flask==2.2.5
Flask-AppBuilder==4.3.11
Flask-Babel==2.0.0
Flask-Caching==2.1.0
Flask-JWT-Extended==4.6.0
Flask-Limiter==3.5.1
Flask-Login==0.6.3
Flask-Session==0.5.0
Flask-SQLAlchemy==2.5.1
Flask-WTF==1.2.1
frozenlist==1.4.1
fsspec==2025.3.2
google-re2==1.1
googleapis-common-protos==1.65.0
greenlet==3.0.3
grpcio==1.71.0
gunicorn==21.2.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
httpcore==1.0.7
httpx==0.28.1
hyperframe==6.0.1
idna==3.6
ijson==3.3.0
importlib-metadata==6.11.0
importlib_resources==6.3.2
inflection==0.5.1
iniconfig==2.1.0
isodate==0.7.2
itsdangerous==2.1.2
Jinja2==3.1.3
jmespath==1.0.1
jsonpatch==1.22
jsonpointer==2.0
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
lazy-object-proxy==1.10.0
limits==3.10.1
linkify-it-py==2.0.3
lockfile==0.12.2
lxml==5.3.1
Mako==1.3.2
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.21.1
marshmallow-oneofschema==3.1.1
marshmallow-sqlalchemy==0.26.1
mdit-py-plugins==0.4.0
mdurl==0.1.2
mdxpy==1.3.2
methodtools==0.4.7
microsoft-kiota-abstractions==1.3.3
microsoft-kiota-authentication-azure==1.1.0
microsoft-kiota-http==1.3.4
more-itertools==10.2.0
msal==1.31.0
msal-extensions==1.2.0
msgraph-core==1.1.6
msrest==0.7.1
msrestazure==0.6.4
multidict==6.0.5
netifaces==0.10.4
numpy==1.26.4
oauthlib==3.1.0
opentelemetry-api==1.31.1
opentelemetry-exporter-otlp==1.31.1
opentelemetry-exporter-otlp-proto-common==1.31.1
opentelemetry-exporter-otlp-proto-grpc==1.31.1
opentelemetry-exporter-otlp-proto-http==1.31.1
opentelemetry-proto==1.31.1
opentelemetry-sdk==1.31.1
opentelemetry-semantic-conventions==0.52b1
ordered-set==4.1.0
packaging==24.2
pandas==2.1.2
pathspec==0.12.1
pbr==6.1.0
pendulum==3.0.0
pexpect==4.6.0
pipdeptree==2.26.1
platformdirs==3.11.0
pluggy==1.5.0
portalocker==2.10.1
prison==0.2.1
propcache==0.2.0
protobuf==5.29.4
psutil==5.9.8
psycopg2==2.9.10
psycopg2-binary==2.9.10
pyarrow==18.0.0
pycparser==2.21
pycycle==0.0.8
pydantic==1.10.14
Pygments==2.17.2
PyGObject==3.36.0
PyJWT==2.8.0
pymacaroons==0.13.0
pymssql==2.3.1
PyNaCl==1.3.0
pyodbc==5.2.0
pyOpenSSL==24.2.1
pyparted==3.11.2
pyrsistent==0.15.5
pyserial==3.4
pytest==8.4.0
python-apt==2.0.1+ubuntu0.20.4.1
python-daemon==3.0.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-nvd3==0.15.0
python-odata==0.6.2
python-slugify==8.0.4
pytz==2025.2
PyYAML==6.0.1
referencing==0.34.0
requests==2.31.0
requests-file==2.1.0
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
rfc3339-validator==0.1.4
rfc3986==1.5.0
rich==13.7.1
rich-argparse==1.4.0
rpds-py==0.18.0
s3transfer==0.13.0
setproctitle==1.3.3
shellingham==1.5.4
simple-salesforce==1.12.6
six==1.17.0
sniffio==1.3.1
snowflake-connector-python==3.14.0
snowflake-sqlalchemy==1.6.1
sortedcontainers==2.4.0
sos==4.5.6
SQLAlchemy==1.4.51
SQLAlchemy-JSONField==1.0.2
SQLAlchemy-Utils==0.41.1
sqlparse==0.4.4
ssh-import-id==5.10
std-uritemplate==1.0.6
swagger-ui-bundle==0.0.9
tabulate==0.9.0
tenacity==8.2.3
termcolor==2.4.0
testresources==2.0.1
text-unidecode==1.3
time-machine==2.14.0
TM1py==1.11.3
tomlkit==0.13.2
typing_extensions==4.10.0
tzdata==2025.2
uc-micro-py==1.0.3
ufw==0.36
unicodecsv==0.14.1
universal-pathlib==0.1.4
urllib3==2.0.7
virtualenv==20.0.17
WALinuxAgent==2.2.46
Werkzeug==2.2.3
wirerope==0.4.7
wrapt==1.16.0
WTForms==3.1.2
yarl==1.9.4
zeep==4.3.1
zipp==3.18.1

What did you do?

Using 
-Airflow version 2.8.4
-

Order of events:
1.In Nov 2024 we upgraded Airflow python from 3.8 -> 3.11 
	A.This forced apache-airflow-providers-snowflake to then use pandas 2.1.4 instead of 2.0.3 because of the requirement of ">=2.1.2"
	B.apache-airflow 2.8.4 says it can handle <2.2
	C.While testing existing DAGS seems to work and adding new DAGS worked
2.In April 2025 we did a security vunerability upgrade of the Snowflake connector 
	A.Upgrade snowflake-connector-python from 3.7.1 to 3.14.0
	B.Testing DAGS worked and we had no errors. However we did not test adding new DAGS at this time.
3.2025-06-13: We tried to adding multiple new DAGS to the airflow server and it wasn't showing in the UI with no errors displayed either
	A."airflow DAGS list" shows the new dag with the paused field showing "None" instead of True/False
	B."airflow DAGS list-import-errors" shows no errors for the new DAG
	C.We tried running "airflow DAGS unpause <dag_name>" and it gave an error saying the DAG did not exist on the table dag.
	D.We tried running existing DAGS an they all ran correctly had no error and on "airflow DAGS list" have a Paused value of true or false
	E.We tried creating empty DAGS and "airflow DAGS list" shows the new DAG with the paused field showing "None" instead of True/False
	F.We downloaded dagbag(Re-serialize any DAGS missing from the database.) python file from the internet
		i.We ran "airflow DAGS list" again it shows less tasks those not using the snowflake-connector-python library and all the DAGs using snowflake-connector-python
		showed errors even those that were old and still worked.
		ii.Then show errors in the "airflow DAGS list-import-errors" output
			Output:
			a.File "hashtable.pyx", line 1, in init pandas._libs.hashtable
			b.File "missing.pyx", line 42, in init pandas._libs.missing
			c.AttributeError: partially initialized module 'pandas' has no attribute '_pandas_datetime_CAPI' (most likely due to a circular import)
		iii.We tried using pandas==2.1.2 and 2.1.4 this didn't resolve the issue
		iv.We tried reverting snowflake-connector-python and pandas back to the versions of libraries we had in November 2024 and we still had the issue.

complete stack trace for one of the DAGs:
/home/airflow/dags/src/midt_mendix.py               | Traceback (most recent call last):
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
                                                    |     loader.exec_module(new_module)
                                                    |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
                                                    |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
                                                    |   File "/home/airflow/dags/src/midt_mendix.py", line 6, in <module>
                                                    |     import snowflake.connector.errors
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/__init__.py", line 19, in <module>
                                                    |     from .connection import SnowflakeConnection
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/connection.py", line 34, in <module>
                                                    |     from . import errors, proxy
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/errors.py", line 16, in <module>
                                                    |     from .telemetry import TelemetryData, TelemetryField
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/telemetry.py", line 15, in <module>
                                                    |     from .test_util import ENABLE_TELEMETRY_LOG, rt_plain_logger
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/test_util.py", line 12, in <module>
                                                    |     from .compat import IS_LINUX
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/compat.py", line 19, in <module>
                                                    |     from . import constants
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/constants.py", line 12, in <module>
                                                    |     from .options import pyarrow as pa
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/options.py", line 134, in <module>
                                                    |     pandas, pyarrow, installed_pandas = _import_or_missing_pandas_option()
                                                    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/snowflake/connector/options.py", line 77, in _import_or_missing_pandas_option
                                                    |     pandas = importlib.import_module("pandas")
                                                    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    |   File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
                                                    |     return _bootstrap._gcd_import(name, package, level)
                                                    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/pandas/__init__.py", line 46, in <module>
                                                    |     from pandas.core.api import (
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/pandas/core/api.py", line 1, in <module>
                                                    |     from pandas._libs import (
                                                    |   File "/home/airflow/.local/lib/python3.11/site-packages/pandas/_libs/__init__.py", line 18, in <module>
                                                    |     from pandas._libs.interval import Interval
                                                    |   File "interval.pyx", line 1, in init pandas._libs.interval
                                                    |   File "hashtable.pyx", line 1, in init pandas._libs.hashtable
                                                    |   File "missing.pyx", line 42, in init pandas._libs.missing
                                                    | AttributeError: partially initialized module 'pandas' has no attribute '_pandas_datetime_CAPI' (most likely due to a circular import)

What did you expect to see?

We should be able To Add new Python DAGs to Airflow and they should register and run. Currently When we try add DAGs they do not register and we cannot use them.

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions