From 96625845605a653f49028438474d3789347878e7 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 14 Dec 2020 19:51:25 +0100 Subject: [PATCH] Improved session reference --- .../database/connection/base/database_connection_base.py | 4 ++-- src/sh_edraft/database/connection/database_connection.py | 6 +++--- .../database/context/base/database_context_base.py | 4 ++-- src/sh_edraft/database/context/database_context.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sh_edraft/database/connection/base/database_connection_base.py b/src/sh_edraft/database/connection/base/database_connection_base.py index 8a3e28ec..9bc31427 100644 --- a/src/sh_edraft/database/connection/base/database_connection_base.py +++ b/src/sh_edraft/database/connection/base/database_connection_base.py @@ -1,7 +1,7 @@ from abc import abstractmethod, ABC from sqlalchemy import engine -from sqlalchemy.orm import session +from sqlalchemy.orm import Session class DatabaseConnectionBase(ABC): @@ -15,7 +15,7 @@ class DatabaseConnectionBase(ABC): @property @abstractmethod - def session(self) -> session: pass + def session(self) -> Session: pass @abstractmethod def connect(self, connection_string: str): pass diff --git a/src/sh_edraft/database/connection/database_connection.py b/src/sh_edraft/database/connection/database_connection.py index eac20341..9c50ae79 100644 --- a/src/sh_edraft/database/connection/database_connection.py +++ b/src/sh_edraft/database/connection/database_connection.py @@ -1,7 +1,7 @@ from typing import Optional from sqlalchemy import engine, create_engine -from sqlalchemy.orm import session, sessionmaker +from sqlalchemy.orm import Session, sessionmaker from sh_edraft.database.connection.base.database_connection_base import DatabaseConnectionBase from sh_edraft.database.model.database_settings import DatabaseSettings @@ -16,7 +16,7 @@ class DatabaseConnection(DatabaseConnectionBase): self._db_settings = database_settings self._engine: Optional[engine] = None - self._session: Optional[session] = None + self._session: Optional[Session] = None self._credentials: Optional[str] = None @property @@ -24,7 +24,7 @@ class DatabaseConnection(DatabaseConnectionBase): return self._engine @property - def session(self) -> session: + def session(self) -> Session: return self._session def connect(self, connection_string: str): diff --git a/src/sh_edraft/database/context/base/database_context_base.py b/src/sh_edraft/database/context/base/database_context_base.py index a18b6efe..b8294e64 100644 --- a/src/sh_edraft/database/context/base/database_context_base.py +++ b/src/sh_edraft/database/context/base/database_context_base.py @@ -1,7 +1,7 @@ from abc import abstractmethod from sqlalchemy import engine -from sqlalchemy.orm import session +from sqlalchemy.orm import Session from sh_edraft.service.base.service_base import ServiceBase @@ -18,7 +18,7 @@ class DatabaseContextBase(ServiceBase): @property @abstractmethod - def session(self) -> session: pass + def session(self) -> Session: pass @abstractmethod def connect(self, connection_string: str): pass diff --git a/src/sh_edraft/database/context/database_context.py b/src/sh_edraft/database/context/database_context.py index a9fd1b7e..07ba3719 100644 --- a/src/sh_edraft/database/context/database_context.py +++ b/src/sh_edraft/database/context/database_context.py @@ -1,5 +1,5 @@ from sqlalchemy import engine, Table -from sqlalchemy.orm import session +from sqlalchemy.orm import Session from sh_edraft.database.connection.database_connection import DatabaseConnection from sh_edraft.database.connection.base.database_connection_base import DatabaseConnectionBase @@ -22,7 +22,7 @@ class DatabaseContext(DatabaseContextBase): return self._db.engine @property - def session(self) -> session: + def session(self) -> Session: return self._db.session def create(self):