RawStr instead of Unicode for VARCHAR (mysql)

Bug #228669 reported by Marco Ferreira
2
Affects Status Importance Assigned to Milestone
Storm
Invalid
Undecided
Unassigned

Bug Description

Settings some fields on my table to VARCHAR and having its python class fields as Unicode, outputed the following:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.5/site-packages/storm/store.py", line 1034, in one
    return self._load_objects(result, values)
  File "/usr/local/lib/python2.5/site-packages/storm/store.py", line 910, in _load_objects
    return self._store._load_objects(self._cls_spec_info, result, values)
  File "/usr/local/lib/python2.5/site-packages/storm/store.py", line 608, in _load_objects
    return self._load_object(cls_spec_info, result, values)
  File "/usr/local/lib/python2.5/site-packages/storm/store.py", line 666, in _load_object
    self._set_values(obj_info, cls_info.columns, result, values)
  File "/usr/local/lib/python2.5/site-packages/storm/store.py", line 721, in _set_values
    result.set_variable(variable, value)
  File "/usr/local/lib/python2.5/site-packages/storm/database.py", line 132, in set_variable
    variable.set(value, from_db=True)
  File "/usr/local/lib/python2.5/site-packages/storm/variables.py", line 192, in set
    new_value = self.parse_set(value, from_db)
  File "/usr/local/lib/python2.5/site-packages/storm/variables.py", line 372, in parse_set
    % (type(value), value))
TypeError: Expected unicode, found <type 'str'>: 'cmts01'

I've changed the properties into RawStr and all works well now, but wasn't it supposed to be of Unicode() type?

Cheers

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Yes, it is. Do you have an old version of MySQLdb installed? MySQLdb itself should
return unicode to Storm, and from the error above it looks like it's returning a plain
string.

Revision history for this message
Marco Ferreira (mferreira) wrote :

I'm currently using MySQL 4.1.20.
So, this won't be an issue when using version 5.x ?

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

MySQLdb is the Python module for MySQL. It's probably the issue in this case,
as opposed to MySQL itself.

The automated tests do ensure that this is working correctly in MySQL, but my
version of MySQL is 5.0.X, so I can't tell for sure how it will perform in 4.1. Running
the test suite (setting the STORM_MYSQL_URI to an existent database is necessary)
is the best way to check if it works nicely or not.

Benji York (benji)
Changed in storm:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.