Skip to content
Snippets Groups Projects
database.py 539 B
import os

from enum import Enum
from sqlmodel import create_engine

from geomagio.api.db.models.metadata import MetadataTable
from geomagio.api.db.models.metadata_history import MetadataHistoryTable
from geomagio.api.db.models.session import session


class Tables(str, Enum):
    METADATA = MetadataTable
    METADATAHISTORYTABLE = MetadataHistoryTable


database_url = os.getenv("DATABASE_URL", "sqlite:///./api_database.db")
if database_url == "":
    database_url = "sqlite:///./api_database.db"

engine = create_engine(database_url)