rdmur...@bitdance.com wrote: > Quoth jason kirtland <j...@discorporate.us>: >> rdmur...@bitdance.com wrote: >>> I have an existing MySQL database (that I do not control) with schema >>> fields defined using the 'Date' type. The values that occur in these >>> fields often have a 'day' of '00', and sometimes a month of '00', and >>> sometimes the field's value is 0000-00-00. The zeros are used to indicate >>> "don't know" (or, sometimes, "don't care"). >>> >>> Since '00' is invalid for the fields in a Python DateTime, it seems as >>> though >>> I can't actually use DateTime to manage these values. My application >>> should be able to use them as strings, but how do I arrange to do that? >>> The conversion to DateTime is presumably taking place at the DBAPI level. >> Check out the MySQLdb docs for the 'conv' type mapping option to >> connect(). I think you should be able to override the default datetime >> with your own convert that falls back to a string or whatever you'd like >> it to do. > > That sounds promising, and I doubt I would have found that just by googling, > so thanks! > > Now, how do I get SQLAlchemy to pass that dictionary into the MySQLdb > 'connect'? :)
You can pass it in via the create_engine's connect_args: http://www.sqlalchemy.org/docs/05/dbengine.html#custom-dbapi-connect-arguments Cheers, Jason --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---