Spaces:
Runtime error
Runtime error
xclasscode
commited on
Commit
·
a34ac54
1
Parent(s):
0d84662
Create database.py
Browse files- database.py +12 -0
database.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sqlalchemy import create_engine
|
2 |
+
from sqlalchemy.ext.declarative import declarative_base
|
3 |
+
from sqlalchemy.orm import sessionmaker
|
4 |
+
|
5 |
+
SQLALCHEMY_DATABASE_URL = "sqlite:///./api.db"
|
6 |
+
|
7 |
+
engine = create_engine(
|
8 |
+
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
|
9 |
+
)
|
10 |
+
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
11 |
+
|
12 |
+
Base = declarative_base()
|