Roundtrip SQL data especially datetime

2006-12-15 Thread dyork
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

Re: Roundtrip SQL data especially datetime

2006-12-15 Thread dyork
gt; wrote in message news:[EMAIL PROTECTED] > On 15 dic, 07:44, "dyork" 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 t

Re: Roundtrip SQL data especially datetime

2006-12-15 Thread dyork
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I suppose it all depends on your definition of obvious :-) I was looking for a constructor that was the complement of str(). Most/many languages would provide that. Sometimes it's called parse(). > The constructor is da

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"fumanchu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Here's the web adaptation layer I use: > http://projects.amor.org/misc/browser/alamode.py > Have a look at the coerce_in and coerce_out functions. Thanks! Plenty of useful ideas there. My web framework already does all the

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Python is a typed language, too, and "this thing" works just fine, > provided that you are using a reasonable DB-API implementation, and > provided that you're actually binding objects as parameters instead of > just st

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This may come as a shock to you, but MySQL is not the only database > engine on the planet. Your recommendation may apply to MySQL, but it is > not true for all databases in general. I can name at least two examples > (I

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you actually look at what the various DB-API adapters produce > when sending to the database engine, floats, bools, etc. are all sent as > string representations; about the only source for problems would be > in

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >Actually, MySQLdb isn't released for Python 2.5 yet, so for > anything with a database, you need an older version of Python. It's not really a problem so far. >If you really want to change the conversions for TIMES

Re: Roundtrip SQL data especially datetime

2006-12-17 Thread dyork
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if you think that Python isn't typed, you've completely missed how things > work. your problem is that you're removing every trace of the type > information by casting everything to strings, not that Python itself (n