Raise exception if links tables already exists

This commit is contained in:
William Tran 2021-03-10 22:43:25 -05:00
parent 3035b138f9
commit 9e5bb54eab
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ cur = con.cursor()
# test if table already exists
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='links'")
if cur.fetchone():
print('Links table already exists.')
raise Exception('Links table already exists.')
else:
cur.execute('''CREATE TABLE links (
url text NOT NULL,