Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #90 from alercebroker/refactor/minimalistic-lib
Browse files Browse the repository at this point in the history
refactor: deleted query wrapper
  • Loading branch information
pgallardor authored Jul 26, 2023
2 parents 924ccbd + e175ac8 commit 9908888
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 472 deletions.
2 changes: 1 addition & 1 deletion db_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.2.7"
__version__ = "5.0.0"
7 changes: 3 additions & 4 deletions db_plugins/db/sql/connection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.orm import sessionmaker, scoped_session, Query

from .query import SQLQuery
from ..generic import DatabaseConnection, DatabaseCreator
from .models import Base

Expand Down Expand Up @@ -85,7 +84,7 @@ def connect(
)
self.Base = base or Base
session_options = session_options or {}
session_options["query_cls"] = SQLQuery
session_options["query_cls"] = Query
if self.Session is None:
self.Session = sessionmaker(bind=self.engine, **session_options)
if create_session:
Expand All @@ -110,7 +109,7 @@ def create_session(self, use_scoped, scope_func=None):

def _create_scoped_session(self, scope_func):
self.session = scoped_session(self.Session, scopefunc=scope_func)
self.Base.query = self.session.query_property(query_cls=SQLQuery)
self.Base.query = self.session.query_property(query_cls=Query)
self.use_scoped = True

def _create_unscoped_session(self):
Expand Down
4 changes: 2 additions & 2 deletions db_plugins/db/sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
DateTime,
ForeignKeyConstraint,
)
from sqlalchemy.orm import relationship
from sqlalchemy.orm import declarative_base, relationship
from .. import generic

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import declarative_base

Base = declarative_base()

Expand Down
207 changes: 0 additions & 207 deletions db_plugins/db/sql/query.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"alembic==1.8.1",
"click==8.1.3",
"marshmallow_sqlalchemy==0.28.1",
"SQLAlchemy==1.3.24",
"SQLAlchemy==2.0.19",
"pymongo==4.3.3"
]

Expand Down
Loading

0 comments on commit 9908888

Please sign in to comment.