[pybsddb] BDB joined cursor issue
Sury Soni
ssoni at nextdigital.com
Fri Sep 11 08:14:42 CEST 2009
Dear All,
I am trying to use BDB secondary DB indices stuff for my project, where
I want to use BDB as column table.
If you run test.py from the attached source code, you will be able to
get different random search results with random input data.
My situation is, when we do one cursor iteration use Dbc.set_range() and
Dbc.next(), we are able to iterate through first matched item till the
end of the cursor.
But, when I join such different index(secondary db) cursors using
Db.join(cursorList), the cursor I get is very restricted.
Following is the detailed example.
Columns of my data:
Name: string - Random strings
Age: int - Random Range (10 to 20)
Marks: int - Random Range (50-60)
Hobby: string - Random Choice (charity, chess, cricket, dancing,
singing, somersaulting, tasting wine)
If I query for Age using .set_range(14), I get all items which have
Age>=14 (That's what we expect. This is OK)
If I query for Age using .set_range(14) and Marks using .set_range(55),
I get items matching exactly Age=14 and Marks=55. (Here is my doubt #1)
If I query for Age using .set_range(14) and Marks using .set_range(55)
and hobby using .set_range("c"),
I get records matching exactly Age=14, Marks=55 and hobby="charity"
(charity is lexicographically first match for "c") - (This is my doubt
#2)
So, I believe my doubt #1 and #2 are related and narrows down to as
follows:
When we use joined cursor, natural join behaves like first match key
among each cursor and unique primary keys available for each cursors
first match secondary duplicate keys. So, whats expected behaviour for
joined cursors?
In my doubt #1 scenario, I would expect, I should get all matches for
Age>=14 and Marks>=55.
In my doubt # 2 scenario, I would expect, I should get all matches for
hobby starting with "c" and Age>=14 and Marks>=55.
Please correct my understading.
____________________________________
Sury Prakash Soni
____________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20090911/1ebdb54b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bdbtable.zip
Type: application/x-zip-compressed
Size: 14356 bytes
Desc: bdbtable.zip
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20090911/1ebdb54b/attachment.bin>
More information about the pybsddb
mailing list