Last active
June 10, 2016 00:29
-
-
Save KentaYamada/a7d28ed13da2d601f0d2028b157e24f0 to your computer and use it in GitHub Desktop.
Vacuum sqlite3 db file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import sqlite3 | |
| def vaccum(db_name): | |
| with sqlite3.connect(db_name) as db: | |
| try: | |
| db.execute("VACUUM") | |
| except: | |
| raise IOError("Vacuum failed.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment