[storm] Invalid enum value on find
Jamu Kakar
jkakar at kakar.ca
Wed Apr 3 21:09:28 UTC 2013
Hi Oscar,
On Wed, Apr 3, 2013 at 7:38 AM, Oscar Campos
<oscar.campos at open-phoenix.com> wrote:
> I have an enumeration defined in the usual way:
> class Card(Storm):
> __storm_table__ = 'b2c_credit_cards'
> ...
> card_type = Enum(map={
> 'VISA': 1, 'MC': 2, 'LASER': 3, 'AMEX': 4,
> 'DINERS': 5, 'DELTA': 6, 'MAESTRO': 7
> })
> ...
>
> If I create a new Card object I can flush the store and commit without
> any problem, of course I am able to use card.card_type = 'VISA' but when
> I try to load it from the database I always get a ValueError exception
> like "Invalid enum value u:'VISA' (or whatever other card type I did
> store first)"
>
> I'm using MySQL 5.1.66, Storm 0.19 and Python 2.7.3
>
> Someone have any idea about how to solve this?
Your Enum definition looks correct. What datatype are you using on
the MySQL type? Is it possible there's some issue there with the
loaded value not matching the values in your map?
Thanks,
J.
More information about the storm
mailing list