kniterbasdb and datetime

Laszlo Nagy gandalf at shopzeus.com
Thu Dec 13 07:50:17 EST 2007


DarkBlue írta:
> On Dec 13, 7:45 pm, Laszlo Nagy <gand... at shopzeus.com> wrote:
>   
>>   Hi All,
>>
>> I connected to a FireBird 1.5 database this way:
>>
>> import kinterbasdb
>> kinterbasdb.init(type_conv=200) # Seehttp://kinterbasdb.sourceforge.net/dist_docs/usage.html#faq_fep_is_mx...
>>
>> Then I try to update the database:
>>
>> sql = "UPDATE TABLE1 SET DATEFIELD=? where ID = ?"
>> params=[datetime.date(2007,11,01),2341]
>> cursor.execute(sql,params)
>>
>> I get this error:
>>
>> kinterbasdb.ProgrammingError: (-413, 'isc_dsql_execute: \n  conversion
>> error from string "2007-11-01"')
>>
>> What is wrong here?
>>
>> Thanks,
>>
>>     Laszlo
>>     
>
>
> Kinterbasdb probably expects the format looking like
>
> month/day/year
>
> rather than
>
> year-month-day
>   
It is not that. The parameter passed to cursor.execute() is a 
datetime.datetime instance. It is not a string, so if there is a 
formatting problem then it must be inside kinterbasdb. (How would you 
control the format if you have no string representation?)

However, I'm 100% sure that others are also using this module and 
probably there is something that I should change, just don't know what 
it is.

Thanks,

   Laszlo






More information about the Python-list mailing list