We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 600deb4 commit 0a2af2fCopy full SHA for 0a2af2f
src/flask_sqlalchemy/cli.py
@@ -5,18 +5,12 @@
5
from flask import current_app
6
7
8
-if t.TYPE_CHECKING:
9
- from .extension import SQLAlchemy as SQLAlchemy
10
-else:
11
- SQLAlchemy = t.Any
12
-
13
14
def add_models_to_shell() -> dict[str, t.Any]:
15
"""Registered with :meth:`~flask.Flask.shell_context_processor` if
16
``add_models_to_shell`` is enabled. Adds the ``db`` instance and all model classes
17
to ``flask shell``.
18
"""
19
- db: SQLAlchemy = current_app.extensions["sqlalchemy"]
+ db = current_app.extensions["sqlalchemy"]
20
out = {m.class_.__name__: m.class_ for m in db.Model._sa_registry.mappers}
21
out["db"] = db
22
return out
0 commit comments