pass the tests
This commit is contained in:
parent
0eb29bdc10
commit
daf81343bf
3 changed files with 64 additions and 13 deletions
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue