I'd build a TypeDecorator that receives the result back and ensures it's of the form you want:
http://www.sqlalchemy.org/docs/core/types.html#augmenting-existing-types more examples: http://www.sqlalchemy.org/docs/core/types.html#typedecorator-recipes "impl" here would be the type object you're currently using to represent the column type. On Sep 30, 2011, at 1:43 AM, Brian wrote: > I have a postgres database local and stores data about our active students. > The remote database for our SIS (Student Information System) is using > Microsoft SQL. > > I'm using psycopg2 and pymssql libraries respectively. > > The date object types I'm getting back from these databases are different, so > when I do a session.merge() from the remote to the local databases, > is_modified() gets set and the history for that date attribute shows that a > change is pending, even when the date is exactly the same in both instances. > > smalldatetime in MSSQL ends up as a datetime.datetime object, and date in > postgresql ends up as a datetime.date. > > Is there an easy way I can force the MSSQL attribute to return a > datetime.date object, or do I just need to do a type lookup on the object to > make a change before I merge each time? > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/5gBCNZKgyvUJ. > To post to this group, send email to [email protected]. > 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. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
