Skip to content

Commit

Permalink
Merge pull request #78 from wandb/hotfix/sqlalchemy-error
Browse files Browse the repository at this point in the history
hotfix: fix sqlalchemy table creation issue due to moved import
  • Loading branch information
morganmcg1 authored Jun 18, 2024
2 parents 191df93 + a8bf316 commit 65fdf1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/wandbot/api/routers/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import wandb
from wandbot.database.client import DatabaseClient
from wandbot.database.database import engine
from wandbot.database.models import Base
from wandbot.database.schemas import (
ChatThread,
ChatThreadCreate,
Expand All @@ -18,7 +16,6 @@

logger = get_logger(__name__)

Base.metadata.create_all(bind=engine)

db_client: DatabaseClient | None = None

Expand Down
2 changes: 2 additions & 0 deletions src/wandbot/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
from sqlalchemy.orm import sessionmaker

from wandbot.database.config import DataBaseConfig
from wandbot.database.models import Base

db_config = DataBaseConfig()

engine = create_engine(
db_config.SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base.metadata.create_all(bind=engine)

0 comments on commit 65fdf1e

Please sign in to comment.