From 95969e194b173eddafad873b0b99baf1bec8c5cb Mon Sep 17 00:00:00 2001 From: ddc Date: Thu, 28 Nov 2024 11:03:11 -0300 Subject: [PATCH] v1.0.8 --- ddcDatabases/mssql.py | 6 +++--- ddcDatabases/postgresql.py | 6 +++--- tests/dal/sqlite_dal.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ddcDatabases/mssql.py b/ddcDatabases/mssql.py index 37662c6..6ca515d 100755 --- a/ddcDatabases/mssql.py +++ b/ddcDatabases/mssql.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from contextlib import asynccontextmanager, contextmanager -from typing import Optional +from typing import AsyncGenerator, Generator, Optional from sqlalchemy.engine import create_engine, Engine, URL from sqlalchemy.ext.asyncio import ( AsyncEngine, @@ -99,7 +99,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb): await self.temp_engine.dispose() @contextmanager - def engine(self) -> Engine: + def engine(self) -> Generator: _connection_url = URL.create( **self.connection_url, drivername=self.sync_driver @@ -112,7 +112,7 @@ def engine(self) -> Engine: yield engine @asynccontextmanager - async def async_engine(self) -> AsyncEngine: + async def async_engine(self) -> AsyncGenerator: _connection_url = URL.create( **self.connection_url, drivername=self.async_driver diff --git a/ddcDatabases/postgresql.py b/ddcDatabases/postgresql.py index 4d3dbb8..d02004d 100755 --- a/ddcDatabases/postgresql.py +++ b/ddcDatabases/postgresql.py @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- from contextlib import asynccontextmanager, contextmanager -from typing import Optional +from typing import AsyncGenerator, Generator, Optional from sqlalchemy.engine import create_engine, Engine, URL from sqlalchemy.ext.asyncio import ( AsyncEngine, @@ -85,7 +85,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb): await self.temp_engine.dispose() @contextmanager - def engine(self) -> Engine: + def engine(self) -> Generator: _connection_url = URL.create( **self.connection_url, drivername=self.sync_driver @@ -97,7 +97,7 @@ def engine(self) -> Engine: yield engine @asynccontextmanager - async def async_engine(self) -> AsyncEngine: + async def async_engine(self) -> AsyncGenerator: _connection_url = URL.create( **self.connection_url, drivername=self.async_driver diff --git a/tests/dal/sqlite_dal.py b/tests/dal/sqlite_dal.py index c30ff4c..958c0b6 100644 --- a/tests/dal/sqlite_dal.py +++ b/tests/dal/sqlite_dal.py @@ -23,5 +23,5 @@ def get(self, test_id: int): stmt = sa.select(*self.columns).where(ModelTest.id == test_id) results = self.db_utils.fetchall(stmt) return results - except DBFetchAllException as e: + except DBFetchAllException: return None