question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssertionError: Found different types with the same name in the schema

See original GitHub issue

I have two Classes Products and SalableProducts in my Models (SalableProducts inherits from Products so it has every field of it’s database), in my Schema here is what i did

class  Product(SQLAlchemyObjectType):
    class Meta:
        model = ProductModel
        interfaces = (relay.Node, )
        
class ProductConnections(relay.Connection):
    class Meta:
        node = Product
class  SalableProduct(SQLAlchemyObjectType):
    class Meta:
        model = SalableProductModel
        interfaces = (relay.Node, )

class  SalableProductConnections(relay.Connection):
    class Meta:
        node = SalableProduct

and here is my Query class :

class Query(graphene.ObjectType):
    node = relay.Node.Field()
    all_products = SQLAlchemyConnectionField(ProductConnections)
    all_salable_products = SQLAlchemyConnectionField(SalableProductConnections)  

When i run my server i got this error :

AssertionError: Found different types with the same name in the schema: product_status, product_status.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

9reactions
rdemetrescucommented, Jun 13, 2019

I use this monkey-patch on my projects:

from functools import lru_cache

graphene.Enum.from_enum = lru_cache(maxsize=None)(graphene.Enum.from_enum)
3reactions
danjensoncommented, Feb 11, 2020

So, for the record, I solved this by making global SQLAlchemy types, so @richin13 , your code would become:

SA_AdStatus = db.Enum(AdStatus)

class MyModel(db.Model):
    status_before = db.Column(SA_AdStatus, nullable=False)
    status_during = db.Column(SA_AdStatus, nullable=False)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Different types with the same name in the schema - Django ...
AssertionError: Found different types with the same name in the schema: PageType, PageType. It seems that it is unable to inherit models ......
Read more >
AssertionError: Found different types with the same name ...
I was having the same issue. In my particular case the issue is a conflict internal workings of SQLAlchemy when a backref is...
Read more >
ObjectType
A Graphene ObjectType is the building block used to define the relationship between Fields in your Schema and how their data is retrieved....
Read more >
AssertionError: Found different types with the same name ...
AssertionError : Found different types with the same name in the schema · Javascript Required. Kindly enable Javascript. · AssertionError: Found ...
Read more >
Python Examples of graphene.Field
You may also want to check out all available functions/classes of the module ... AssertionError: Found different types # with the same name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found