Roundtrip SQL data especially datetime

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Dec 15 07:51:56 EST 2006


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