Skip to content

Instantly share code, notes, and snippets.

@KentaYamada
Last active June 10, 2016 00:29
Show Gist options
  • Select an option

  • Save KentaYamada/a7d28ed13da2d601f0d2028b157e24f0 to your computer and use it in GitHub Desktop.

Select an option

Save KentaYamada/a7d28ed13da2d601f0d2028b157e24f0 to your computer and use it in GitHub Desktop.
Vacuum sqlite3 db file
# -*- 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