我有两个类:我的模型中的 Products 和 SalableProducts (SalableProducts 继承自 Products,因此它具有数据库的每个字段)。这是我的架构在下面
我尝试包括“exclude_fields”属性,但没有奏效
Product_schema.py:
class Product(SQLAlchemyObjectType):
class Meta:
model = ProductModel
interfaces = (relay.Node, )
class ProductConnections(relay.Connection):
class Meta:
node = Product
Saleable_product_schema.py:
class SalableProduct(SQLAlchemyObjectType):
class Meta:
model = SalableProductModel
interfaces = (relay.Node, )
class SalableProductConnections(relay.Connection):
class Meta:
node = SalableProduct
架构.py:
class Query(graphene.ObjectType):
node = relay.Node.Field()
all_products = SQLAlchemyConnectionField(ProductConnections)
all_salable_products =
SQLAlchemyConnectionField(SalableProductConnections)
结果是这个错误:
AssertionError:在架构中找到具有相同名称的不同类型:product_status、product_status。
(product_status 是两个类通过继承共享的属性)