In this tutorial we show you how to issue Hasura GraphQL queries that join data from 2 different databases, hosted in 2 different clouds, into a single result set.
Remote Joins in Hasura GraphQL extend the concept of joining data across tables, to being able to join data across tables and remote data sources. In this blog post we are going to demonstrate this capability by configuring the following set up.
First things first, for those of you who might be new to either distributed SQL or YugabyteDB…
Distributed SQL databases are becoming popular with organizations interested in moving data infrastructure to the cloud or to cloud native environments. This is often motivated by the desire to reduce TCO or move away from the scaling limitations of monolithic RDBMS like Oracle, MySQL, and SQL Server. The basic characteristics of Distributed SQL are:
For a deeper discussion about what Distributed SQL is, check out, “What is Distributed SQL?”
YugabyteDB is an open source, high-performance distributed SQL database built on a scalable and fault-tolerant design inspired by Google Spanner. YugabyteDB is PostgreSQL wire compatible and supports GraphQL along with advanced RDBMS features like stored procedures, triggers, and UDFs.
Got questions? Make sure to ask them in our YugabyteDB Slack channel. Ok, let’s dive in…
Here are the complete steps to install a 3 node YugabyteDB cluster on Google Kubernetes Engine. Once you have a YugabyteDB cluster running on GKE, check the status of the cluster by executing the command below:
$ kubectl get services --namespace yb-demo NAME EXTERNAL-IP PORT(S) yb-tserver-service 35.224.XX.XX 5433:3067/TCP
Note the external IP for yb-tserver-service which we are going to use to establish a connection between YugabyteDB and Hasura GraphQL Engine. From the output above we can see that the IP is
35.224.XX.XX and the YSQL port is
In our documentation, you can find a variety of sample databases that are compatible with YugabyteDB. For the purposes of this tutorial we are going to use the Northwind sample database. The Northwind database contains the sales data for a fictitious company called “Northwind Traders,” which imports and exports specialty foods from around the world. The Northwind database is an excellent tutorial schema for a small-business ERP, with customers, orders, inventory, purchasing, suppliers, shipping, employees, and single-entry accounting.
Connect to the yb-tserver-pod by running the following command:
$ kubectl exec -n yb-demo -it yb-tserver-0 /bin/bash
To download the schema and data files, run the following commands:
$ wget https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/sample/northwind_ddl.sql $ wget https://raw.githubusercontent.com/yugabyte/yugabyte-db/master/sample/northwind_data.sql
Note: If the Google Cloud Shell tells you that the
wget command does not exist, you can execute:
$ yum install wget -y
To connect to the YSQL service, exit out of the pod shell and run the following command:
$ exit $ kubectl exec -n yb-demo -it yb-tserver-0 -- ysqlsh -h yb-tserver-0.yb-tservers.yb-demo
Create a database and connect to it using the following commands:
yugabyte=## CREATE DATABASE northwind; northwind=## \c northwind;
We can now create the database objects and load them with data using the files we downloaded to yb-tserver-pod using the following commands:
northwind=## \i 'northwind_ddl.sql'; northwind=## \i 'northwind_data.sql';
By default, a YugabyteDB installation doesn’t have a password setup for the default
yugabyte user. Specifying one is done the same way you’d do it in PostgreSQL.
northwind=## ALTER ROLE yugabyte WITH PASSWORD 'password';
We are now ready to install the Hasura GraphQL Engine on GKE. Exit the YSQL shell and get the Hasura Kubernetes deployment and service files by executing the commands below.
$ wget https://raw.githubusercontent.com/hasura/graphql-engine/master/install-manifests/kubernetes/deployment.yaml $ wget https://raw.githubusercontent.com/hasura/graphql-engine/master/install-manifests/kubernetes/svc.yaml
Modify the database URL in
deployment.yaml file to include the IP of YugabyteDB. For the purposes of this tutorial, the modification should look like this:
value: postgres://yugabyte:[email protected]:5433/northwind
Note: If you’d like everything to run in the yb-demo namespace, make sure to modify the namespace value in both the
svc.yaml files. This is the setup I have chosen for this demo.
After saving the file, use
kubectl to create a Hasura deployment using the commands below:
$ kubectl create -f deployment.yaml deployment.apps/hasura created $ kubectl create -f svc.yaml service/hasura created
To find the external IP and open the Hasura console execute the command below:
$ kubectl get services --namespace yb-demo NAME EXTERNAL-IP PORT(S) hasura 35.192.XX.XX 80:30546/TCP
Now use http:///console to access the Hasura console. In this case it is
35.192.XX.XX. You should now see the Hasura console.
Our original Kubernetes tool list was so popular that we've curated another great list of tools to help you improve your functionality with the platform.
SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.
See how to install a 3 node YugabyteDB cluster on Google Kubernetes Engine, build the sample Northwind database, build and configure SQLPad, and more! In this blog post we’ll show you how to: Install a 3 node YugabyteDB cluster on Google Kubernetes Engine, Build the sample Northwind database, Build and configure SQLPad, Start the required SQLPad processes, Launch the SQLPad UI and issue a test query to validate the deployment.
In this article, we will discuss how to migrate an on-premises SQL Server database to Microsoft Azure SQL Database.
During the recent Ignite virtual conference, Microsoft announced several updates for their Azure multi-cloud and edge hybrid offerings. These updates span from security innovations to new edge capabilities.