It seems there is a limit to the condition sytax when using readWhere
 
I get various exceptions when passing increasing number of terms 
 
is this some kind of hard coded limit? 
 
is there a way to pre-compile this and test for it? (e.g. when I am actually 
creating the condition) 
- my alternative is simple to drop that part of the condition and filter out 
after
 
thanks,
 
Jeff
 
ans      -> [n->2                   ,len_selector->58                  ] --> 
(399,)
ans      -> [n->10                  ,len_selector->234                 ] --> 
(999,)
ans      -> [n->100                 ,len_selector->2304                ] --> 
(999,)
ans      -> [n->200                 ,len_selector->4704                ] --> 
(999,)
ans      -> [n->254                 ,len_selector->6000                ] --> 
chr() arg not in range(256)
ans      -> [n->255                 ,len_selector->6024                ] --> 
chr() arg not in range(256)
ans      -> [n->300                 ,len_selector->7104                ] --> 
chr() arg not in range(256)
ans      -> [n->400                 ,len_selector->9504                ] --> 
maximum recursion depth exceeded while calling a Python object
ans      -> [n->500                 ,len_selector->11904               ] --> 
maximum recursion depth exceeded while calling a Python object

------------ script to reproduce --------
#!/usr/local/bin/python
import tables
import numpy as np
import datetime, time
test_file = 'test_select.h5'
handle = tables.openFile(test_file, "w")
node   = handle.createGroup(handle.root, 'test')
table  = handle.createTable(node, 'table', dict(
        index   = tables.Int64Col(),
        column  = tables.StringCol(25),
        values  = tables.FloatCol(shape=(3)),
        ))
    
# add data
r = table.row
for i in xrange(1000):
    r['index'] = i
    r['column'] = ("str-%d" % (i % 5))
    r['values'] = np.arange(3)
    r.append()
table.flush()
handle.close()
 
def read_for(n):
    handle = tables.openFile(test_file,"r")
    selector = "(index >= 1) & %s" % '(' + ' | '.join([ "(column == 'str-%s')" 
% v for v in range(n) ]) + ')'
    #print "selector -> [%s] --> %s" % (n,selector)
    try:
        ans = handle.root.test.table.readWhere(selector)
        print "ans      -> [n->%-20.20s,len_selector->%-20.20s] --> %s" % 
(n,len(selector),ans.shape)
    except (Exception), detail:
        print "ans      -> [n->%-20.20s,len_selector->%-20.20s] --> %s" % 
(n,len(selector),str(detail))
    handle.close()
 
for n in [ 2, 10, 100, 200, 254, 255, 300, 400, 500 ]:
    read_for(n)
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to