Simpler error message when trying to offline migrate with sqlite (#39441)
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index e20836f..e7afb04 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -1535,7 +1535,7 @@
"""
dbname = settings.engine.dialect.name
if dbname == "sqlite":
- raise AirflowException("Offline migration not supported for SQLite.")
+ raise SystemExit("Offline migration not supported for SQLite.")
min_version, min_revision = ("2.2.0", "7b2661a43ba3") if dbname == "mssql" else ("2.0.0", "e959f08ac86c")
# Check if there is history between the revisions and the start revision
diff --git a/tests/utils/test_db.py b/tests/utils/test_db.py
index 0b4347f..7312906 100644
--- a/tests/utils/test_db.py
+++ b/tests/utils/test_db.py
@@ -34,7 +34,6 @@
from sqlalchemy import MetaData, Table
from sqlalchemy.sql import Select
-from airflow.exceptions import AirflowException
from airflow.models import Base as airflow_base
from airflow.settings import engine
from airflow.utils.db import (
@@ -180,7 +179,7 @@
def test_sqlite_offline_upgrade_raises_with_revision(self):
with mock.patch("airflow.utils.db.settings.engine.dialect") as dialect:
dialect.name = "sqlite"
- with pytest.raises(AirflowException, match="Offline migration not supported for SQLite"):
+ with pytest.raises(SystemExit, match="Offline migration not supported for SQLite"):
upgradedb(from_revision="e1a11ece99cc", to_revision="54bebd308c5f", show_sql_only=True)
def test_offline_upgrade_fails_for_migration_less_than_2_2_0_head_for_mssql(self):