github IAsDoubleYou/homeassistant-mysql_query v2.0.0
v2.0.0 - Connection Pooling & Concurrency Support

latest releases: v4.2.1, v4.2.0, v4.1.0...
3 months ago

[2.0.0] - 2026-08-09

Added

  • An aiomysql connection pool per config entry. Connections stay open between service calls instead of being opened and closed per query, are recycled after an hour, and are checked with a ping before every statement so a connection the server dropped while idle is transparently rebuilt.
  • An asyncio.Lock per config entry. Concurrent mysql_query.query and mysql_query.execute calls on the same connection are now handled one after another, so their statements can no longer interleave on the same MySQL socket. Calls on different config entries still run in parallel.
  • A timeout on waiting for a free pooled connection, using the configured Connect Timeout. It surfaces as a raised error for query and as an error payload for execute instead of hanging the call.
  • Reloading of a config entry when its settings change, so an edit through the Options Flow rebuilds the pool instead of leaving the old settings in place until a restart.
  • db.py, holding the connection settings, pool creation and connection test shared by the integration and the config flow.
  • Tests for the pool (creation settings, reuse, ping, teardown) and for the lock (serialised calls, independence between entries, unload waiting for a running call).

Changed

  • Breaking: the driver moved from mysql-connector-python to aiomysql, so queries talk to MySQL over asyncio instead of through a worker thread. Home Assistant installs the new requirement automatically.
  • db4query no longer opens a short-lived second connection. The pooled connection is switched to the requested database for the statement and switched back afterwards; a connection that cannot be switched back is dropped from the pool instead of being reused.
  • The services are registered once for the domain instead of being re-registered by every config entry, and they are removed again when the last entry is unloaded.
  • The warning logged when a result set exceeds the row limit is now in English, like the rest of the log output.
  • Unloading a config entry waits for a service call that is still running before it closes the pool.

Removed

  • Breaking: error.sqlstate in the execute response is always null. The new driver does not expose the SQLSTATE code; error.errno and error.message are unchanged.

Full Changelog: v1.9.0...v2.0.0

Don't miss a new homeassistant-mysql_query release

NewReleases is sending notifications on new releases.