Previous topic

asyncqlio.backends.mysql

Next topic

asyncqlio.exc

This Page

asyncqlio.backends.mysql.aiomysql

The aiomysql connector for MySQL/MariaDB databases.

Classes

AiomysqlConnector(dsn) A connector that uses the aiomysql library.
AiomysqlResultSet(cursor) Represents a result set returned by the MySQL database.
AiomysqlTransaction(connector) Represents a transaction for aiomysql.
CONNECTOR_TYPE alias of asyncqlio.backends.mysql.aiomysql.AiomysqlConnector
class asyncqlio.backends.mysql.aiomysql.AiomysqlResultSet(cursor)[source]

Bases: asyncqlio.backends.base.BaseResultSet

Represents a result set returned by the MySQL database.

keys
Returns:An iterable of keys that this query contained.
coroutine close()[source]

Closes this result set.

coroutine fetch_all()[source]

Fetches ALL the rows.

coroutine fetch_many(self, n)[source]

Fetches the next N rows.

coroutine fetch_row(self)[source]

Fetches the next row in this result set.

Return type:Dict[Any, Any]
coroutine flatten(self)

Flattens this ResultSet.

Return type:List[DictRow]
Returns:A list of DictRow objects.
class asyncqlio.backends.mysql.aiomysql.AiomysqlTransaction(connector)[source]

Bases: asyncqlio.backends.base.BaseTransaction

Represents a transaction for aiomysql.

connection = None

The current acquired connection for this transaction.

coroutine cursor(self, sql, params=None)[source]

Returns a AiomysqlResultSet for the specified SQL.

Return type:AiomysqlResultSet
coroutine begin()[source]

Begins the current transaction.

coroutine close(self, *, has_error=False)[source]

Closes the current connection.

coroutine commit()[source]

Commits the current transaction.

create_savepoint(name)

Creates a savepoint in the current transaction.

Warning

This is not supported in all DB engines. If so, this will raise NotImplementedError.

Parameters:name (str) – The name of the savepoint to create.
coroutine execute(self, sql, params=None)[source]

Executes some SQL in the current transaction.

release_savepoint(name)

Releases a savepoint in the current transaction.

Parameters:name (str) – The name of the savepoint to release.
coroutine rollback(self, checkpoint=None)[source]

Rolls back the current transaction.

Parameters:checkpoint (Optional[str]) – Ignored.
class asyncqlio.backends.mysql.aiomysql.AiomysqlConnector(dsn)[source]

Bases: asyncqlio.backends.base.BaseConnector

A connector that uses the aiomysql library.

pool = None

The current connection pool for this connector.

get_transaction()[source]

Gets a new transaction object.

Return type:BaseTransaction
emit_param(name)[source]

Emits a parameter that can be used as a substitute during a query.

Parameters:name (str) – The name of the parameter.
Return type:str
Returns:A string that represents the substitute to be placed in the query.
coroutine close(self, forcefully=False)[source]

Closes this connector.

coroutine connect(self, *, loop=None)[source]

Connects this connector.

Return type:AiomysqlConnector
coroutine get_db_server_version()[source]

Gets the version of the DB server running.

asyncqlio.backends.mysql.aiomysql.CONNECTOR_TYPE

alias of asyncqlio.backends.mysql.aiomysql.AiomysqlConnector