Avoid n+1.
This commit is contained in:
parent
4342d73811
commit
1d0468b9be
1 changed files with 1 additions and 1 deletions
|
@ -220,7 +220,7 @@ def get_inventory_csv():
|
||||||
if not ids:
|
if not ids:
|
||||||
return jsonify({"success": False, "error": "No IDs provided"}), 400
|
return jsonify({"success": False, "error": "No IDs provided"}), 400
|
||||||
|
|
||||||
rows = db.session.query(Inventory).filter(Inventory.id.in_(ids)).all()
|
rows = eager_load_inventory_relationships(db.session.query(Inventory).filter(Inventory.id.in_(ids))).all()
|
||||||
|
|
||||||
output = io.StringIO()
|
output = io.StringIO()
|
||||||
writer = csv.writer(output)
|
writer = csv.writer(output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue