-
Notifications
You must be signed in to change notification settings - Fork 227
MySQL Enum conversion issue #147
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
Conversation
When using reflection to build the models (instead of declarative) the Enum conversion fails because the ENUM column is treated as string so doing type.name returns None. ```sql CREATE TABLE `foos` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `status` ENUM('open', 'closed') DEFAULT 'open', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ``` ```python class Foo(Base): __table__ = Table('foos', metadata, autoload=True) ```
This PR is great. I will happily merge it once it have tests (so we don't incur on the same issue in the future). |
Yeah, the thing is that we can only test this by inspecting a database to create the models. Is gonna be a tricky test to build, but the last PR fixing enums might include my fix. |
Is the fix merged? I am still getting the same error while creating a graphql object while autoloading the tables with Enum type columns from SQL DB using sqlalchemy. Name: graphene
|
Do you know if this is still an issue? Enum conversion has changed considerably since your original PR, including an enum registry and fallback names if no type name was specified. However, |
When using reflection to build the models (instead of declarative) the Enum conversion fails because the ENUM column is treated as string so doing type.name returns None.
For some reason these kind of enums are returned as Strings so in the type definition we have to specify the field as string