Skip to content

ChoiceType column doesn't result in a field #199

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

Closed
thejcannon opened this issue Apr 1, 2019 · 7 comments
Closed

ChoiceType column doesn't result in a field #199

thejcannon opened this issue Apr 1, 2019 · 7 comments
Labels
bug waiting Waiting for an other issue / project

Comments

@thejcannon
Copy link

Given

class MyModel(Base):
   foo = Column(ChoiceType([('X', 1)])

class MyModelNode(SQLAlchemyObjectType):
   class Meta:
      model= MyModel

I'm missing "foo" from the generated schema.

I believe this is due to the fact that convert_column_to_enum is returning an instance of graphene.Enum, which isn't a MountedScalar or a Field (notice convert_enum_to_enum returns a Field)

@thejcannon
Copy link
Author

Actually, this seems to be an issue with graphene-python. From the code graphene.ENum should be able to be mounted (like a scalar), but instances of graphene.Enum are failing isinstance(enum, UnmountedType) which means the enum instance isn't being mounted.

@thejcannon
Copy link
Author

Now it's getting really weird.

>>> isinstance(Enum('Foo', [('X', 1)]), UnmountedType)
False
>>> isinstance(Int(), UnmountedType)
True
>>> isinstance(Enum('Foo', [('X', 1)])(), UnmountedType)
True

@thejcannon
Copy link
Author

OK I created an issue with graphene-python about this.

@thejcannon
Copy link
Author

Didn't mean to close 😄 (as there might be consequences that affect this library from the outcome of the other issue)

@thejcannon thejcannon reopened this Apr 2, 2019
@Nabellaleen Nabellaleen added bug waiting Waiting for an other issue / project labels Apr 3, 2019
@squarewave24
Copy link

is there another thread with a resolution?
i'm on 2.2.2 and still bumping into this issue :(

@erikwrede
Copy link
Member

Issue can't be reproduced on master. Seems to be fixed.
This issue is 2 years old so I'm closing it.
@squarewave24 if you have found [and still need] a fix for 2.x, I'd happily push another release for the affected version if you open a PR!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug waiting Waiting for an other issue / project
Projects
None yet
Development

No branches or pull requests

4 participants