-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
3 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from os import environ | ||
|
||
PRODUCTION = bool(environ.get('PRODUCTION', False)) | ||
DEBUG = bool(environ.get('DEBUG', True)) | ||
DB_URL = environ.get('DB_URL', 'sqlite:///alfred.sqlite') |
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,15 +1,12 @@ | ||
from sqlalchemy import create_engine | ||
|
||
from admin.config import DB_URL, PRODUCTION | ||
from admin.config import DB_URL, DEBUG | ||
|
||
engine = create_engine( | ||
DB_URL, connect_args={'check_same_thread': PRODUCTION}, echo=not PRODUCTION | ||
) | ||
engine = create_engine(DB_URL, connect_args={'check_same_thread': False}, echo=DEBUG) | ||
|
||
|
||
# TODO: implement async engine | ||
def create_async_engine(): | ||
from sqlmodel.ext.asyncio.session import AsyncEngine | ||
|
||
return AsyncEngine(engine) | ||
return AsyncEngine(engine) |