Refactored batch fetch
This commit is contained in:
@@ -225,9 +225,13 @@ class Fetcher(object):
|
||||
for entity in self.path.entities
|
||||
]
|
||||
|
||||
@property
|
||||
def relation_query_base(self):
|
||||
return self.path.session.query(self.path.model)
|
||||
|
||||
@property
|
||||
def related_entities(self):
|
||||
return self.path.session.query(self.path.model).filter(self.condition)
|
||||
return self.relation_query_base.filter(self.condition)
|
||||
|
||||
@property
|
||||
def local_column_names(self):
|
||||
@@ -341,7 +345,7 @@ class ManyToManyFetcher(Fetcher):
|
||||
return names
|
||||
|
||||
@property
|
||||
def related_entities(self):
|
||||
def relation_query_base(self):
|
||||
return (
|
||||
self.path.session
|
||||
.query(
|
||||
@@ -354,9 +358,6 @@ class ManyToManyFetcher(Fetcher):
|
||||
.join(
|
||||
self.prop.secondary, self.prop.secondaryjoin
|
||||
)
|
||||
.filter(
|
||||
self.condition
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(self):
|
||||
|
Reference in New Issue
Block a user