Skip to content

Util

FloatArrayType = MutableList.as_mutable(ArrayType(Float)) module-attribute

IntArrayType = MutableList.as_mutable(ArrayType(Integer)) module-attribute

SQLITE_DIALECTS = (SQLiteDialect_aiosqlite, SQLiteDialect_pysqlite) module-attribute

StrArrayType = MutableList.as_mutable(ArrayType(String)) module-attribute

T = TypeVar('T') module-attribute

ToolsType = MutableList.as_mutable(ToolsArrayType(sqla.Enum(ToolNames))) module-attribute

UserRolesType = MutableList.as_mutable(UserRolesArrayType(sqla.Enum(UserRoles))) module-attribute

logger = logging.getLogger(__name__) module-attribute

ArrayNotSupportedInStarletteAdminError

Bases: Exception

__init__(*args)

ArrayType

Bases: TypeDecorator

Generic array type for use with SQLite and PostgreSQL.

impl = types.TypeEngine class-attribute instance-attribute

item_type = item_type instance-attribute

__init__(item_type=None)

load_dialect_impl(dialect)

process_bind_param(value, dialect)

process_result_value(value, dialect)

DateType

Bases: TypeDecorator[_T]

cache_ok = True class-attribute instance-attribute

impl = types.DateTime class-attribute instance-attribute

process_bind_param(value, dialect)

process_result_value(value, dialect)

ModelProtocol

Bases: Protocol

__mapper__ instance-attribute

id instance-attribute

schema_class instance-attribute

ToolsArrayType

Bases: ArrayType

process_bind_param(value, dialect)

process_result_value(value, dialect)

UserRolesArrayType

Bases: ArrayType

process_bind_param(value, dialect)

process_result_value(value, dialect)

check_list_type(list_value, expected_type, allow_not_loaded=False)

check_list_type(
    list_value: Any,
    expected_type: type[T],
    allow_not_loaded: Literal[False] = ...,
) -> TypeGuard[list[T]]
check_list_type(
    list_value: Any,
    expected_type: type[T],
    allow_not_loaded: Literal[True] = ...,
) -> TypeGuard[list[T] | NotLoaded]

get_relationships_with_external_foreign_keys(model)

Get any relationships that have foreign keys on the child model.

Assumes that the foreign key would have been named key + "_id" if it was on the parent model.