It seems that pygrametl's cache caches negative lookups. Not sure if it's supposed to be that way
Opened this issue · 5 comments
GoogleCodeExporter commented
tables.py, line 471 (using r47)
if resultkey is not None:
If defaultidvalue is used, resultkey is never None, but rather defaultidvalue
for failed lookup.
When used with CachedDimension, this leads to caching results of failed lookups.
That's not what I expect - but may be it supposed to be that way.
I added
if self.defaultvalue is not None and resultkey != self.defaultidvalue:
after the above line in my copy (and reindented. Ain't python a great language
to work with!), and it works for me.
May be you should add it to upstream, if it makes sense to you guys.
Original issue reported on code.google.com by d...@parallels.com
on 6 Apr 2015 at 4:12
GoogleCodeExporter commented
Not supposed to be "defect", but I couldn't find the "Type" anywhere in "submit
new issue. Sorry about that
Original comment by d...@parallels.com
on 6 Apr 2015 at 4:14
GoogleCodeExporter commented
not self.defaultvalue, but self.defaultidvalue of course.
if self.defaultidvalue is not None and resultkey != self.defaultidvalue:
Original comment by d...@parallels.com
on 6 Apr 2015 at 4:27
GoogleCodeExporter commented
Thanks for the suggestion.
But why not cache "negative lookups"? By caching that a lookup failed, we can
avoid to do the same lookup later and thus save a round-trip to the database.
Original comment by c...@cs.aau.dk
on 7 Apr 2015 at 9:00
GoogleCodeExporter commented
Well, at least be consistent then.
Because when there's no defaultidvalue - it does not cache negative lookups.
Also I remeber that BulkDimensions' ensure breaks in this case. More details
later (I'm refactoring that script and cannot test right now)
Original comment by d...@parallels.com
on 7 Apr 2015 at 5:51
GoogleCodeExporter commented
Yes, that is a good idea.
I update the type to "Enhancement"
Original comment by c...@cs.aau.dk
on 15 Apr 2015 at 7:16
- Changed state: Accepted
- Added labels: Type-Enhancement
- Removed labels: Type-Defect