Skip to content

Commit

Permalink
v1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ddc committed Nov 28, 2024
1 parent c2907e7 commit 95969e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ddcDatabases/mssql.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ddcDatabases/postgresql.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/dal/sqlite_dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 95969e1

Please sign in to comment.