get_flask_sqlalchemy_proxy_ver
FunctionSource
db: SQLAlchemyProxy[
flask_sqlalchemy_lite.SQLAlchemy, _ModelLite
] = get_flask_sqlalchemy_proxy_ver[_ModelLite](
model_class: type[_ModelLite],
app: Flask | None = None,
engine_options: Mapping[str, Any] | None = None,
session_options: Mapping[str, Any] | None = None,
)
Proxy version of get_flask_sqlalchemy
.
The usage and the returned value of this function is totally the same as
get_flask_sqlalchemy
. However, the first returned value will be
deliberately notated by SQLAlchemyProxy
,
which can be used by the coders who want to use this type to remind remind them the
compatibility supported by the falling back version.
Aliases
This function can be acquired by
import flask_sqlalchemy_compat as fsc
fsc.get_flask_sqlalchemy_proxy_ver
fsc.auto.get_flask_sqlalchemy_proxy_ver
Arguments
Requires
Argument | Type | Required | |
---|---|---|---|
model_class | type[_ModelLite] | The base model type applied to the whole database. If flask_sqlalchemy is available, this type will be used as model_class argument for creating the db-specific base model type. However, if the db instance fallback to the version provided by flask_sqlalchemy_lite , this type will be modified inplace to imitate the behavior of flask_sqlalchemy.SQLAlchemy().Model . | |
app | Flask | None | Call init_app on this Flask application. If not specified, will not call init_app . | |
engine_options | Mapping[str, Any] | None | Default arguments passed to sqlalchemy.create_engine for each configured engine. | |
session_options | Mapping[str, Any] | None | Arguments to configure sessionmaker with. |
- where
_ModelLite
is aTypeVar
ofsa.orm.DeclarativeBase
.
Returns
Argument | Type | |
---|---|---|
db | SQLAlchemyProxy[flask_sqlalchemy_lite.SQLAlchemy, _ModelLite] | The SQLAlchemy extension instance. In run time, it is the same as the returned value of However, this returned value is always notated by |