Re: [ZODB-Dev] grab zodb dict keys by search term

2013-12-11 Thread Vincent Pelletier
On Wed, 11 Dec 2013 12:27:19 +0200,
Tamer Higazi tamerito...@arcor.de wrote :
 If i would have 100.000 - 500.000 entries, where 150 would match, I 
 don't want to go over those completely.
 
 So, if there is a pythonic way to get it solved on a performant way, or 
 a ZODB way as well that would be wondefull.

BTrees have a very nice API, which allow scanning only a subset of keys
by providing min and max boundaries:
  for key, value in some_btree.items(
  min='aa', max='b', excludemax=True):
  # Do stuff
should do what you want.

http://pythonhosted.org/BTrees/
-- 
Vincent Pelletier
ERP5 - open source ERP/CRM for flexible enterprises
___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] grab zodb dict keys by search term

2013-12-11 Thread Jens W. Klein

you might be interested in
https://pypi.python.org/pypi/souper/
which addresses this kind of problem

hth Jens

On 2013-12-10 23:46, Tamer Higazi wrote:

Hi people!

I am working a lot with IOB and OOB Trees as well with PersistentDict
and PersistentList to store my Data in ZODB.
I want to ask if there is a way to grab data from a dataset by search time.

I know only the SQL way:

select lower(COL1) from table1 where COL1 LIKE 'aa%'

so usually I want to get the entryies only that starts with 'aa'

do I have to iterate the entire dict with an interator or are there
builtin functions that could accomplish those tasks for me ?!


I would kindly thank you



Tamer
___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev




--
Klein  Partner KG, member of BlueDynamics Alliance

___
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev