gino.ext.sanic module¶
-
class
gino.ext.sanic.Gino(app=None, *args, **kwargs)[source]¶ Bases:
gino.api.GinoSupport Sanic web server.
By
init_app()GINO registers a few hooks on Sanic, so that GINO could use database configuration in Sanicconfigto initialize the bound engine.A lazy connection context is enabled by default for every request. You can change this default behavior by setting
DB_USE_CONNECTION_FOR_REQUESTconfig value toFalse. By default, a database connection is borrowed on the first query, shared in the same execution context, and returned to the pool on response. If you need to release the connection early in the middle to do some long-running tasks, you can simply do this:await request['connection'].release(permanent=False)
- Parameters
bind – A
GinoEngineinstance to bind. Also accepts string orURL, which will be passed tocreate_engine()when thisGinoinstance is awaited. Default isNone.model_classes – A
tupleof base class and mixin classes to create theModelclass. Default is(CRUDModel, ).query_ext – Boolean value to control the installation of the
ginoextension onExecutablefor implicit execution. Default is to install (True).schema_ext – Boolean value to control the installation of the
ginoextension onSchemaItemfor implicit execution. Default is to install (True).ext – Boolean value to control the installation of the two
ginoextensions.Falsefor no extension at all, while it depends on the two individual switches when this is set toTrue(default).kwargs – Other arguments accepted by
MetaData.
-
model_base_classes= (<class 'gino.crud.CRUDModel'>, <class 'gino.ext.sanic.SanicModelMixin'>)¶
-
query_executor¶ alias of
GinoExecutor
-
class
gino.ext.sanic.GinoConnection(dialect, sa_conn, stack=None)[source]¶ Bases:
gino.engine.GinoConnection
-
class
gino.ext.sanic.GinoEngine(dialect, pool, loop, logging_name=None, echo=None, execution_options=None)[source]¶ Bases:
gino.engine.GinoEngine-
connection_cls¶ alias of
GinoConnection
-
-
class
gino.ext.sanic.GinoExecutor(query)[source]¶ Bases:
gino.api.GinoExecutor
-
class
gino.ext.sanic.SanicStrategy[source]¶ Bases:
gino.strategies.GinoStrategy-
engine_cls¶ alias of
GinoEngine
-
name= 'sanic'¶
-