avoid loading items into python
This commit is contained in:
parent
afb025c154
commit
2fb5588d3d
1 changed files with 2 additions and 2 deletions
|
@ -41,9 +41,9 @@ def find(data):
|
||||||
key = 'group:' + hashlib.sha1(json.dumps(data).encode('utf-8')).hexdigest()
|
key = 'group:' + hashlib.sha1(json.dumps(data).encode('utf-8')).hexdigest()
|
||||||
g = state.cache.get(key)
|
g = state.cache.get(key)
|
||||||
if g is None:
|
if g is None:
|
||||||
items = [i.id for i in q['qs'].options(load_only('id'))]
|
items = q['qs'].options(load_only('id'))
|
||||||
qs = models.Find.query.filter_by(key=q['group'])
|
qs = models.Find.query.filter_by(key=q['group'])
|
||||||
if items:
|
if items.count():
|
||||||
qs = qs.filter(models.Find.item_id.in_(items))
|
qs = qs.filter(models.Find.item_id.in_(items))
|
||||||
for f in qs.values('value', 'findvalue'):
|
for f in qs.values('value', 'findvalue'):
|
||||||
value = f[0]
|
value = f[0]
|
||||||
|
|
Loading…
Reference in a new issue