Skip to content

Commit 2d5fd94

Browse files
committedOct 15, 2024
adds support for VACUUM
1 parent d67a26b commit 2d5fd94

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
package_dir={"": "src"},
1919
packages=["cs50"],
2020
url="https://github.com/cs50/python-cs50",
21-
version="9.3.4"
21+
version="9.4.0"
2222
)

‎src/cs50/sql.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def execute(self, sql, *args, **kwargs):
177177
"SELECT",
178178
"START",
179179
"UPDATE",
180+
"VACUUM",
180181
}
181182

182183
# Check if the full_statement starts with any command
@@ -378,7 +379,7 @@ def teardown_appcontext(exception):
378379
)
379380

380381
# Check for start of transaction
381-
if command in ["BEGIN", "START"]:
382+
if command in ["BEGIN", "START", "VACUUM"]: # cannot VACUUM from within a transaction
382383
self._autocommit = False
383384

384385
# Execute statement
@@ -389,7 +390,7 @@ def teardown_appcontext(exception):
389390
connection.execute(sqlalchemy.text("COMMIT"))
390391

391392
# Check for end of transaction
392-
if command in ["COMMIT", "ROLLBACK"]:
393+
if command in ["COMMIT", "ROLLBACK", "VACUUM"]: # cannot VACUUM from within a transaction
393394
self._autocommit = True
394395

395396
# Return value

0 commit comments

Comments
 (0)
Please sign in to comment.