[web2py] contains return no rows of field list:string
I have the below table definition db.define_table('entries', Field('tags', 'list:string',required=True)) and then inserted values. Now I am trying to select using the below entries = db(db.entries.tags.contains('learning')).select() It returns no values (though there are rows in db). db: sqlite; web2py: 1.99.4 Thank you, Joseph
Re: [web2py] contains return no rows of field list:string
Have you redefined tje field type to list:string or originally created as list:string? Can you open your SQLITE using SQLITEMANAGER or other client and see if values are |learning|other|another| if you retrieve the Row the column returns a list type? I tested here and for me its working, looks like you have problems in your db. On Sat, Jan 14, 2012 at 8:07 AM, Joseph Jude ceph...@gmail.com wrote: I have the below table definition db.define_table('entries', Field('tags', 'list:string',required=True)) and then inserted values. Now I am trying to select using the below entries = db(db.entries.tags.contains('learning')).select() It returns no values (though there are rows in db). db: sqlite; web2py: 1.99.4 Thank you, Joseph -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] contains return no rows of field list:string
Thanks Bruno. I deleted the db and recreated (its only in db). The error still persists. print type(entry.tags) returns list and the field values are |learning|other|other| I can see that in the field too. Would you mind sharing your rest code? I think I'm missing something 'small' Regards, Joseph
Re: [web2py] contains return no rows of field list:string
I went into shell in a new web2py directory and tried the below. Surprisingly, I get empty output. Any explanations? python web2py.py -S init -M db.define_table('entries', Field('title', type='string'), Field('tags', 'list:string')) db.entries.insert(title='hello',tags='one,two,three') 1 t=db(db.entries.tags.contains('one')).select() t.as_list() []