All Projects → danielrearden → sqlmancer

danielrearden / sqlmancer

Licence: MIT License
Conjure SQL from GraphQL queries 🧙🔮✨

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to sqlmancer

Cruddl
Create a GraphQL API for your database, using the GraphQL SDL to model your schema.
Stars: ✭ 98 (-24.03%)
Mutual labels:  graphql-js
graphql-extended
An extension of graphql-js that adds useful functionality for production graphql deployments.
Stars: ✭ 29 (-77.52%)
Mutual labels:  graphql-js
graphql-spotify
GraphQL Schema And Resolvers For Spotify Web API
Stars: ✭ 55 (-57.36%)
Mutual labels:  graphql-js
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (+8401.55%)
Mutual labels:  graphql-js
Join Monster
A GraphQL to SQL query execution layer for query planning and batch data fetching.
Stars: ✭ 2,395 (+1756.59%)
Mutual labels:  graphql-js
graphql-express-nodejs
A Simple GraphQL Server implementation using Express and Node. See post here: https://t.co/Cm6GitZaBL
Stars: ✭ 24 (-81.4%)
Mutual labels:  graphql-js
Graphql Rxjs
fork of Graphql which adds Observable support
Stars: ✭ 78 (-39.53%)
Mutual labels:  graphql-js
graphql-type-uuid
UUID scalar type for GraphQL.js
Stars: ✭ 23 (-82.17%)
Mutual labels:  graphql-js
The Road To Graphql
📓The Road to GraphQL: Your journey to master pragmatic GraphQL in JavaScript
Stars: ✭ 203 (+57.36%)
Mutual labels:  graphql-js
graphql-query-whitelist
GraphQL query whitelisting middleware
Stars: ✭ 17 (-86.82%)
Mutual labels:  graphql-js
Hangzhou Graphql Party
杭州 GraphQLParty 往期记录(slide,照片,预告,视频等)
Stars: ✭ 142 (+10.08%)
Mutual labels:  graphql-js
Grial
A Node.js framework for creating GraphQL API servers easily and without a lot of boilerplate.
Stars: ✭ 194 (+50.39%)
Mutual labels:  graphql-js
student-api-graphql
A GraphQL Wrapper for Ellucian's Banner Student REST API
Stars: ✭ 19 (-85.27%)
Mutual labels:  graphql-js
The Road To Graphql Chinese
📓The Road to GraphQL: Your journey to master pragmatic GraphQL in JavaScript
Stars: ✭ 104 (-19.38%)
Mutual labels:  graphql-js
graphql-resolver-cache
Caching for Graphql Resolvers
Stars: ✭ 18 (-86.05%)
Mutual labels:  graphql-js
Graphql Log
Add logging to your GraphQL resolvers so you know what's going on in your app.
Stars: ✭ 94 (-27.13%)
Mutual labels:  graphql-js
graphql-directive-rest
GraphQL directive for easy integration with REST API
Stars: ✭ 39 (-69.77%)
Mutual labels:  graphql-js
relay-compiler-plus
Custom relay compiler which supports persisted queries
Stars: ✭ 68 (-47.29%)
Mutual labels:  graphql-js
graphcraft
Rapildy build and extend GraphQL API based on Sequelize models. This library helps you focus on business logic while taking care of GraphQL schema automatically.
Stars: ✭ 50 (-61.24%)
Mutual labels:  graphql-js
ugql
🚀GraphQL.js over HTTP with uWebSockets.js
Stars: ✭ 27 (-79.07%)
Mutual labels:  graphql-js

Sqlmancer

Conjure SQL from your GraphQL queries 🧙🔮

GitHub package.json version GitHub Build Status Coverage Status Language grade: JavaScript Discord

⚠️ This project is currently on hiatus. I am hoping to resume working on Sqlmancer once I have some more free time. Feel free to submit new issues for feature requests or bug reports, although I may not address them immediately.

Sqlmancer is a Node.js library for integrating SQL with GraphQL. It empowers you to effortlessly and efficiently translate GraphQL queries into SQL statements.

How it works

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
      }
    }
  }
}

Features

  • Multiple dialect support. Sqlmancer supports Postgres, MySQL, MariaDB and SQLite, enabling you to incorporate it into existing projects regardless of what flavor of SQL you're using.
  • Robust filtering and sorting. Add complex filtering and sorting to your queries, including filtering using logical operators and filtering and sorting by fields and aggregate fields of related models.
  • Arbitrarily deep nesting. Define one-to-one, one-to-many and many-to-many relationships between models. Related models can be filtered, sorted and paginated just like root-level fields.
  • Performance. Avoid the N+1 problem by building a single SQL query to fetch all necessary data, regardless of query depth.
  • Mutations made easy. Create, update and delete records, with or without transactions, using a simple, fluent API. Easily provide WHERE, ORDER BY and LIMIT clauses to your queries when updating and deleting records.
  • Views and CTEs. Take advantage of existing views in your database and create inline ones using common table expressions.
  • Custom scalars. Use the scalars that make sense for your schema.
  • Abstract types. Utilize unions and interfaces in your schema using views or single table inheritance.

Design goals

  • Annotation over transformation. Sqlmancer aims to be as aspect-oriented as possible, with directives being used mostly to annotate your schema rather than outright change its behavior.
  • Limited type-generation. Sqlmancer offers a number of convenient directives to generate arguments or types, but these directives are never required for Sqlmancer to work its magic. What types are exposed in the schema is ultimately left up to you.
  • More than just CRUD. Sqlmancer empowers you to create the queries and mutations that are right for your schema.
  • Flexible and unopinionated. Sqlmancer enabled you to easily add features like authorization, tracing, cost analysis and depth limits using existing libraries without paying for a "pro" version.

See the official documentation for API reference, guides and more.

Community

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!

Contributors

Thanks goes to these wonderful people (emoji key):


Daniel Rearden

💻 📖 🤔

Pavel Ravits

📖

Tadej Stanic

🐛

Tristan Siegel

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].