pass the tests

This commit is contained in:
Waylon Walker 2023-05-22 10:03:25 -05:00
parent 0eb29bdc10
commit daf81343bf
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
3 changed files with 64 additions and 13 deletions

View file

@ -2,7 +2,7 @@ from typing import TYPE_CHECKING
from pydantic import BaseModel, BaseSettings
from sqlalchemy import create_engine
from sqlmodel import Session
from sqlmodel import SQLModel, Session
from learn_sql_model.standard_config import load
@ -24,7 +24,6 @@ class Database:
self.config = get_config()
else:
self.config = config
self.create_db_and_tables()
@property
def engine(self) -> "Engine":
@ -49,6 +48,9 @@ class Config(BaseSettings):
def database(self) -> Database:
return get_database(config=self)
def init(self) -> None:
SQLModel.metadata.create_all(self.database.engine)
def get_database(config: Config = None) -> Database: