Giter Club home page Giter Club logo

graphqlize-java's Introduction

GraphQLize, an open-source Java(JVM) library for developing GraphQL API instantly from your existing PostgreSQL and MySQL databases.

It aims to simplify the effort required to expose GraphQL APIs over relational databases.

GraphQLize is at its early stages now. The objective of this early release is to get early feedback from the community. It is not production-ready yet!

Clojars Project

Rationale

In the JVM ecosystem, developing GraphQL APIs to expose the data from the relational databases requires a lot of manual work. Right from defining the GraphQL schemas (either code-first or schema-first) to wiring them with resolvers and the database access logic, we spend a significant amount of our development time.

In addition to this, we also need to take care of optimizing the underlying SQL queries to avoid problems like N+1 queries. We have to account the maintenance of the resulting codebase as well!

GraphQLize will help you to overcome all these shortcomings. It provides you with an efficient GraphQL implementation in just few lines of code.

What is GraphQLize?

GraphQLize is a JVM library written in Clojure with Java interoperability. The crux of GraphQLize is generating the GraphQL schema and resolving the queries by making use of JDBC metadata provided by the JDBC drivers.

It currently supports Postgres (9.4 & above) and MySQL (8.0 & above).

Getting Started

Getting started with GraphQLize is simple and involves only a few steps.

  1. Add the GraphQLize dependency in your project.
  2. Initialize GraphQLize Resolver by providing the Java SQL data source.
  3. Add a GraphQL API endpoint and use the initialized GraphQlize Resolver in the previous step.

The actual implementation of these steps will vary based on which framework (Spring Boot, Spark Java, etc.). Please refer the below links for more details.

Is It Production Ready?

It will be in a few months.

The objective of this alpha release is to get early feedback from the community.

There are close to forty issues that I am planning to work on in the upcoming months to make it production ready.

You can keep track of the progress by

How can I contribute?

GraphQLize is at its early stage now, and the codebase and the APIs are not stable yet.

So, at this instant, the best way to contribute is to initiate a chat in GraphQLize's Discord channel or raise a GitHub issue with all the relevant details, and we'll take it from there.

Oracle & SQL Server Support

One of the design goal of GraphQLize from day one is to support Postgres, MySQL, Oracle & MS SQL Server. To start with, I am focussing on getting it to a production ready state for Postgres & MySQL. After accomplishing this, I will be focusing on the other two.

Acknowledgements

PostgREST, PostGraphile, KeyStoneJs and Hasura are the inspiration behind GraphQLize.

GraphQLize is not possible without the following excellent Clojure libraries.

The samples in the documentation of GraphQLize uses the Sakila database from JOOQ extensively.

License

The use and distribution terms for this software are covered by the Eclipse Public License - v 2.0. By using this software in any fashion, you are agreeing to be bound by the terms of this license.

graphqlize-java's People

Contributors

tamizhvendan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

graphqlize-java's Issues

No method in multimethod 'get-db-config' for dispatch value: Oracle when connecting to oracle database

I was working on these tutorials here which use PostgreSQL and MySQL:

They both work fine as intended when connecting to Postgres and MySQL but the trouble begins when I attempt to connect to Oracle.

I get the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'get-db-config' for dispatch value: Oracle
	at clojure.lang.MultiFn.getFn(MultiFn.java:156)
	at clojure.lang.MultiFn.invoke(MultiFn.java:229)
	at honeyeql.meta_data$fetch.invokeStatic(meta_data.clj:350)
	at honeyeql.meta_data$fetch.invoke(meta_data.clj:346)
	at honeyeql.db$initialize.invokeStatic(db.clj:12)
	at honeyeql.db$initialize.invoke(db.clj:7)
	at graphqlize.lacinia.core$schema.invokeStatic(core.clj:39)
	at graphqlize.lacinia.core$schema.invoke(core.clj:38)
	at graphqlize.java_interop$initialize.invokeStatic(java_interop.clj:10)
	at graphqlize.java_interop$initialize.invoke(java_interop.clj:9)
	at clojure.lang.Var.invoke(Var.java:384)
	at org.graphqlize.java.GraphQLizeResolver.<init>(GraphQLizeResolver.java:17)

Following the offending line, it's happening somewhere inside this:

package org.graphqlize.java;

import clojure.java.api.Clojure;
import clojure.lang.IFn;
import java.util.Map;
import javax.sql.DataSource;

public class GraphQLizeResolver implements GraphQLResolver {
    private static final IFn initializeGraphQLizeResolver;
    private final GraphQLResolver resolver;

    public GraphQLizeResolver(DataSource var1) {
        this.resolver = (GraphQLResolver)initializeGraphQLizeResolver.invoke(var1);
    }

    public String resolve(String var1) {
        return this.resolver.resolve(var1);
    }

    public String resolve(String var1, Map<String, Object> var2) {
        return this.resolver.resolve(var1, var2);
    }

    static {
        IFn var0 = Clojure.var("clojure.core", "require");
        var0.invoke(Clojure.read("graphqlize.java-interop"));
        initializeGraphQLizeResolver = Clojure.var("graphqlize.java-interop", "initialize");
    }
}

I have no idea what could be causing the issue.

Oracle version: Oracle Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
Java Version: 15
OS : Zorin OS 15.3

POM file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.qurvee</groupId>
    <artifactId>graphql-poc</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <repositories>
        <repository>
            <id>Clojar</id>
            <url>https://clojars.org/repo</url>
        </repository>
        <repository>
            <id>ICM</id>
            <url>http://maven.icm.edu.pl/artifactory/repo/</url>
        </repository>

        <repository>
            <id>MVN2</id>
            <url>http://maven.jahia.org/maven2/</url>
        </repository>

        <repository>
            <id>Atlassian 3rd Party</id>
            <url>https://packages.atlassian.com/maven-3rdparty/</url>
        </repository>

        <repository>
            <id>central</id>
            <url>https://mvnrepository.com/artifact/</url>
        </repository>

    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.4.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.graphqlize/graphqlize -->
        <dependency>
            <groupId>org.graphqlize</groupId>
            <artifactId>graphqlize-java</artifactId>
            <version>0.1.0-alpha20</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/seancorfield/next.jdbc -->
        <dependency>
            <groupId>seancorfield</groupId>
            <artifactId>next.jdbc</artifactId>
            <version>1.1.613</version>
        </dependency>

        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java</artifactId>
            <version>15.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.30</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.10.3</version>
        </dependency>

        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.9.3</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.10.3</version>
        </dependency>

        <!--<dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>19.8.0.0</version>
            <scope>runtime</scope>
        </dependency>-->

        <!-- https://mvnrepository.com/artifact/com.oracle/orai18n -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>orai18n</artifactId>
            <version>11.2.0.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.oracle/ojdbc6 -->
        <!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc10 -->
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc10</artifactId>
            <version>19.8.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.5</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>15</source>
                    <target>15</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <java.version>15</java.version>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

What could be the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.