[Zope] Finding a match in a large dataset - btrees?

Cameron Beattie kjcsb at orcon.net.nz
Sun Dec 4 22:57:03 EST 2005


I have a large set of data (that will be stored in MySQL) that I wish to 
match to and am wondering what the best method is.

Assume the following data in table LOCATION_MATCH:
LOCATION_ID    LOCATION_PATTERN    PARENT_ID
10                            6
11                            4                                        10
13                            2                                        11
12                            9                                        11
14                            1                                        13
15                            2                                        13

The string 6438 should return 11, 6421 14, 6422 15 and 6499 12.

I've read a bit about btrees on the zope wiki and wonder if that's the best 
way. However I am struggling with the basics:
1. How do I get the data from MySQL into a btree in Zope? Something like:
from BTrees.IIBTree import *
t = IIBTree()
t.update(context.select_from_LOCATION_MATCH) # errr, no

2. How do I find the matching node i.e. when I want to know that 6422 
relates to location_id 15?

Any help or pointers to further documentation would be appreciated.

Regards

Cameron 



More information about the Zope mailing list