11 lines
409 B
Python
11 lines
409 B
Python
import os
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
DATABASE_URL = f"sqlite:///{os.path.join(script_dir, 'database.db')}"
|
|
|
|
engine = create_engine(DATABASE_URL)
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
Base = declarative_base() |