Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL TIMESTAMP type is misrendered as DATETIME #11

Closed
agronholm opened this issue Jan 23, 2014 · 3 comments
Closed

MySQL TIMESTAMP type is misrendered as DATETIME #11

agronholm opened this issue Jan 23, 2014 · 3 comments

Comments

@agronholm
Copy link
Owner

Originally reported by: Jean-Paul Calderone (Bitbucket: exarkun, GitHub: exarkun)


A column with type TIMESTAMP ends up with a Column(DateTime()) in the generated model.

This is presumably because Model.__init__ tries to down-adapt TIMESTAMP to something generic based on the SQLAlchemy class hierarchy and TIMESTAMP subclasses DateTime in SQLAlchemy.

This definitely breaks the type of the column and does so very obviously when the column has a default like CURRENT_TIMESTAMP which is not an allowed value for a MySQL DATETIME column.


@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


What do you suggest as a solution? PostgreSQL accepts CURRENT_TIMESTAMP for datetime columns, so the problem isn't universal. If I start adding fixes for backend specific quirks, there'll be no end to those.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


I wonder if it'd be possible to check if the adapted column type is still rendered as the original type. That would solve this problem without having to resort to black/whitelists.

@agronholm
Copy link
Owner Author

Fixed by f856880.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant