{% if database == 'postgres' -%} async def init_db() -> None: from . import models # noqa: F401, PLC0415 {%- else -%} from beanie import init_beanie from pymongo import AsyncMongoClient from utils.env import env client = AsyncMongoClient(env.db.connection_url) async def init_db() -> None: from .models import {% if dynamic_config %}DynamicConfig, {% endif %}User # noqa: PLC0415 {% if dynamic_config %} await init_beanie( database=client[env.db.db_name], document_models=[DynamicConfig, User] ){% else %} await init_beanie(database=client[env.db.db_name], document_models=[User]){% endif %} {%- endif %}