Hello,

TLDR:

I'm wondering if I can integrate Calcite with [graphql-java] and use
Calcite to transform a graphql query into an SQL query and send it
directly to the database.

Furthermore, I'm curious if I can use Calcite's adapters to emulate an
SQL layer on top of other remote services and leverage the query planner
from Calcite to build smart/optimal queries.

There is prior art to this: a project called [join-monster] that does
this for JS. See [join-monster-7-min] video for a short description.

The process to go from graphql query to SQL query is described in
[join-monster-process] and it's quite short.

Longer version

I'm working on a GraphQL API for a SaaS platform. Right now we are
facing with a common problem in GraphQL: one query for a graph of
objects will turn to N+1 queries on the back-end data-store. There is a
lot of literature on this on the internet and also descibed in
[data-loader] and [join-monster].

Now, one solution for this problem is to use [data-loader]  - to cache
objects. This works for some, and it is kind of the only solution for
remote data stores (other http API endpoints).

My initial objective is to transform the AST that graphql-java builds
into an AST for SQL and push this SQL to one database.

I believe Calcite can help with this and I'm reaching out to the
community since I'm not familiar with the project and the features and
limitations it has.

Can Calcite help me transform the GraphQL query AST to an SQL AST? 

Should I look into this or should I go straight to something like ANTLR.
I know there is a definition for [graphql-java-antlr] . I'm asking this
to know if it has features that could help me or could block me?

Features that could help I imagine is the [SQL-grammer] ? 


Thank you,

Eugen


[data-loader] https://github.com/facebook/dataloader

[graphql-java] https://github.com/graphql-java/graphql-java/ 

[join-monster] https://join-monster.readthedocs.io/en/latest/

[join-monster-7-min] https://www.youtube.com/watch?v=Y7AdMIuXOgs

[join-monster-process]
https://github.com/acarl005/join-monster/tree/master/src

[graphql-java-antlr]
https://github.com/graphql-java/graphql-java/tree/master/src/main/antlr 

[sql-grammmer] https://calcite.apache.org/docs/reference.html


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to