Skip to content

Commit

Permalink
adds step to apply gregory_schema.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoamaral committed Sep 19, 2021
1 parent a7eb008 commit 796465c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ def is_git_repo(path):
print(output)

# Check if SQLite3 db is present
print('Trying to connect to docker-data/gregory.db to apply gregory_schema.sql')
database = sqlite3.connect('./docker-data/gregory.db')
cur = database.cursor()

with open('gregory_schema.sql') as fp:
cur.executescript(fp.read())
if database == False:
sys.exit('SQLite database not found, create it please')

Expand All @@ -129,6 +133,8 @@ def is_git_repo(path):
table_exists = database.execute(query).description
if table_exists:
print("\N{check mark} Found table: " + t)
else:
print("didn't find expected tables")
for column in table.columns:
query ='select '+ column +' from '+ t +';'
column_exists=database.execute(query).description
Expand Down

0 comments on commit 796465c

Please sign in to comment.