Fix internal server error on backfill API for SQLite#67587
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
SameerMesiah97
left a comment
There was a problem hiding this comment.
The change itself is reasonable and contained, but it is diffiicult to see how these lines resolve the internal server error. Could you expand more on the error you encountered and how your fix relates to it?
|
During backfills (e.g., when locking task instances), Airflow calls with_row_locks which applies SQLAlchemy's with_for_update(). Since SQLite does not natively support SELECT ... FOR UPDATE row-level locking, SQLAlchemy or the database driver throws an OperationalError / compilation error, causing a 500 Internal Server Error in the API. Since Airflow doesn’t support concurrent task execution with SQLite anyway, row-level locking isn't necessary. By adding a fast path to return the query untouched when dialect_name == "sqlite", we bypass the unsupported FOR UPDATE generation entirely, preventing the error while preserving the correct functional behavior. |
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.