Skip to content

Commit

Permalink
If there are no ids to fill, don't run a query.
Browse files Browse the repository at this point in the history
This is important, because running the query without ids can
result in a retrieval of the full table.
  • Loading branch information
BurntSushi committed Aug 14, 2014
1 parent 4c6eac1 commit 802db82
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nfldb/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def pkval(entobj):

import nfldb.query
ids = list(set(pkval(obj) for obj in to_fill))
if len(ids) == 0:
return
objs = nfldb.query._entities_by_ids(db, fill_with, *ids)
byid = dict([(pkval(obj), obj) for obj in objs])
for obj in to_fill:
Expand Down

0 comments on commit 802db82

Please sign in to comment.