in most cases the DBAPI driver, not SA, is the one returning the  
Python datetime objects to you.  also like Rick said most DBs are not  
going to store an invalid date.  so if you arent storing an actual  
date, you probably dont want to declare those columns as "Date" columns.

On Mar 4, 2007, at 7:00 PM, Mel Collins wrote:

>
>  Hey all,
>  I have an application which needs to support 'incomplete' dates -
> those where the month or day are unknown (or even the year, why not?).
>  MySQL supports doing this in it's Date column type (I don't know
> about other DBs), so for example I can have a date field containing:
> "1998-10-00".
>  Unfortunately, python/SA always attempts to read date columns into
> the datetime.date type, which doesn't support incomplete dates, and
> you end up with None.
>  I've tried overriding the column definition (I use reflection) in the
> SA table declaration, to make it a String, but it is still read from
> the database into a datetime.date object (which SA then tries to
> decode() unsuccessfully). I guess this means that it's outside of SA
> that the column is made a datetime.date?
>
>  As I haven't yet found any other way around this, my only recourse
> seems to be to split the date columns into three, which just feels
> wrong to me. Can anyone suggest a more elegant solution?
>
>  Takk,
>  - Mel C
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to