Skip to content

Commit

Permalink
feat: v1.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
ddc committed Dec 7, 2024
1 parent dfb2905 commit 92af9b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions ddcDatabases/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from contextlib import asynccontextmanager, contextmanager
from datetime import datetime
from typing import AsyncGenerator, Generator, Optional

import sqlalchemy as sa
from sqlalchemy import RowMapping
from sqlalchemy.engine import create_engine, Engine, URL
Expand All @@ -13,7 +12,6 @@
create_async_engine,
)
from sqlalchemy.orm import Session, sessionmaker

from .exceptions import (
DBDeleteAllDataException,
DBExecuteException,
Expand Down Expand Up @@ -82,7 +80,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):

@contextmanager
def engine(self) -> Generator:
_connection_url = URL.create(**self.connection_url, drivername=self.sync_driver)
_connection_url = URL.create(drivername=self.sync_driver, **self.connection_url)
_engine_args = {
"url": _connection_url,
**self.engine_args,
Expand All @@ -93,7 +91,7 @@ def engine(self) -> Generator:

@asynccontextmanager
async def async_engine(self) -> AsyncGenerator:
_connection_url = URL.create(**self.connection_url, drivername=self.async_driver)
_connection_url = URL.create(drivername=self.async_driver, **self.connection_url)
_engine_args = {
"url": _connection_url,
**self.engine_args,
Expand Down
2 changes: 1 addition & 1 deletion ddcDatabases/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
self.odbcdriver_version = int(_settings.odbcdriver_version)
self.connection_url = {
"host": host or _settings.host,
"port": port or int(_settings.port),
"port": int(port or _settings.port),
"database": database or _settings.database,
"username": user or _settings.user,
"password": password or _settings.password,
Expand Down
2 changes: 1 addition & 1 deletion ddcDatabases/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
self.sync_driver = _settings.sync_driver
self.connection_url = {
"host": host or _settings.host,
"port": port or int(_settings.port),
"port": int(port or _settings.port),
"database": database or _settings.database,
"username": user or _settings.user,
"password": password or _settings.password,
Expand Down

0 comments on commit 92af9b8

Please sign in to comment.