Skip to content

feat(db): Add async versions for all database modules - #37

Merged
haobibo merged 10 commits into
mainfrom
dev/aio
Sep 12, 2026
Merged

feat(db): Add async versions for all database modules#37
haobibo merged 10 commits into
mainfrom
dev/aio

Conversation

@haobibo

@haobibo haobibo commented Jun 29, 2026

Copy link
Copy Markdown
Member
  • Add aloha.db.base_aio module with async PasswordVault
  • Add aloha.db.postgres_aio using asyncpg
  • Add aloha.db.mysql_aio using aiomysql
  • Add aloha.db.redis_aio using redis.asyncio
  • Add aloha.db.mongo_aio using motor (async pymongo)
  • Add aloha.db.elasticsearch_aio using AsyncElasticsearch
  • Add aloha.db.kafka_aio using aiokafka
  • Add aloha.db.sqlite_aio using aiosqlite
  • Add aloha.db.duckdb_aio using aioduckdb
  • Add aloha.db.oracle_aio using oracledb async support
  • Update pkg/aloha/db/init.py to export both sync and async modules
  • Update pyproject.toml with new 'aio' optional dependencies

The async modules maintain similar interfaces to their sync counterparts, allowing minimal code changes when migrating existing applications.

- Add aloha.db.base_aio module with async PasswordVault
- Add aloha.db.postgres_aio using asyncpg
- Add aloha.db.mysql_aio using aiomysql
- Add aloha.db.redis_aio using redis.asyncio
- Add aloha.db.mongo_aio using motor (async pymongo)
- Add aloha.db.elasticsearch_aio using AsyncElasticsearch
- Add aloha.db.kafka_aio using aiokafka
- Add aloha.db.sqlite_aio using aiosqlite
- Add aloha.db.duckdb_aio using aioduckdb
- Add aloha.db.oracle_aio using oracledb async support
- Update pkg/aloha/db/__init__.py to export both sync and async modules
- Update pyproject.toml with new 'aio' optional dependencies

The async modules maintain similar interfaces to their sync counterparts,
allowing minimal code changes when migrating existing applications.

Co-authored-by: openhands <openhands@all-hands.dev>
@CLAassistant

CLAassistant commented Jun 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ haobibo
❌ openhands-agent
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
haobibo and others added 4 commits July 9, 2026 12:48
Change license from {text = "Apache-2.0"} to "Apache-2.0" to fix setuptools deprecation warning.

Co-authored-by: openhands <openhands@all-hands.dev>
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Comment thread pkg/aloha/db/mongo_aio.py Fixed
Signed-off-by: Bibo Hao <haobibo@users.noreply.github.com>
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/__init__.py Fixed
Comment thread pkg/aloha/db/kafka_aio.py
if isinstance(v, bytes):
try:
v = v.decode("utf-8")
except UnicodeDecodeError:
Comment thread pkg/aloha/db/kafka.py
if val is not None:
try:
val = val.decode("utf-8")
except UnicodeDecodeError:
Comment thread pkg/aloha/db/kafka.py
if key is not None:
try:
key = key.decode("utf-8")
except UnicodeDecodeError:
Comment thread pkg/aloha/db/kafka.py
if isinstance(v, bytes):
try:
v = v.decode("utf-8")
except UnicodeDecodeError:
Comment thread src/tests/test_kafka.py

# Continue generator to trigger KeyboardInterrupt/finally block
next(gen)
except KeyboardInterrupt:
Comment thread pkg/aloha/db/mongo_aio.py
_conn = {}


def MongoOperator(config):
Comment thread pkg/aloha/db/mongo_aio.py

return self.collection

async def insert(self, doc_or_docs, check_keys=False, collection_name=None):
Comment thread pkg/aloha/db/mongo_aio.py
except Exception as e: # noqa: BLE001
LOG.exception(e)

async def insert_many(self, docs, collection_name=None):
Comment thread pkg/aloha/db/mongo_aio.py
except Exception as e: # noqa: BLE001
LOG.exception(e)

async def insert_one(self, doc, collection_name=None):
Comment thread pkg/aloha/db/mongo_aio.py
except Exception as e: # noqa: BLE001
LOG.exception(e)

async def delete_many(self, field_filter, collection_name=None):
@haobibo
haobibo merged commit fefff23 into main Sep 12, 2026
7 of 10 checks passed
@haobibo
haobibo deleted the dev/aio branch September 12, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants