Hi,

I have a date column which is optional, therefore I created it like this:

end_date = Column(Date(),nullable=True)

Apparently, if I do not specify the date, the database (mysql) stores 
"0000-00-00". This is a problem later, when I do queries using clauses like 
the following:

or_(Job.end_date.is_(None),Job.end_date>=date)

I find it a bit odd that when using sqlalchemy something that gets stored 
as None is retrieved as 0000-00-00, so I guess I'm making some mistake. 

Trying to find a solution to this problem led me to do

end_date = Column(Date(),nullable=True,server_default=text("NULL"))

but it makes no difference.

Can someone help? Thanks!

Marco

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to