1 Commits
Author SHA1 Message Date
dsql a358a417b4 release: 1.0.0
first stable release. pre-1.0.0 verification complete: all surviving MED regressions and
gaps resolved and independently re-fired, tree audited clean across the suite.

Signed-off-by: disqualifier <dev@disqualifier.me>
2026-07-06 21:21:00 -04:00
3 changed files with 21 additions and 24 deletions
+3 -3
View File
@@ -11,18 +11,18 @@ wire-compatible and share the driver, so this covers both.
`requirements.txt`:
```
mysql @ git+ssh://git@git.rethinkstudios.io/rethink-public/mysql.git@v1.0.0
mysql @ git+ssh://git@git.rethinkstudios.io/rethink-public/mysql.git@v0.1.6
```
Direct:
```bash
pip install "mysql @ git+ssh://git@git.rethinkstudios.io/rethink-public/mysql.git@v1.0.0"
pip install "mysql @ git+ssh://git@git.rethinkstudios.io/rethink-public/mysql.git@v0.1.6"
```
Pulls `aiomysql` (which pulls `PyMySQL`).
Drop the `@v1.0.0` suffix from the line above to install the latest unpinned.
Drop the `@v0.1.6` suffix from the line above to install the latest unpinned.
## The two-layer API
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "mysql"
version = "1.1.0"
version = "1.0.0"
description = "async mysql/mariadb wrapper over aiomysql: two-layer API (friendly verbs + raw escape hatch), fail-loud, config-free"
requires-python = ">=3.10"
dependencies = [
+17 -20
View File
@@ -17,11 +17,8 @@ a literal `%` in layer-2 SQL text must be written `%%` only when params are pass
1 handles this for you.
errors are FAIL LOUD (unlike the mongo lib's swallow-and-default): every method catches
the driver error and re-raises it - the raised exception IS the signal, and the caller
(which alone knows whether a failure is fatal or routine) decides and logs. the wrapped
method itself logs only at DEBUG (with the traceback) so a failure isn't reported twice
(raise XOR log). a None/[] return is only ever a real result, never a swallowed failure.
for anything not wrapped, use `.pool`.
the driver error, logs via getLogger(__name__), and re-raises. a None/[] return is only
ever a real result, never a swallowed failure. for anything not wrapped, use `.pool`.
"""
import asyncio
@@ -138,7 +135,7 @@ class MysqlDB:
await cur.execute("SELECT 1")
await cur.fetchone()
except _DRIVER_ERRORS:
log.debug("mysql.connect() failed", exc_info=True)
log.exception("mysql.connect() failed")
if pool is not None:
pool.close()
await pool.wait_closed()
@@ -169,7 +166,7 @@ class MysqlDB:
self._pool.close()
await self._pool.wait_closed()
except _DRIVER_ERRORS:
log.debug("mysql.close()", exc_info=True)
log.exception("mysql.close()")
raise
finally:
self._pool = None
@@ -232,7 +229,7 @@ class MysqlDB:
try:
rowcount, _ = await self._run(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.execute(): %s", query, exc_info=True)
log.exception("mysql.execute(): %s", query)
raise
return rowcount
@@ -241,7 +238,7 @@ class MysqlDB:
try:
return await self._fetchall(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.fetch(): %s", query, exc_info=True)
log.exception("mysql.fetch(): %s", query)
raise
async def fetchone(self, query: str, params: Optional[Sequence] = None) -> Optional[dict]:
@@ -249,7 +246,7 @@ class MysqlDB:
try:
return await self._fetchone(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.fetchone(): %s", query, exc_info=True)
log.exception("mysql.fetchone(): %s", query)
raise
async def fetchval(self, query: str, params: Optional[Sequence] = None) -> Any:
@@ -257,7 +254,7 @@ class MysqlDB:
try:
row = await self._fetchone(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.fetchval(): %s", query, exc_info=True)
log.exception("mysql.fetchval(): %s", query)
raise
if not row:
return None
@@ -279,7 +276,7 @@ class MysqlDB:
try:
await self._run(f"CREATE DATABASE IF NOT EXISTS {_quote_ident_literal(name)}")
except _DRIVER_ERRORS:
log.debug("mysql.create_database(%s)", name, exc_info=True)
log.exception("mysql.create_database(%s)", name)
raise
async def create_table(self, name: str, schema: Dict[str, str]) -> None:
@@ -295,7 +292,7 @@ class MysqlDB:
try:
await self._run(f"CREATE TABLE IF NOT EXISTS {_quote_ident_literal(name)} ({cols})")
except _DRIVER_ERRORS:
log.debug("mysql.create_table(%s)", name, exc_info=True)
log.exception("mysql.create_table(%s)", name)
raise
async def drop(self, name: str, *, table: bool = True) -> None:
@@ -304,7 +301,7 @@ class MysqlDB:
try:
await self._run(f"DROP {kind} IF EXISTS {_quote_ident_literal(name)}")
except _DRIVER_ERRORS:
log.debug("mysql.drop(%s)", name, exc_info=True)
log.exception("mysql.drop(%s)", name)
raise
async def insert(self, table: str, values: Dict[str, Any]) -> int:
@@ -321,7 +318,7 @@ class MysqlDB:
try:
_, lastrowid = await self._run(query, list(values.values()))
except _DRIVER_ERRORS:
log.debug("mysql.insert(%s)", table, exc_info=True)
log.exception("mysql.insert(%s)", table)
raise
return lastrowid
@@ -336,7 +333,7 @@ class MysqlDB:
try:
return await self._fetchall(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.get(%s)", table, exc_info=True)
log.exception("mysql.get(%s)", table)
raise
async def get_one(self, table: str, conditions: Optional[Dict[str, Any]] = None) -> Optional[dict]:
@@ -346,7 +343,7 @@ class MysqlDB:
try:
return await self._fetchone(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.get_one(%s)", table, exc_info=True)
log.exception("mysql.get_one(%s)", table)
raise
async def delete(self, table: str, conditions: Optional[Dict[str, Any]] = None) -> int:
@@ -359,7 +356,7 @@ class MysqlDB:
try:
rowcount, _ = await self._run(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.delete(%s)", table, exc_info=True)
log.exception("mysql.delete(%s)", table)
raise
return rowcount
@@ -370,7 +367,7 @@ class MysqlDB:
try:
row = await self._fetchone(query, params)
except _DRIVER_ERRORS:
log.debug("mysql.exists(%s)", table, exc_info=True)
log.exception("mysql.exists(%s)", table)
raise
return bool(_first_value(row)) if row else False
@@ -393,7 +390,7 @@ class MysqlDB:
try:
rowcount, _ = await self._run(query, list(values.values()))
except _DRIVER_ERRORS:
log.debug("mysql.upsert(%s)", table, exc_info=True)
log.exception("mysql.upsert(%s)", table)
raise
return rowcount