15 lines
387 B
Python
15 lines
387 B
Python
from sqlalchemy.orm import DeclarativeBase
|
|
from src.config.database import Database as DatabaseConfig
|
|
from sqlalchemy import create_engine
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
pass
|
|
|
|
|
|
def get_database(config: DatabaseConfig):
|
|
engine = create_engine(config.url, echo=config.echo)
|
|
# Ensure that all tables exist in the database
|
|
Base.metadata.create_all(engine)
|
|
|
|
return engine
|