[storm] Storm, sqlite, and lists

Jamu Kakar jamshed.kakar at canonical.com
Fri Jul 27 00:28:20 BST 2007


Hi Edward,

Edward Page wrote:
> I have been unable to find any storm examples using lists
>
> =======================
> CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT, fields BLOB)
> INSERT INTO test (fields, name) VALUES (?, ?)
> ([], u'Blank')
> Traceback (most recent call last):
>  File "./bug_example.py", line 20, in <module>
>    store.commit()
>  File "/media/data/Personal/Development/FamilyHistory/src/storm/store.py",
> line 66, in commit
>    self.flush()
>  File "/media/data/Personal/Development/FamilyHistory/src/storm/store.py",
> line 274, in flush
>    self._flush_one(obj_info)
>  File "/media/data/Personal/Development/FamilyHistory/src/storm/store.py",
> line 313, in _flush_one
>    result = self._connection.execute(expr)
>  File
> "/media/data/Personal/Development/FamilyHistory/src/storm/database.py",
> line 139, in execute
>    raw_cursor = self._raw_execute(statement, params)
>  File
> "/media/data/Personal/Development/FamilyHistory/src/storm/database.py",
> line 128, in _raw_execute
>    raw_cursor.execute(statement, params)
> pysqlite2.dbapi2.InterfaceError: Error binding parameter 0 - probably
> unsupported type.
> =======================
>
> Is this a bug on my part or on Storm's?

List is currently only supported property with PostgreSQL.  Are you
sure you even want to use List?  Most of the time you want to use a
ReferenceSet to reference other Storm-backed objects.  If you really
do need to store a list you might consider the Pickle property as an
alternative to List.

> ps Any good feel for when to use AutoReload?

Generally speaking, you shouldn't really need to use AutoReload.
Storm flushes changes to the database when necessary and mostly works
without any manual store.flush() calls being necessary.  One of the
purposes of AutoReload is for cases where you need an ID to be flushed
to the database right away so that a trigger or stored procedure gets
run.

Hope this helps,
J.




More information about the storm mailing list