【发布时间】:2021-11-28 03:26:47
【问题描述】:
示例代码
我有以下型号。
class Post(Base):
__tablename__ = "post"
id = Column(Integer, primary_key=True, index=True)
title = Column(String)
author = Column(String)
content = Column(String)
time_created = Column(DateTime(timezone=True), server_default=func.now())
使用此架构
class PostSchema(SQLAlchemyObjectType):
class Meta:
model = Post
问题
如何以这样的字符串形式获取 graphql 模式定义
"""
type Post{
id: ID
title: string!
author: String!
content: String!
time_created: Int!
}
"""
-
我试过这个,但没有
type_defs选项。 graphene.Field(PostModel).type_defs
【问题讨论】:
标签: graphene-python