[storm] This is a noob question: storing lists
chandramouli s
naruvimama at gmail.com
Thu May 7 08:59:52 BST 2009
Yes I have tried it with VARCHAR too but with the same error ..
I tried converting the list to string using: d.marks=str([x,2*x,x-1,x*6])
but the same error occurs ...
Thank you
Chandra
On Thu, May 7, 2009 at 7:47 AM, Hahusseau, Thomas
<thomas.hahusseau at eads.com> wrote:
> Check if the type TEXT for your "marks" field exists in sqlite creation
> process. Maybe you should replace it by a VARCHAR type.
>
> -----Message d'origine-----
> De : storm-bounces at lists.canonical.com
> [mailto:storm-bounces at lists.canonical.com] De la part de chandramouli s
> Envoyé : jeudi 7 mai 2009 08:10
> À : storm at lists.canonical.com
> Objet : [storm] This is a noob question: storing lists
>
> What I would like to do is store a set of data values, 400 or so in a
> sqlite database (instead of a flatfile as it is normally done). And I
> tried to run following the examples, but I wonder if the list storage
> is right. Any help is much appreciated
>
> The program:
> ############################################################
>
> from storm.locals import *
> class Personner(object):
> __storm_table__="personner"
> id= Int(primary=True)
> name=Unicode()
> marks=List()
>
> database=create_database("sqlite:///fort")
> store=Store(database)
> store.execute("CREATE TABLE IF NOT EXISTS personner (id INTEGER
> PRIMARY KEY, name VARCHAR,marks TEXT)")
> for x in xrange(200):
> d=Personner()
> d.name=unicode(str(x))
> d.marks=[x,2*x,x-1,x*6] # d.marks=unicode(str([x,2*x,x-1,x*6]))
> store.add(d)
> store.flush()
> print 'success'
>
> store.commit()
> print 'done'
>
> #####################################################################
> The error msg:
> Traceback (most recent call last):
> File "testStorm.py", line 16, in <module>
> store.flush()
> File "/usr/lib64/python2.6/site-packages/storm/store.py", line 486, in
> flush
> self._flush_one(obj_info)
> File "/usr/lib64/python2.6/site-packages/storm/store.py", line 523,
> in _flush_one
> result = self._connection.execute(expr)
> File "/usr/lib64/python2.6/site-packages/storm/database.py", line
> 203, in execute
> raw_cursor = self.raw_execute(statement, params)
> File "/usr/lib64/python2.6/site-packages/storm/databases/sqlite.py",
> line 153, in raw_execute
> return Connection.raw_execute(self, statement, params)
> File "/usr/lib64/python2.6/site-packages/storm/database.py", line
> 284, in raw_execute
> self._check_disconnect(raw_cursor.execute, *args)
> File "/usr/lib64/python2.6/site-packages/storm/database.py", line
> 325, in _check_disconnect
> return function(*args, **kwargs)
> pysqlite2.dbapi2.InterfaceError: Error binding parameter 0 - probably
> unsupported type.
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/storm
>
More information about the storm
mailing list