o-nikolas commented on code in PR #77246:
URL: https://github.com/apache/airflow/pull/77246#discussion_r4619361037
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -78,13 +79,13 @@ def _raise_locked_response_or_reraise(e: OperationalError,
action: str) -> NoRet
"""Map a database lock OperationalError to HTTP 503, or re-raise if not a
lock error."""
if not is_lock_not_available_error(e):
raise
- raise HTTPException(
- status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
- detail=(
- f"Database is locked. Backfill {action} is not supported on SQLite
"
- "under concurrent access. Please use PostgreSQL or MySQL."
- ),
+ detail = (
+ f"Backfill {action} could not acquire a database lock because another
transaction holds it. "
+ "Retry the request."
)
+ if isinstance(e.orig, sqlite3.OperationalError):
Review Comment:
Checking `type(e.orig).__module__ == "sqlite3"` here would let you drop the
module level import on line 19.
Looks like it's the only module-level `import sqlite3` in airflow-core.
`configuration.py` and `settings.py` import it lazily, only when the connection
is SQLite, so a Python built without `_sqlite3` can still run Airflow on
Postgres.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]