diff --git a/app/db_type.py b/app/db_type.py new file mode 100644 index 0000000000..46ae35b2d4 --- /dev/null +++ b/app/db_type.py @@ -0,0 +1,2 @@ +from sqlalchemy import * # noqa: F401,F403 +from sqlalchemy.orm import * # noqa: F401,F403 diff --git a/app/models.py b/app/models.py index 7733599448..da0b32d2e3 100644 --- a/app/models.py +++ b/app/models.py @@ -2,7 +2,7 @@ import itertools import uuid from enum import Enum -from typing import Any, Iterable, Literal +from typing import Any, Iterable, Literal, cast from flask import current_app, url_for from flask_sqlalchemy.model import DefaultMeta @@ -33,6 +33,7 @@ from app import ( DATETIME_FORMAT, db, + db_type, signer_api_key, signer_bearer_token, signer_inbound_sms, @@ -50,6 +51,7 @@ TEMPLATE_TYPES = [SMS_TYPE, EMAIL_TYPE, LETTER_TYPE] +db = cast(db_type, db) # type: ignore template_types = db.Enum(*TEMPLATE_TYPES, name="template_type") NORMAL = "normal" @@ -88,7 +90,7 @@ def update_from_original(self, original): current_app.logger.debug("{} has no column {} to copy from".format(original, c.name)) -BaseModel: DefaultMeta = db.Model +BaseModel: DefaultMeta = db.Model # type: ignore class User(BaseModel):