2017-12-07 4 views
0

graphQLからコンパイル済みのraw sqlコマンドを取得する方法SQLAlchemy?私は、検索をしましたが、運:(SQLAlchemyを使ってgraphQLからコンパイルされたraw sqlを取得するには?

schema.py

class RecordType(SQLAlchemyObjectType): 

    class Meta: 
     model = Record 
     interfaces = (graphene.relay.Node,) 

class Query(graphene.ObjectType): 

    node = graphene.relay.Node.Field() 
    record = graphene.Field(RecordType, id=graphene.Int()) 

    def resolve_record(self, info, **args): 
     id = args.get('id') 
     return RecordType.get_query(info).get(id) 

schema = graphene.Schema(query=Query, types=[RecordType]) 

答えて

0

まあ、私はちょうど方法を見つけない、https://stackoverflow.com/a/36141722/9041712

query = RecordType.get_query(info) 
print(query.statement.compile(compile_kwargs={"literal_binds": True})) 
からの参照
関連する問題