From 706f6f1477549704b5ca461d6e475c293475f1f4 Mon Sep 17 00:00:00 2001 From: Oleg Ovcharuk Date: Wed, 19 Feb 2025 09:59:37 +0300 Subject: [PATCH] Fix async cursor fetch methods --- .github/workflows/tests.yml | 5 ++--- requirements.txt | 2 +- tox.ini | 9 ++++++++- ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31f58c4..7ced94f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,8 +19,7 @@ jobs: max-parallel: 4 matrix: python-version: [3.9] - environment: [test] - folder: [ydb_sqlalchemy, test] + environment: [test-unit, test-dialect] steps: - uses: actions/checkout@v1 @@ -34,4 +33,4 @@ jobs: python -m pip install --upgrade pip pip install tox==4.2.6 - name: Run unit tests - run: tox -e ${{ matrix.environment }} -- ${{ matrix.folder }} + run: tox -e ${{ matrix.environment }} diff --git a/requirements.txt b/requirements.txt index f0364c7..410c6d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ sqlalchemy >= 1.4.0, < 3.0.0 ydb >= 3.18.8 -ydb-dbapi >= 0.1.7 +ydb-dbapi >= 0.1.8 diff --git a/tox.ini b/tox.ini index 5549e97..111242a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = test,test-all,test-dbapi,test-unit,black,black-format,style,coverage +envlist = test,test-all,test-dialect,test-unit,black,black-format,style,coverage minversion = 4.2.6 skipsdist = True ignore_basepython_conflict = true @@ -29,6 +29,13 @@ commands = pytest -v ydb_sqlalchemy docker-compose down -v +[testenv:test-dialect] +commands = + docker-compose up -d + python {toxinidir}/wait_container_ready.py + pytest -v test --dbdriver ydb --dbdriver ydb_async + docker-compose down -v + [testenv:test-unit] commands = pytest -v {toxinidir}/ydb_sqlalchemy diff --git a/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py b/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py index 09288dc..74830e9 100644 --- a/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py +++ b/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py @@ -87,13 +87,13 @@ def rowcount(self): return self._cursor.rowcount def fetchone(self): - return await_only(self._cursor.fetchone()) + return self._cursor.fetchone() def fetchmany(self, size=None): - return await_only(self._cursor.fetchmany(size=size)) + return self._cursor.fetchmany(size=size) def fetchall(self): - return await_only(self._cursor.fetchall()) + return self._cursor.fetchall() def execute_scheme(self, sql, parameters=None): return await_only(self._cursor.execute_scheme(sql, parameters))