Denodo Platform-"Develop Rest & GraphQL service using no-code/low-code approach with me 😀😀"
Tags: java, graphql, beginners, webdev
Published: 2022-01-12 11:57:31

**What Is Denodo?**
The Denodo Platform is a data virtualization system that allows applications to use data from multiple, heterogeneous data sources.

If you have multiple resource from where you are retrieving enterprise data , Denodo as a data virtualization tool offers you single point of access to your enterprise data without moving it to a centralized repository .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v37li8c9elzxv4e4shcc.png)
 
If any data change happens in any of the data-source , changes will be synced automatically in denodo. No need to manually add the changes.

•	If any column data is modified then nothing is required from our side.
•	If any new column is added or any column is deleted  we need to click on Source Refresh link on Edit section of Json Base View . That’s it. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/muqycc5v8eef9mpao21k.png)
 

You can install denodo by referring official site (Full instruction present here) :

https://community.denodo.com/docs/

**We can call denodo platform as No-Code/Low-Code Platform :**

Denodo platform allows developers to create Services (REST/SOAP/GRAPHQL ETC..) through graphical user interfaces and configuration instead of writing traditional code.

**Here are the benefits :**

- Improved agility. Operating at digital speed means creating the app capabilities users require to function smoothly across multiple devices.
- Decreased costs.
- Higher productivity.
- Better customer experience.
- Effective risk management and governance.
- Change easily.
- Faster transformation.

There are many modules in Denodo . One of those are “**Virtual DataPort**” .
 
**Virtual DataPort :**
The main module of the Denodo Platform. This is the module where developers create “virtual views” that integrate data from multiple sources: databases, SAP BW servers, XML files, JSON files, CSV files, etc.
Virtual DataPort provides several ways to query these virtual views:
 
•	A JDBC and an ODBC driver
•	By publishing SOAP and REST web services
•	By using GraphQL queries 



**Use Denodo by installing it to local system :**

**Note :** We need to start Virtual DataPort server before launching Virtual DataPort Administration Tool .


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zproo53nssolvl2fly3c.jpg)
 
After starting Virtual dataPort server , we need to click on Launch button to launch Virtual DataPort Administration Tool. Here is how Virtual DataPort Administration Tool looks like:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ykzst81jg9801k8ctxi.jpg)

Denodo has many features , It supports not only SOAP service ,but also Rest API and GraphQL. It can connect & integrate with different data-source.

<u>**Steps to use different Denodo services:**</u>

**1.Connect External Database with Denodo JDBC.**
 
Using Denodo we can connect with any Database using JDBC then query data from those databases .
 
**Step1:** Create JDBC data source and provide all the data resource information  click save (Highlighted).

In my case I am going to connect with Postgres DB


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/784cwehi8mlyz1wpq9gj.jpg)

**Step2:** Need To create JDBC Base View by selecting the Table and save.(Highlighted)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iug4bsduhumuwrs2pjtj.jpg)

**Step3:** Once Base view is created we can query data from the view to get the data.(Highlighted)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kyd8x4cmdizpos29t74e.jpg)

Now we are connected with Data-source.

**2.How Denodo supports Rest service by exposing its own rest endpoint.**

**Denodo exposes its own Rest endpoint.**

In my case I want to use Rest service which can connect to my data source which I have integrated with Denodo and return the result in JSON format .

**Step1 :** Create JSON data source and fill following details , Select Data route as HTTP Client and click on configure


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pv6xnmycvsg8zsde9su7.jpg)

**Step2:** Complete the configuration part. In URL section we need to enter Denodo rest URL(using  mentioned format beow) and save it.
 
**<u>Examples of how to invoke the RESTful Web service</u>**
 
o	http://localhost:9090/denodo-restfulws/admin returns the list of views of the database admin.
 
o	http://localhost:9090/denodo-restfulws/admin/views/customer returns the content of the view customer of the database admin.
 
o	http://localhost:9090/denodo-restfulws/admin/views/customer/1/orders browses through the mapping orders of the row of the table customer whose primary key is 1.
 
**Format :**
•	http://host:port/denodo-restfulws/<databasename>/views/<viewname>?$format=json // **(For JSON response)**
•	http://host:port/denodo-restfulws/<databasename>/views/<viewname>?$format=xml // **(For XML response)**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/35dvgt0wnftolc4hklav.jpg)


**Step3:** Create Base view by clicking on Create base view


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zb9s8lg2rkl4wy56g52a.PNG)

After creating base view you can execute query from that view to cross check data is coming or not.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svt8pdko2j74idynsuw0.png)
 
We can execute it from here also. But we are going to deploy this to use it from browser .

**Step4:** Click on deploy.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1ixjob1y6i096pt4yab.jpg)

**Step5:** Copy the URL from  Web Service container and enter that URL in browser by concatenating with “?$format=json or ?$format=xml” . you will get the result.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hr8yfxenxczngp5frqo2.jpg)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6t4kvle3cpppu6104gr4.jpg)

**3.Denodo supports External Rest service (masks external rest service).**
 
We can use denodo to mask an external Rest API also and access it using Denodo exposed Rest endpoint .
 
**4.How Denodo supports GraphQL.**
 
Denodo supports GraphQL service . 

**<u>Denodo GraphQL Service</u>**
GraphQL is a data query language, and a runtime for executing those queries against your data.
•	It gives clients the power to ask for exactly what they need.
•	It gets many resources in a single request, reducing the number of API requests.
Denodo GraphQL Service enables the execution of GraphQL queries against the Denodo virtual data model, allowing graphQL-like queries on top of any data source.
This service is always available once you start Virtual DataPort.
Denodo GraphQL Service follows a bottom-up approach where the API specifications are automatically generated from the metadata of the Denodo views and stored procedures.
The GraphQL Service creates a query type for each view and stored procedure of a Denodo database. The view fields appear as children of the view object, and the same occurs for the parameters, in the case of stored procedure objects. Associations in Denodo are mapped to nested relationships between the different objects, so the GraphQL queries will fetch related objects and their fields in one request.

**Features**
The Denodo GraphQL Service provides:
•	Read-only access to Denodo databases
•	Pagination
•	Filtering 
•	Sorting 
•	Group by and aggregation functions
•	HTTP Authentication
o	Basic
o	SPNEGO (Kerberos)
o	OAuth 2.0

Denodo exposes its  GraphQL endpoint like :
 
**http://localhost:9090/denodo-graphql-service/graphql/<databasename>**
 
In my case Database name is “Admin”. All the Tables, Views present under this Database will be accessible by the Denodo-exposed GraphQL endpoint .

Here no need to configure any other thing.
 
Open Altair and hit the GraphQL endpoint (using above format) and see the schema documentation . We can see documentation is already  generated . And we can run GraphQL query with filters also. Filters will be based on each field.

Denodo will be generated  all type of filters.

**Here are few sample query to show how to apply filters:**

**query{
member(_filter: {
   or:[
    {expression: {field :"umi",eq:"4085624876909"}},
    {expression: {field :"umi",eq:"4085624876980"}} 
  ]
})
  {
    umi
    firstname
  }
}**

*****************************************************************

**query{
member(_orderBy : 
  [{asc:"firstname"},{desc:"umi"}]
)
  {
    umi
    firstname
  }
}**

Here one sample query is executed in Altair tool using GraphQL endpoint exposed by Denodo.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uv913lxkdj3y4xfwx549.jpg)

Till now We have discussed how to use Denodo by installing it to our own machine . Now we will discuss how to use denodo which is deployed in Google Cloud Platform.

<u>**Deploy Denodo instance in GCP :**</u>

**Here are the steps :**

1.Open GCP console and go to marketplace.
2.Search for “**Denodo Standard 8.0 VDP on Linux**”
3.Fill all the required details based on requirement and create instance  .
4.It will take some time to deploy.
5.After successfully deployment you can see the username,password and external public IP address of the instance

It looks like this after creating and deployment of the instance .

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bm5dpjje5ibfpp1bepi4.jpg)

 
6.Now open browser and enter URL : 
**format** -  <IPAddress>:9090/denodo-design-studio/#/
In my case its :  http://35.201.128.114:9090/denodo-design-studio/#/
Enter username  password and connect .
 
7.Now you will see the Denodo Design Studio dashboard. Which looks like this . And now you are all set up. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2ot259m7671ahugm4eu.jpg)

8.After completing all of the above set up I need to connect to the source system using JDBC(Steps already mentioned above) and created JSON base view .

In my case I have created one postgres SQL instance in GCP and used that as my source system.

Post that I have executed GraphQL query by entering GraphQL endpoint  using externally exposed IP and I am able to see the result. 
 
Here is one sample GraphQL endpoint.
http://35.201.128.114:9090/denodo-graphql-service/graphql/admin

username & password you will get post deployment of denodo instance . Using that username & password 
add header .

First encode that username & password using Base64 format 
 
Add header : Key : Authorization, value :  Basic <encoded token>

**Important Note :** While connecting with Postgres DB from Denodo instance which is deployed in GCP you might get Connection refused error. To solve this you need to whitelist the external IP address of denodo instance in Postgres in GCP.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlcn41cy8aqforz81kts.jpg)


**Conclusion:** You have seen I have not used any single line or code . I have just configured few things and connected to data-source. Only with that I am able to develop Rest / GraphQL service. It will help for rapid development and we can concentrate more on business. 

**Reference Taken :** https://community.denodo.com/docs/

**Let's connect:**
**LinkedIn :** https://www.linkedin.com/in/arpan-bandyopadhyay-bb5b1a54/