How to Connect TiDB Cloud to Metabase
Author: Phoebe He (Content Developer at PingCAP)
TiDB Cloud is a fully-managed Database-as-a-Service (DBaaS) that brings everything great about TiDB to your cloud and lets you focus on your applications, not the complexities of your database.
In this 15-minute tutorial, you will learn how to connect TiDB Cloud to Metabase, an open source business intelligence (BI) tool. We will be using Metabase to build a BI dashboard and gain analytical insights using sample data from Capital Bikeshare (data released under the Capital Bikeshare Data License Agreement).
- Create a TiDB Cloud cluster and import the Capital Bikeshare sample data following the TiDB Cloud Quick Start Guide.
- Install Metabase by following these instructions. You'll have the option of installing it on premise or in the cloud.
Go to https://tidbcloud.com/console/clusters and sign in to your cluster.
On the TiDB Cloud console, click Connect on the upper right of the pane.
The Connect to TiDB dialog displays.
Create the traffic filter for the cluster.
Depending on how you use Metabase, select a traffic filter from the following options:
- If you are using an on-prem version of Metabase, click Add Your Current IP Address. Your IP Address will be automatically populated.
- If you are using Metabase on a cloud platform, click Allow Access from Anywhere.
Click Create Filter.
Take note of the TiDB Cloud IP address, listed between the -h parameter and -P parameter, as you will use it at a later step. For example:
mysql -u root -h tidb.xxx.xxxxx.us-west-2.prod.aws.tidbcloud.com -P 4000 -p
Start the Metabase application and click Let's get started.
Select your preferred language in step 1 and click Next.
Enter your information and account details in step 2 and click Next.
In the Add your data step, click the Database type drop down menu and select MySQL.
Specify the following settings
Here is an example:
Scroll down to the bottom and click Next.
For the Usage data preference step, change your preference if needed and click Next.
Click Take me to Metabase.
In this exercise we will be analyzing the sample data from Capital Bikeshare to identify the most popular type of bicycle.
On the homepage of Metabase, scroll down to the OUR DATA section and click Bikeshare.
Click the Trips table.
Explore the trips table. This is the sample data set you imported to the TiDB Cloud cluster.
To display how many records are associated with each rideable bike type, click the +Summarize button on the top right.
Select Count as the metric and select Rideable Type for the Group by field.
The bar chart displays immediately.
We can see that docked bikes are the most popular bike type and electric bikes are the least popular kind of bike.
Ready to give TiDB Cloud a try? TiDB Cloud Developer Tier is now available! It lets you run a TiDB cluster for free for one year on Amazon Web Services. Make sure to follow us on Twitter to stay updated on TiDB Cloud news!