- 欢迎来到 GINO 的文档
- 上手教程
- 进阶用法
- 原理说明
- 参考手册
- API 参考
- gino.bakery module
- gino.api module
- gino.declarative module
- gino.schema module
- gino.crud module
- gino.json_support module
- gino.engine module
- gino.loader module
- gino.dialects.asyncpg module
- gino.dialects.base module
- gino.transaction module
- gino.dialects package
- gino.dialects.aiomysql module
- gino.ext package
- gino.aiocontextvars module
- gino.exceptions module
- gino.strategies module
- 扩展
- 版本历史
- API 参考
gino.dialects.aiomysql module
- class
gino.dialects.aiomysql.
AiomysqlDBAPI
¶ 基类:
gino.dialects.base.BaseDBAPI
paramstyle
= 'format'¶
- class
gino.dialects.aiomysql.
AiomysqlDialect
(*args, bakery=None, **kwargs)¶ 基类:
sqlalchemy.dialects.mysql.base.MySQLDialect
,gino.dialects.base.AsyncDialectMixin
colspecs
= {<class 'sqlalchemy.dialects.mysql.types._IntegerType'>: <class 'sqlalchemy.dialects.mysql.types._IntegerType'>, <class 'sqlalchemy.dialects.mysql.types._NumericType'>: <class 'sqlalchemy.dialects.mysql.types._NumericType'>, <class 'sqlalchemy.dialects.mysql.types._FloatType'>: <class 'sqlalchemy.dialects.mysql.types._FloatType'>, <class 'sqlalchemy.sql.sqltypes.Numeric'>: <class 'sqlalchemy.dialects.mysql.types.NUMERIC'>, <class 'sqlalchemy.sql.sqltypes.Float'>: <class 'sqlalchemy.dialects.mysql.types.FLOAT'>, <class 'sqlalchemy.sql.sqltypes.Time'>: <class 'sqlalchemy.dialects.mysql.types.TIME'>, <class 'sqlalchemy.sql.sqltypes.Enum'>: <class 'gino.dialects.aiomysql.AsyncEnum'>, <class 'sqlalchemy.sql.sqltypes.MatchType'>: <class 'sqlalchemy.dialects.mysql.types._MatchType'>, <class 'sqlalchemy.sql.sqltypes.JSON'>: <class 'sqlalchemy.dialects.mysql.json.JSON'>, <class 'sqlalchemy.sql.sqltypes.JSON.JSONIndexType'>: <class 'sqlalchemy.dialects.mysql.json.JSONIndexType'>, <class 'sqlalchemy.sql.sqltypes.JSON.JSONPathType'>: <class 'sqlalchemy.dialects.mysql.json.JSONPathType'>, <class 'sqlalchemy.dialects.mysql.enumerated.ENUM'>: <class 'gino.dialects.aiomysql.AsyncEnum'>, <class 'sqlalchemy.sql.sqltypes.NullType'>: <class 'gino.dialects.aiomysql.GinoNullType'>}¶
cursor_cls
¶DBAPICursor
的别名
dbapi_class
¶AiomysqlDBAPI
的别名
driver
= 'aiomysql'¶
execution_ctx_cls
¶
- async
get_isolation_level
(connection)¶ Given a DBAPI connection, return its isolation level.
When working with a
_engine.Connection
object, the corresponding DBAPI connection may be procured using the_engine.Connection.connection
accessor.Note that this is a dialect-level method which is used as part of the implementation of the
_engine.Connection
and_engine.Engine
isolation level facilities; these APIs should be preferred for most typical use cases.参见
_engine.Connection.get_isolation_level()
- view current level_engine.Connection.default_isolation_level
- view default level:paramref:`.Connection.execution_options.isolation_level` - set per
_engine.Connection
isolation level:paramref:`_sa.create_engine.isolation_level` - set per
_engine.Engine
isolation level
- async
has_table
(connection, table_name, schema=None)¶ Check the existence of a particular table in the database.
Given a
_engine.Connection
object and a string table_name, return True if the given table (possibly within the specified schema) exists in the database, False otherwise.
init_kwargs
= {'auth_plugin', 'autocommit', 'bakery', 'charset', 'client_flag', 'connect_timeout', 'conv', 'cursorclass', 'db', 'host', 'init_command', 'local_infile', 'loop', 'maxsize', 'minsize', 'no_delay', 'password', 'pool_recycle', 'port', 'prebake', 'program_name', 'read_default_file', 'read_default_group', 'server_public_key', 'sql_mode', 'ssl', 'unix_socket', 'use_unicode', 'user'}¶
- async
init_pool
(url, loop, pool_class=None)¶
on_connect
()¶Return a callable which sets up a newly created DBAPI connection.
The callable should accept a single argument "conn" which is the DBAPI connection itself. The inner callable has no return value.
E.g.:
class MyDialect(default.DefaultDialect): # ... def on_connect(self): def do_on_connect(connection): connection.execute("SET SPECIAL FLAGS etc") return do_on_connect
This is used to set dialect-wide per-connection options such as isolation modes, Unicode modes, etc.
The "do_on_connect" callable is invoked by using the
_events.PoolEvents.first_connect()
and_events.PoolEvents.connect()
event hooks, then unwrapping the DBAPI connection and passing it into the callable. The reason it is invoked for both events is so that any dialect-level initialization that occurs upon first connection, which also makes use of the_events.PoolEvents.first_connect()
method, will proceed after this hook has been called. This currently means the hook is in fact called twice for the very first connection in which a dialect creates; and once per connection afterwards.If None is returned, no event listener is generated.
- 返回
a callable that accepts a single DBAPI connection as an argument, or None.
参见
Dialect.connect()
- allows the DBAPIconnect()
sequence itself to be controlled.
postfetch_lastrowid
= False¶
- async
set_isolation_level
(connection, level)¶ Given a DBAPI connection, set its isolation level.
Note that this is a dialect-level method which is used as part of the implementation of the
_engine.Connection
and_engine.Engine
isolation level facilities; these APIs should be preferred for most typical use cases.参见
_engine.Connection.get_isolation_level()
- view current level_engine.Connection.default_isolation_level
- view default level:paramref:`.Connection.execution_options.isolation_level` - set per
_engine.Connection
isolation level:paramref:`_sa.create_engine.isolation_level` - set per
_engine.Engine
isolation level
statement_compiler
¶sqlalchemy.dialects.mysql.base.MySQLCompiler
的别名
support_prepare
= False¶
support_returning
= False¶
supports_native_decimal
= True¶
transaction
(raw_conn, args, kwargs)¶
- class
gino.dialects.aiomysql.
AiomysqlExecutionContext
¶ 基类:
gino.dialects.base.ExecutionContextOverride
,sqlalchemy.dialects.mysql.base.MySQLExecutionContext
get_affected_rows
()¶
get_lastrowid
()¶return self.cursor.lastrowid, or equivalent, after an INSERT.
This may involve calling special cursor functions, issuing a new SELECT on the cursor (or a new one), or returning a stored value that was calculated within post_exec().
This function will only be called for dialects which support "implicit" primary key generation, keep preexecute_autoincrement_sequences set to False, and when no explicit id value was bound to the statement.
The function is called once, directly after post_exec() and before the transaction is committed or ResultProxy is generated. If the post_exec() method assigns a value to self._lastrowid, the value is used in place of calling get_lastrowid().
Note that this method is not equivalent to the
lastrowid
method onResultProxy
, which is a direct proxy to the DBAPIlastrowid
accessor in all cases.
- class
gino.dialects.aiomysql.
AiomysqlIterator
(context, cursor)¶ - async
forward
(n, *, timeout=<object object>)¶
- async
many
(n, *, timeout=<object object>)¶
- async
next
(*, timeout=<object object>)¶
- async
- class
gino.dialects.aiomysql.
AsyncEnum
(*enums, **kw)¶ 基类:
sqlalchemy.dialects.mysql.enumerated.ENUM
- async
create_async
(bind=None, checkfirst=True)¶
- async
drop_async
(bind=None, checkfirst=True)¶
- async
- class
gino.dialects.aiomysql.
DBAPICursor
(dbapi_conn)¶ 基类:
gino.dialects.base.DBAPICursor
- async
async_execute
(query, timeout, args, limit=0, many=False)¶
- property
description
¶
- async
execute_baked
(baked_query, timeout, args, one)¶
get_statusmsg
()¶
iterate
(context)¶
- async
prepare
(context, clause=None)¶
- async
- class
gino.dialects.aiomysql.
GinoNullType
¶ 基类:
sqlalchemy.sql.sqltypes.NullType
result_processor
(dialect, coltype)¶Return a conversion function for processing result row values.
Returns a callable which will receive a result row column value as the sole positional argument and will return a value to return to the user.
If processing is not necessary, the method should return
None
.- 参数
dialect -- Dialect instance in use.
coltype -- DBAPI coltype argument received in cursor.description.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论