Roundtrip SQL data especially datetime

dyork reverseyorkage at david.com
Fri Dec 15 23:18:00 EST 2006


Thanks Gabriel, but when I said "round trip" I really did mean: convert all 
the way to string and all the way back again, so your kind advice is not all 
that helpful. I need string to get to a non-Python object or a Web page.

DY

"Gabriel Genellina" <gagsl-py at yahoo.com.ar> wrote in message 
news:1166187115.915310.66810 at l12g2000cwl.googlegroups.com...
> On 15 dic, 07:44, "dyork" <reverse york... at david.com> wrote:
>> When getting data from a database using the dbapi and an SQL query, how 
>> do
>> you in general round trip the data? Especially date-time?
>>
>> An SQL datetime column translates nicely into a Python datetime 
>> (surprise),
>> which then translates into a string like '2005-08-03 07:32:48'. No 
>> problem
>> with that -- all works quite nicely, until you try to put data back the
>> other way.
>
> Dont convert to string and keep the datetime object.
>
> -- 
> Gabriel Genellina
> 





More information about the Python-list mailing list