diff options
author | ache <ache@ache.one> | 2021-08-31 08:21:42 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2021-08-31 08:21:42 +0200 |
commit | eed13c1b587c292f86d4b302918418ce78637126 (patch) | |
tree | a2c008669214d2e9122c1d5b33c1bf079d9b4ecd /download/msgPack2sqlite_msgPack.py | |
parent | Fix argument name (diff) |
Create a new database
Diffstat (limited to 'download/msgPack2sqlite_msgPack.py')
-rw-r--r-- | download/msgPack2sqlite_msgPack.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/download/msgPack2sqlite_msgPack.py b/download/msgPack2sqlite_msgPack.py index 38d34cd..c08efdb 100644 --- a/download/msgPack2sqlite_msgPack.py +++ b/download/msgPack2sqlite_msgPack.py @@ -1,4 +1,5 @@ import msgpack +import os import sys import sqlite3 @@ -6,6 +7,12 @@ import argparse def writeDB(outputF, data): + # Delete if exists + try: + os.remove(outputF) + except OSError: + pass + with sqlite3.connect(outputF) as con: cur = con.cursor() cur.execute('''CREATE TABLE IF NOT EXISTS entry ( |