add rudimentary asyncio database clients

oslo.db is planning to add support for SQLAlchemy's asyncio
API to enginefacade [1].   This will provide one way for projects
that are migrating off of eventlet [2] to be able to use asyncio
directly against supported databases like MySQL.

To support this, the test suite relies upon the aiosqlite [3] package to
run basic tests for enginefacade, and in practice openstack applications
that wish to use asyncio with MySQL need an asyncio MySQL library as
well, chosen here as aiomysql [4], however we might also want to consider
asyncmy [5].

aiosqlite is essentially a wrapper around Python's own sqlite3
that runs the sync, embedded DBAPI in a background thread to produce
an async calling style, whereas aiomysql makes use of pymysql for
constants but re-implements the MySQL protocol conversation in an
asyncio fashion.   asyncmy, if we consider it, is a fully novel MySQL
client written in Cython.   It's probably faster than aiomysql,
is more actively maintained, but is newer and less traditional.

SQLAlchemy has full support and CI coverage for all of these DBAPIs.

The oslo.db patch at [1] can't go green until aiosqlite is present
in upper constraints.

Efforts to answer the questions at [3]:

* Is the library actively maintained?

aiosqlite was last committed two months ago [4], aiomysql was last committed in June, 2023 [5].
I will note that aiomysql is definitely not responsive enough as a
project, although we haven't seen many problems with it and distros do
package it.  If aiomysql is not active enough there is always asyncmy [6] which is much more
active, but that's largely because it's a from the ground-up rewrite of the whole
MySQL client in cython.   asyncmy is definitely a lot more responsive than aiomysql
as a project at the moment.

* Is the library good code?

All of these libraries have test suites and sane approaches to the problem at hand,
they also pass for SQLAlchemy's dialect test suites which is a very broad series
of tests across many areas of functionality.

* Is the library python 3 compatible?

Obviously these are all Python 3 only

* Is the library license compatible?

Both aiosqlite and aiomysql are MIT licensed.   asyncmy is apache licensed.

* Is the library already packaged in the distros we target (Ubuntu latest / Fedora latest)?

Ubuntu has packages for aiosqlite and aiomysql.  Fedora has packages for aiosqlite, aiomysql
and asyncmy.

* Is the function of this library already covered by other libraries in global-requirements.txt?

Definitely not

* Is the library required for OpenStack project or related dev or infrastructure
setup? (Answer to this should be Yes, of course) Which?

oslo.db, see [1] , as part of eventlet removal, see [2]

* If the library release is managed by the Openstack release process does it
use the cycle-with-intermediary release type?

N/A IIUC

[1] https://review.opendev.org/c/openstack/oslo.db/+/922976
[2] https://review.opendev.org/c/openstack/governance/+/902585
[3] https://docs.openstack.org/project-team-guide/dependency-management.html#for-new-requirements
[4] https://github.com/omnilib/aiosqlite
[5] https://github.com/aio-libs/aiomysql
[6] https://github.com/long2ice/asyncmy

Change-Id: Ibf7cc9197fdb61c3507eb3f1ade83243818449b6
This commit is contained in:
Mike Bayer
2024-09-30 16:19:57 -04:00
parent 2d001bc6c7
commit 24d5403dac
2 changed files with 4 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ alembic!=1.2.0,!=1.6.3 # MIT
amqp!=2.1.4,!=5.0.4 # BSD
appdirs # MIT License
apscheduler # MIT License
aiomysql # MIT License
aiosqlite # MIT License
autobahn # MIT License
automaton # Apache-2.0
autopage # Apache-2.0

View File

@@ -161,6 +161,8 @@ async-timeout===4.0.3;python_version=='3.8'
async-timeout===4.0.3;python_version=='3.9'
virtualbmc===3.1.0
SQLAlchemy===2.0.32
aiosqlite===0.20.0
aiomysql===0.2.0
pyroute2===0.7.12
google-auth===2.34.0
kazoo===2.10.0