Skip to content

Rollback Fails in SQLite on gLinux When DDL Is Mistakenly Passed as DQL without setting autocommit=False #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jahnavi2k opened this issue Apr 7, 2025 · 0 comments
Assignees

Comments

@jahnavi2k
Copy link
Collaborator

On gLinux with SQLite, if autocommit is not explicitly set to False, rollback does not work as expected when a DDL query is accidentally passed in place of a DQL query—even if rollback=True is set in the code (source).
This was discussed in PR #150.


Steps to Reproduce

  1. Pass a DDL query (e.g., ALTER TABLE) where a DQL query is expected.
    Example:

    Image
  2. After execution, the change persists—indicating rollback did not occur

    Image

    As shown above, the column remains renamed to post_content instead of reverting back to the original name: content.


Behavior with autocommit=False

If we explicitly set autocommit=False, the rollback does occur as expected.
Reference:
sqlite.py#L36


Why It Was Removed

However, we had to remove the autocommit=False line because it results in errors when running in Colab:

Image

Notes

  • This issue only affects DDL passed as DQL
  • DML passed as DQL does not exhibit this rollback issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants