Search code examples
postgresqlsqlitesqlalchemyairflowpsycopg2

airflow.exceptions.AirflowConfigException: error: cannot use sqlite version < 3.15.0


I set up my airflow (2.0.1) postgresql conection according to airflow docs
But when I try to use it tells me I should have Sqlite > 3.15.0. It is so difficult to upgrade sqlite on Centos7. Even so why should I use and need sqlite?

(airflow) [root@airflow02 ~]# sudo -u airflow /opt/airflow/bin/airflow db check

Error:

Traceback (most recent call last):
      File "/opt/airflow/bin/airflow", line 5, in <module>
        from airflow.__main__ import main
      File "/opt/airflow/lib/python3.6/site-packages/airflow/__init__.py", line 34, in <module>
        from airflow import settings
      File "/opt/airflow/lib/python3.6/site-packages/airflow/settings.py", line 37, in <module>
        from airflow.configuration import AIRFLOW_HOME, WEBSERVER_CONFIG, conf  # NOQA F401
      File "/opt/airflow/lib/python3.6/site-packages/airflow/configuration.py", line 1007, in <module>
        conf.validate()
      File "/opt/airflow/lib/python3.6/site-packages/airflow/configuration.py", line 209, in validate
        self._validate_config_dependencies()
      File "/opt/airflow/lib/python3.6/site-packages/airflow/configuration.py", line 246, in _validate_config_dependencies
        raise AirflowConfigException(f"error: cannot use sqlite version < {min_sqlite_version}")
    airflow.exceptions.AirflowConfigException: error: cannot use sqlite version < 3.15.0

Solution

  • I realized that there is more than one airflow.cfg file. As airflow docs says: "The first time you run Airflow, it will create a file called airflow.cfg in your $AIRFLOW_HOME directory (~/airflow by default)."

    So when I start web-server pointing out to PostgreSQL configured airflow.cfg, error disappeared. It didn't make sense although using PostgreSQL why getting SQLite error. Now I understand that I was trying to start webserver using another raw airflow.cfg which doesn't contain postgresql sql_alchemy_conn. Raw airflow.cfg contains default sql_alchemy_conn for SQLite.