[pybsddb] Scanning Secondary Databases with Unknown Values

Denis Papathanasiou denis.papathanasiou at gmail.com
Tue Mar 2 16:06:43 CET 2010


>> The function works if the val argument passed is "0", b/c then the
>> cur.pget(val, db.DB_SET_RANGE) simply starts at the first item, then
>> iterates forward.
>>
>> Similarly, if val happens to match an actual date value of one of the
>> items (e.g., in my data, there is an item whose date value is
>> "1253174409"), then the function works as expected.
>>
>> But the majority of the calls to this function are using values which
>> do not match any of the items, and in that case, the call to pget()
>> returns None, and the function fails (i.e., returns no keys when in
>> fact there were items whose date was later than val).
>>
>> Is there any way around this problem?
> 
> I need COMPLETE code that I can check and reproduce the issue here.

This one, I'm embarrassed to say, was a miscommunication between me and 
the person invoking the function through an api.

I was storing utc time down to seconds (i.e., 10 digits of information), 
and he was calling the function with milliseconds (i.e., 13 digits of 
information).

So the secondary index worked as it should have; it was simply the scale 
of the inputs that was to blame.



More information about the pybsddb mailing list