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

sqlalchemy-utils enum to graphene type double conversion #297

Closed
lungati opened this issue Jan 7, 2021 · 2 comments
Closed

sqlalchemy-utils enum to graphene type double conversion #297

lungati opened this issue Jan 7, 2021 · 2 comments

Comments

@lungati
Copy link

lungati commented Jan 7, 2021

I notice sqlalchemy_utils enum type is being converted to graphene enum type.

This section of code is triggered multiple times:
def from_enum( cls, enum, description=None, deprecation_reason=None ): # noqa: N805 description = description or enum.__doc__ meta_dict = { "enum": enum, "description": description, "deprecation_reason": deprecation_reason, } meta_class = type("Meta", (object,), meta_dict) return type(meta_class.enum.__name__, (Enum,), {"Meta": meta_class})
-2 Here.. Not sure if this is triggered automatically:
@convert_sqlalchemy_type.register(types.Enum) def convert_enum_to_enum(type, column, registry=None): return lambda: enum_for_sa_enum(type, registry or get_global_registry())

N.B: My models include this section: business_domain = Column(Enum(BusinessDomain), nullable=False)

-3 And here... I trigger the same code here because I need to list the values of the enum. Commenting out this section resolves the issue but I need this list of values!
graphene.List(graphene.Enum.from_enum(BusinessDomain))

Noticed the LRU cache fix mentioned here (#211) won't help if you have different enums.

Can someone help me figure out the issue

@lungati
Copy link
Author

lungati commented Jan 7, 2021

Think I found the solution #98 (comment)

@lungati lungati closed this as completed Jan 7, 2021
@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 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant