GoogleCloudPlatform / GoogleCloudPlatform/evalbench
Rollback Fails in SQLite on gLinux When DDL Is Mistakenly Passed as DQL without setting autocommit=False
- Dominant language
- Python
- Stars
- 57
- Forks
- 33
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 26
Description
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](https://github.com/GoogleCloudPlatform/evalbench/blob/e2c8e579eab879b25a37ebef8150b542c1db24b4/evalbench/work/sqlexecwork.py#L80)).
This was discussed in [PR #150](https://github.com/GoogleCloudPlatform/evalbench/pull/150#pullrequestreview-2696310325).
---
### Steps to Reproduce
1. Pass a DDL query (e.g., `ALTER TABLE`) where a DQL query is expected.
Example:
2. After execution, the change persists—indicating rollback did not occur
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](https://github.com/GoogleCloudPlatform/evalbench/blob/4d4c4f3c0e7cb39b48c7ec450e08100fbdb475f1/evalbench/databases/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:
---
### Notes
- This issue only affects **DDL passed as DQL**
- DML passed as DQL **does not** exhibit this rollback issue
Contributor guide
Assessment
This issue has not been assessed yet.