-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving basil.db to db/sqlite3 to avoid issues with db/models updating…
… BASIL to new versions. Refers to #62 Signed-off-by: Luigi Pellecchia <[email protected]>
- Loading branch information
Luigi Pellecchia
committed
Jan 17, 2025
1 parent
721faf6
commit 06e54b9
Showing
5 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import os.path | ||
import os | ||
|
||
from sqlalchemy.orm import sessionmaker | ||
from sqlalchemy import create_engine | ||
|
||
|
||
class DbInterface(): | ||
|
||
engine = None | ||
session = None | ||
DB_TYPE = "sqlite3" | ||
|
||
def __init__(self, db_name="basil.db"): | ||
currentdir = os.path.dirname(os.path.realpath(__file__)) | ||
self.engine = create_engine(f"sqlite:///{currentdir}/{db_name}", echo=False) | ||
if not os.path.exists(os.path.join(currentdir, self.DB_TYPE)): | ||
os.mkdir(os.path.join(currentdir, self.DB_TYPE)) | ||
self.engine = create_engine(f"sqlite:///{currentdir}/{self.DB_TYPE}/{db_name}", echo=False) | ||
Session = sessionmaker(bind=self.engine) | ||
self.session = Session() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters