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