MySQL set and enum, calling values

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Dec 11 20:13:50 EST 2009


En Fri, 11 Dec 2009 16:28:23 -0300, Victor Subervi  
<victorsubervi at gmail.com> escribió:

> On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese  
> <carsten.haese at gmail.com>wrote:
>
>> Victor Subervi wrote:
>> > [...] if I go to print, say,
>> > colFieldValues[20], which is a set, it prints out the whole set:
>> >  
>> set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge')
>> > But if I print out colFieldValues[20][0], it prints out "s".
>>
>> > Also, how can I test
>> > for it? It's an instance of string. How do I know if it's a set?
>>
>> That's a fantastic question. Python thinks it's a string. What makes you
>> think it's a set?
>
> Right. I'm doing it the ugly way with the truncating tuple and string
> replace.

Are you sure the column is declared as SET and not, say, VARCHAR?
Anyway, I don't think MySQLdb is able to handle the SET data type  
correctly.

-- 
Gabriel Genellina




More information about the Python-list mailing list