[storm] can't select strings outside of storm

Gustavo Niemeyer gustavo at niemeyer.net
Sun Nov 2 21:43:52 GMT 2008


Hello Jean,

> I have created an object instance persisted with storm in a sqlite
> database. The object have a raw string attribute. Outside of
> python/storm, in the sqlite3 console, I cannot select the rows on a
> specific value. The database was created outside of storm.
>
> I created an instance of the "toto" object with a "titi" string
> attribute persisted in the "toto" table. I created the instance with
> "titi" set to "mystring". In a sqlite3 console, the SQL command
> 'select * from toto where titi=="mystring"' returns nothing. The same
> command with the "like" operator finds the row. If the attribute is an
> integer instead of a string, it works fine.
>
> It is reproduceable with the default python on ubuntu 8.04 and the
> latest storm from easy_install.
>
> Did I miss something? should I file a bug?

I can reproduce the problem locally.  It'd be nice to file a bug for
us to track the issue.  So far this looks more like an issue in the
way that either SQLite or pysqlite handles the type magic on the
primary key case than an issue in Storm by itself.  Try to do
something like this:

sqlite> select * from test where ('' || test) = 'mystring';
mystring

In other words, if you concatenate the column with an empty string,
the comparison works.  That certainly indicates that there's something
unusual in the SQLite side.  Also, note that if you use a Unicode
rather than a RawStr, it seems to work fine.  So it also points into
the direction of type affinity not being set correctly.


-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the storm mailing list