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

Dennis Allison allison at shasta.stanford.edu
Mon Dec 5 11:48:11 EST 2005


I cannot make any sense out of your example data.  Since you already have 
the data in a MySQL table, I would think the best way to find the match 
would be to make a MySQL query.  

On Mon, 5 Dec 2005, Cameron Beattie wrote:

> 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 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 

-- 



More information about the Zope mailing list