⚠️ This project is still in development. The API is still subject to change and suggestions are welcome. If you find a bug that doesn't already have an open issue, please open one.
Sqlmancer is a Node.js library for integrating SQL with GraphQL. It empowers you to effortlessly and efficiently translate GraphQL queries into SQL statements.
Sqlmancer generates a fluent, type-safe database client from your schema based on metadata you provide through schema directives. With Sqlmancer, your resolver can be as simple as this:
function resolve (root, args, ctx, info) {
return Film.findMany().resolveInfo(info).execute();
}
while still allowing complex queries like this:
Show query
query FilmQuery {
films(
where: {
or: [
{ budget: { greaterThanOrEqual: 50000000 } },
{ language: { name: { in: ["Spanish", "French"] } } },
]
actors: { count: { lessThan: 50 } },
},
orderBy: [{
actors: { avg: { popularity: DESC } }
}],
limit: 100
) {
id
title
actors(
orderBy: [{
popularity: DESC
}],
limit: 10
) {
id
firstName
lastName
films(
orderBy: [{
films: { min: { budget: ASC } }
}]
limit: 5
) {
id
title
}
}
}
}
See the official documentation for API reference, guides and more.
If you found a bug, have a feature request or want to contribute to the project, please open an issue. If you need help or have a question, you can ask on Stack Overflow or come chat with us on Discord!
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
$ claude mcp add sqlmancer \
-- python -m otcore.mcp_server <graph>