This is My Schema
const graphql = require('graphql');
const joinMonster = require('join-monster');
const FilmDb = require('../model/Films');
const { GraphQLObjectType, GraphQLList, GraphQLString, GraphQLInt,GraphQLSchema } = graphql;
const Films = new GraphQLObjectType({
name: 'films',
fields: () => ({
id: {
type: GraphQLInt,
},
name: {
type: GraphQLString,
},
})
})
Films._typeConfig = {
sqlTable: 'films',
uniqueKey: 'id'
}
const QueryRoot = new GraphQLObjectType({
name: 'Query',
fields: () => ({
films: {
type: new GraphQLList(Films),
resolve: (parent, args, context, resolveInfo) => {
return joinMonster.default(resolveInfo, {}, sql => {
return FilmDb.query(sql).then(function(result) {
return result;
});
})
}
}
})
})
module.exports = new GraphQLSchema({
query: QueryRoot
})
When I hit the below query
{ films{ id } }
It is showing me an error
{
"errors": [
{
"message": "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.\"id\" AS \"id\"\nFROM films \"films\"' at line 1",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"films"
]
}
],
"data": {
"films": null
}
}
my SQL query what is generated in the terminal is
SELECT "films"."id" AS "id" FROM films "films"
Here I m using nodejs and in DB using Sequelize
What is the error here?? I m unable to find exact error.