Hi,
I've got a table with a PickleCol in which I'm storing lists of strings,
and I want to find the ID of the row whose list of strings matches a value
I provide. I can't get this to work, and I'm wondering if someone has
advice; or maybe it's a bug? Here's an example to illustrate
# initialize SQLObject
>>> import sqlobject
>>> sqlobject.sqlhub.processConnection =
>>> sqlobject.connectionForURI("sqlite:/:memory:")
# create a table
>>> class Example(sqlobject.SQLObject):
... strings = sqlobject.PickleCol()
...
>>> Example.createTable()
# create a row
>>> Example(strings = ["string 1"])
<Example 1 strings=['string 1']>
# try retrieving the row and checking that PickleCol() works
>>> strings = Example.get(1).strings
>>> print strings, type(strings)
['string 1'] <type 'list'>
# try a SELECT
>>> result = Example.select(Example.q.strings == ["string 1"])
>>> print result
SELECT example.id, example.strings FROM example WHERE (example.strings =
('string 1'))
>>> print list(result)
[]
Any ideas? From the string representation of the select object it appears
to be looking for a tuple, ('string 1'), but if I try storing a tuple
instead of a list it still doesn't work.
Please help, thanks!
-Kipp
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss