Skip to content

Commit

Permalink
FIX creation of database
Browse files Browse the repository at this point in the history
- first time you run the automation-tools, the database file need to be created
  • Loading branch information
remileduc authored and sevein committed Oct 14, 2017
1 parent e4fc54d commit 83943d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions transfers/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from os.path import isfile

from sqlalchemy import create_engine
from sqlalchemy import Sequence
from sqlalchemy import Column, Binary, Boolean, Integer, String
Expand All @@ -22,6 +24,10 @@ def __repr__(self):


def init(databasefile):
if not isfile(databasefile):
# We create the file
with open(databasefile, "a"):
pass
engine = create_engine('sqlite:///{}'.format(databasefile), echo=False)
global Session
Session = sessionmaker(bind=engine)
Expand Down

0 comments on commit 83943d3

Please sign in to comment.