You are good!
The problem was the errant comma!
Thanks
On Wednesday, April 8, 2015 at 7:41:01 PM UTC-6, Michael Bayer wrote:
>
>
>
> On 4/8/15 9:38 PM, arash afshar wrote:
>
> I am calling commit, right after updated those two values.
> Any suggestion on what else to check?
>
>
> what is the exact column type given to this column, are there any
> event.listen() things going on, and also what does a repr() of the object's
> __dict__ look like?
>
> in particular, Python has a really sneaky issue where if you happen to
> have an errant comma:
>
> x = "foo" ,
>
>
> you get:
>
> ("foo", )
>
>
>
>
>
> On Wednesday, April 8, 2015 at 7:33:49 PM UTC-6, Michael Bayer wrote:
>>
>>
>>
>> On 4/8/15 9:16 PM, arash afshar wrote:
>>
>> When I try to update a row using ORM in the following way, it shows the
>> following error:
>> InterfaceError: (InterfaceError) Error binding parameter 0 - probably
>> unsupported type. u'UPDATE table_name SET unicode_col=?, int_col=? WHERE
>> table_name.id = ?' ((u'abcd',), 1, 2)
>>
>>
>> I suspect the problem is that the value corresponding to unicode_col is
>> (u'abcd',) as opposed to a simple u'abcd'.
>>
>> that is the problem.
>>
>>
>> Here is how I update the database:
>> 1) I first query it and obtain an object representing the row that I need
>> --> file_row
>> 2) I perform some checks and change the values --> file_row.int_col = 1
>> followed by file_row.unicode_col = u"abcd"
>> 3) I call commit on the session
>>
>>
>> looks fine, so, I'd imagine that somehow that unicode_col = u'abcd' is
>> not what it seems. Either that's not what's there or something is
>> interfering with it after the fact.
>>
>>
>>
>>
>> I am pretty sure the problem is not the original type of value of the
>> unicode_col since the following succeeds without error:
>>
>> query(TableName).filter(TableName.id == file_row.id).update({'unicode_col':
>> u"abcd", 'int_col': 1})
>>
>>
>> Any idea how to fix the error?
>> Thanks
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.