Unverified Commit 399679d1 authored by karp's avatar karp
Browse files

Fix SQLAlchemy-related type errors

parent 9e0cbaed
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ from flask_sqlalchemy import SQLAlchemy

from .db_config import get_database_uri, get_uri_for_sqlite

db = SQLAlchemy()
db: SQLAlchemy = SQLAlchemy()

from .model import *

+4 −1
Original line number Diff line number Diff line
from flask import Flask
from typing import Any

from portal import db

BaseModel: Any = db.Model

class FlaskConfigEntry(db.Model):

class FlaskConfigEntry(BaseModel):
    """
    A configuration entry for Flask (a key-value pair) as persisted in a database
    """
+5 −2
Original line number Diff line number Diff line
from abc import abstractmethod
from typing import Any, List, Optional, Self
from sqlalchemy import Column

from flask import g

from portal import db

BaseModel: Any = db.Model

class Retrievable(db.Model):

class Retrievable(BaseModel):
    """
    A type whose instances can be retrieved from the database.

@@ -17,7 +20,7 @@ class Retrievable(db.Model):
    __abstract__ = True

    @classmethod
    def get_canonical_order_column(cls) -> Optional[db.Column]:
    def get_canonical_order_column(cls) -> Optional[Column]:
        """
        Return the colum by which instances of this type should be canonically ordered
        when retrieving them all from the database.