From 4ad025dea80f9270d6972ac54d86495342dd8d6f Mon Sep 17 00:00:00 2001 From: Jesus Lara Date: Wed, 7 Aug 2024 18:10:05 +0200 Subject: [PATCH] fixing dependencies and some tests --- asyncdb/drivers/outputs/record.py | 2 +- asyncdb/drivers/outputs/recordset.py | 2 +- asyncdb/drivers/postgres.py | 2 +- asyncdb/drivers/sa.py | 2 +- asyncdb/interfaces.py | 4 ++-- asyncdb/meta/__init__.py | 7 ------- asyncdb/meta/record.py | 1 - asyncdb/version.py | 2 +- tests/test_aiosqlite.py | 5 +++-- tests/test_asyncpg.py | 3 ++- tests/test_postgres.py | 3 ++- tests/test_rethink.py | 3 ++- tests/test_sqlalchemy.py | 5 +++-- tests/test_sqlserver.py | 3 ++- 14 files changed, 21 insertions(+), 23 deletions(-) diff --git a/asyncdb/drivers/outputs/record.py b/asyncdb/drivers/outputs/record.py index 24db6042..3cfd41e4 100644 --- a/asyncdb/drivers/outputs/record.py +++ b/asyncdb/drivers/outputs/record.py @@ -4,7 +4,7 @@ Returning a asyncdb Record row Format. """ import logging -from ...meta import Record +from ...meta.record import Record from .base import OutputFormat diff --git a/asyncdb/drivers/outputs/recordset.py b/asyncdb/drivers/outputs/recordset.py index 86ce14ef..88b62dee 100644 --- a/asyncdb/drivers/outputs/recordset.py +++ b/asyncdb/drivers/outputs/recordset.py @@ -4,7 +4,7 @@ Returning a asyncdb Recordset Result Format. """ import logging -from ...meta import Recordset +from ...meta.recordset import Recordset from .base import OutputFormat diff --git a/asyncdb/drivers/postgres.py b/asyncdb/drivers/postgres.py index 7f4d8cda..ed3dc35e 100644 --- a/asyncdb/drivers/postgres.py +++ b/asyncdb/drivers/postgres.py @@ -41,7 +41,7 @@ from ..utils.encoders import ( BaseEncoder, ) -from ..meta import Recordset +from asyncdb.meta.recordset import Recordset from .sql import SQLDriver # from .abstract import BaseCursor diff --git a/asyncdb/drivers/sa.py b/asyncdb/drivers/sa.py index b3d0437c..14530d4b 100644 --- a/asyncdb/drivers/sa.py +++ b/asyncdb/drivers/sa.py @@ -12,7 +12,7 @@ from sqlalchemy.exc import DatabaseError, OperationalError, SQLAlchemyError, ProgrammingError, InvalidRequestError from sqlalchemy import text from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession -from ..meta import Record +from asyncdb.meta.record import Record from ..exceptions import ( EmptyStatement, NoDataFound, diff --git a/asyncdb/interfaces.py b/asyncdb/interfaces.py index 6ecb8c8e..9710919a 100644 --- a/asyncdb/interfaces.py +++ b/asyncdb/interfaces.py @@ -22,7 +22,7 @@ from functools import partial from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from datamodel.exceptions import ValidationError -from .meta import Record, Recordset +from .meta.record import Record from .exceptions import default_exception_handler, DriverError, EmptyStatement from .models import Model, Field, is_missing, is_dataclass from .utils.types import Entity, SafeDict @@ -465,7 +465,7 @@ async def execute_many(self, sentence: list, *args) -> Optional[Any]: """ @abstractmethod - async def query(self, sentence: Union[str, list], **kwargs) -> Optional[Recordset]: + async def query(self, sentence: Union[str, list], **kwargs) -> Optional[Sequence]: """queryrow. Making a Query and returns a resultset. diff --git a/asyncdb/meta/__init__.py b/asyncdb/meta/__init__.py index ee9a57e9..57c5b967 100644 --- a/asyncdb/meta/__init__.py +++ b/asyncdb/meta/__init__.py @@ -1,10 +1,3 @@ """ Meta Objects for records and recordset for AsyncDB. """ -from .record import Record -from .recordset import Recordset - -__all__ = [ - "Record", - "Recordset", -] diff --git a/asyncdb/meta/record.py b/asyncdb/meta/record.py index 748472cc..6df14c61 100644 --- a/asyncdb/meta/record.py +++ b/asyncdb/meta/record.py @@ -5,7 +5,6 @@ """ from collections.abc import MutableMapping, Iterator from typing import Any, Union -from google.cloud.bigquery import Row class Record(MutableMapping): diff --git a/asyncdb/version.py b/asyncdb/version.py index c3e7393d..ce924773 100644 --- a/asyncdb/version.py +++ b/asyncdb/version.py @@ -3,7 +3,7 @@ __title__ = "asyncdb" __description__ = "Library for Asynchronous data source connections \ Collection of asyncio drivers." -__version__ = "2.7.16" +__version__ = "2.7.17" __author__ = "Jesus Lara" __author_email__ = "jesuslarag@gmail.com" __license__ = "BSD" diff --git a/tests/test_aiosqlite.py b/tests/test_aiosqlite.py index 51815804..e793e374 100644 --- a/tests/test_aiosqlite.py +++ b/tests/test_aiosqlite.py @@ -1,9 +1,10 @@ import asyncio import pytest -from asyncdb import AsyncDB import polars as pl import datatable as dt -from asyncdb.meta import Record, Recordset +from asyncdb import AsyncDB +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset DRIVER = "sqlite" PARAMS = {"database": ":memory:"} diff --git a/tests/test_asyncpg.py b/tests/test_asyncpg.py index 73917bae..40b6dc21 100644 --- a/tests/test_asyncpg.py +++ b/tests/test_asyncpg.py @@ -8,7 +8,8 @@ import pandas import polars as pl import datatable as dt -from asyncdb.meta import Record, Recordset +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset DRIVER = 'pg' DSN = "postgres://troc_pgdata:12345678@127.0.0.1:5432/navigator" diff --git a/tests/test_postgres.py b/tests/test_postgres.py index 66b5e378..518f2290 100644 --- a/tests/test_postgres.py +++ b/tests/test_postgres.py @@ -5,7 +5,8 @@ from io import BytesIO from pathlib import Path import pytest_asyncio -from asyncdb.meta import Record, Recordset +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset DRIVER = 'postgres' DSN = "postgres://troc_pgdata:12345678@127.0.0.1:5432/navigator" diff --git a/tests/test_rethink.py b/tests/test_rethink.py index 3fa5ceeb..0f240bad 100644 --- a/tests/test_rethink.py +++ b/tests/test_rethink.py @@ -4,7 +4,8 @@ import pytest_asyncio import pandas import datatable as dt -from asyncdb.meta import Record, Recordset +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset from asyncdb import AsyncDB DRIVER = 'rethink' diff --git a/tests/test_sqlalchemy.py b/tests/test_sqlalchemy.py index 19b51f98..e1cf012b 100644 --- a/tests/test_sqlalchemy.py +++ b/tests/test_sqlalchemy.py @@ -4,7 +4,8 @@ import pytest_asyncio import polars as pl import datatable as dt -from asyncdb.meta import Record, Recordset +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset DRIVER = "sql_alchemy" PARAMS = { @@ -35,7 +36,7 @@ async def test_connect(event_loop): result, error = conn.test_connection() pytest.assume(result.one == 1) assert db.is_closed() is True - + async def test_connect_by_dsn(event_loop): db = AsyncDB(DRIVER, dsn=DSN, loop=event_loop) pytest.assume(db.is_connected() is False) diff --git a/tests/test_sqlserver.py b/tests/test_sqlserver.py index 46bcf691..cc13d9fe 100644 --- a/tests/test_sqlserver.py +++ b/tests/test_sqlserver.py @@ -7,7 +7,8 @@ import pytest_asyncio import pandas import datatable as dt -from asyncdb.meta import Record, Recordset +from asyncdb.meta.record import Record +from asyncdb.meta.recordset import Recordset DRIVER = 'sqlserver' params = {