Setup exports in the infra __init__.py
This helps avoid issues where model classes are not evaluated. If the models are not properly imported then Sqlalchemy can explode during database initialization since the mapped columns have not yet been registered. Later, having the models all imported into __init__.py will help with setting up a test db since it will ensure that the registrations for all models is happening as the classes are evaluated during the imports in the package init file.
This commit is contained in:
parent
f44f054f56
commit
0d270c9cfb
2 changed files with 28 additions and 2 deletions
|
|
@ -0,0 +1,27 @@
|
|||
from .db import Base, CRUD, CRUDRepo, UpdateMissingEntryError, get_database
|
||||
from .users import UserModel, UserRepoImpl
|
||||
from .publication import (
|
||||
PublicationEntryModel,
|
||||
PublicationSequenceModel,
|
||||
PublicationOrderModel,
|
||||
PublicationModel,
|
||||
PublicationRepoImpl,
|
||||
)
|
||||
from .subscription import SubscriptionModel, SubscriptionRepoImpl
|
||||
|
||||
__all__ = [
|
||||
'Base',
|
||||
'CRUD',
|
||||
'CRUDRepo',
|
||||
'UpdateMissingEntryError',
|
||||
'get_database',
|
||||
'UserModel',
|
||||
'UserRepoImpl',
|
||||
'PublicationEntryModel',
|
||||
'PublicationSequenceModel',
|
||||
'PublicationOrderModel',
|
||||
'PublicationModel',
|
||||
'PublicationRepoImpl',
|
||||
'SubscriptionModel',
|
||||
'SubscriptionRepoImpl',
|
||||
]
|
||||
|
|
@ -6,8 +6,7 @@ from src.services.email import EmailService, get_email_service
|
|||
from src.services.auth import AuthService
|
||||
from src.services.users.service import UserService
|
||||
from dataclasses import dataclass
|
||||
from src.infra.db import get_database
|
||||
from src.infra.users import UserRepoImpl
|
||||
from src.infra import get_database, UserRepoImpl
|
||||
from waitress import serve
|
||||
from flask import Flask
|
||||
import argparse
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue