Skip to content

v0.2.14

Latest

Choose a tag to compare

@long2ice long2ice released this 12 Aug 04:48
· 2 commits to dev since this release
  • Set the PEP 249 module globals apilevel, threadsafety and paramstyle, and export the
    exception classes from asyncmy (#77).
  • Expose the server's SQLSTATE on exceptions as MySQLError.sqlstate; args is unchanged (#138).
  • Fix ssl=True silently connecting in plaintext: it now builds a default TLS context, and an
    ssl argument that is neither True, a dict, nor an ssl.SSLContext raises ValueError
    instead of disabling TLS (#90).
  • Connection.cursor() is now awaitable, so aiomysql's cur = await conn.cursor() spelling
    works; conn.cursor() and async with conn.cursor() are unaffected (#145).
  • Add Gtid.__hash__ / GtidSet.__hash__ — defining __eq__ had made Gtid unhashable, which
    made GtidSet (and therefore GTID replication) unusable (#59).
  • Declare the Cython modules free-threading compatible. Without this, importing asyncmy
    re-enables the GIL for the whole process on a free-threaded build. Module-level state is built
    during import and read-only afterwards; this does not make a single Connection/Cursor safe
    to share between threads. Requires Cython 3.1+, and CI now runs the suite on 3.14t.
    Thanks @honglei (#151).
  • Read the version from the installed package metadata instead of repeating it in
    asyncmy/version.py, so pyproject.toml is the single source and the _client_version the
    server sees cannot drift. Thanks @waketzheng (#149).
  • Ship type information (PEP 561): py.typed plus .pyi stubs for the Cython modules, so
    mypy and Pylance see real signatures instead of nothing. make stubs regenerates them and
    make check runs stubtest, which fails on any drift from the compiled modules (#78).
  • Add connect(password_creator=...): a callable consulted before every connection attempt,
    including the ones a pool makes when it recycles or reconnects, so short-lived credentials such
    as AWS RDS IAM tokens can be refreshed. May return an awaitable. Thanks @DolevGabay (#139).
  • Fix ping(reconnect=True) never actually reconnecting: _connected stayed set when the ping
    failed, so connect() returned early and the follow-up ping ran on the dead connection.
  • Add connect(query_callback=...), called as callback(cursor, query, elapsed_ms) after every
    statement. Lets statement logging go somewhere other than echo's hardcoded INFO line — a
    slow-query log, a tracing span, a different level. executemany/callproc report once per
    call. Independent of echo, which is unchanged (#81, #69).
  • Add connect(sock=...): speak MySQL over a socket the caller has already connected. Combined
    with ssl the TLS handshake runs before the MySQL handshake instead of being negotiated
    in-protocol, which is what connectors fronting the server with a TLS proxy need (#71).
  • Mark the connection secure after the TLS handshake. _secure was only set for unix sockets, so
    caching_sha2_password full authentication over TLS took the RSA branch instead of sending the
    password in the clear, and the server rejected it with 1045 Access denied (#117).