[Tutor] MySQLdb table is DATE, but SELECT returns with TIMESTAMP.

Magnus Lyckå magnus@thinkware.se
Wed Jun 18 15:32:04 2003


I assume this was meant for the list.

At 09:00 2003-06-18 -0500, Decibels wrote:
>Yes, I have egenix-mx-base which I believe has what I need.
>http://www.egenix.com/files/python/eGenix-mx-Extensions.html#mxDateTime
>
>I have no problem deleting it. It is the issue with MySQL manual
>saying it does differentiate between date and datestamp.
>I tested it and it does.
>
>I was just thinking that since MySQL didn't store it as a datestamp,
>but a date, when I specified 'date', that I should have been able to
>retrieve it as such.

Sure, in the database end of the connection, this is how it works.
I the Python end, the mx.DateTime type called DateTime is used, and
its just one type. Dates are simply DateTimes where the time-part
is 00:00:00.0 in mx.DateTime.

When Python 2.3 is established, I guess that many database drivers
will support the new standard datetime module in Python, and then we
will have separate date and datetime classes.

>It would make it easier to search for it.

I don't understand this. Can you give an example?

>   Even if it isn't behaving in a
>manner that seems inconsistent with MySQL itself and just 'TAGGING'
>a default timestamp when it retrieves the date. Even though it wasn't
>stored that way. I still probably need to learn to use the mx.DateTime
>module.

Now I lost you...

>I am still playing with it. Seems that what I did earlier sort of worked, or
>I borked the code a little later. But when I was testing, I just had one row
>now I have two and it says no matches, so won't delete.  So have to
>see why it isn't matching, probably typo. But would have been less
>troublesome to start with if it retreived the date like I stored it.

I guess you did something wrong. If two rows match the WHERE clause
of a DELETE statement, both rows should be deleted.

>Dave
>
>On Wednesday 18 June 2003 03:01 am, you wrote:
> > You won't understand this by reading MySQL manuals, you
> > must understand what data types you use in *Python*.
[snip my old mail...]


--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language