Skip to content

‣ Tableau

Overview

Tableau is a visual analytics platform for modern business intelligence. Tableau can be used to retrieve, explore, analyze and visualize data stored in Astra DB. The Tableau Platform features several products, inculding:

  • Tableau Desktop,
  • Tableau Prep,
  • Tableau Cloud.

In this tutorial, we show how to use Tableau Desktop to connect and query data in Astra DB. We use Simba JDBC Driver for Apache Cassandra® to connect Tableau Desktop and Astra DB .

Prerequisites

Setup Astra DB

1. Sign in

Connect to your Astra account and create a new Astra database or select an existing one. Add a new keyspace with name banking_db or use an existing one.

2. Create the following tables using the CQL Console

USE banking_db;
CREATE TABLE customer (
    id UUID,
    name TEXT,
    email TEXT,
    PRIMARY KEY (id)
);

CREATE TABLE accounts_by_customer (
  customer_id UUID,
  account_number TEXT,
  account_type TEXT,
  account_balance DECIMAL,
  customer_name TEXT STATIC,
  PRIMARY KEY ((customer_id), account_number)
);

3. Insert the rows using the CQL Console

INSERT INTO customer (id,name,email) VALUES (8d6c1271-16b6-479d-8ea9-546c37381ab3,'Alice','alice@example.org');
INSERT INTO customer (id,name,email) VALUES (0e5d9e8c-2e3b-4576-8515-58b491cb859e,'Bob','bob@example.org');


INSERT INTO accounts_by_customer (customer_id,account_number,account_type,account_balance,customer_name)
VALUES (8d6c1271-16b6-479d-8ea9-546c37381ab3,'A-101','Checking',100.01,'Alice');
INSERT INTO accounts_by_customer (customer_id,account_number,account_type,account_balance,customer_name)
VALUES (8d6c1271-16b6-479d-8ea9-546c37381ab3,'A-102','Savings',200.02,'Alice');
INSERT INTO accounts_by_customer (customer_id,account_number,account_type,account_balance,customer_name)
VALUES (0e5d9e8c-2e3b-4576-8515-58b491cb859e,'B-101','Checking',300.03,'Bob');
INSERT INTO accounts_by_customer (customer_id,account_number,account_type,account_balance,customer_name)
VALUES (0e5d9e8c-2e3b-4576-8515-58b491cb859e,'B-102','Savings',400.04,'Bob');

Setup Tableau Desktop

4. Install Tableau Desktop

Use an existing deployment of Tableau Desktop or follow the instructions to download, install and register a new instance of Tableau Desktop.

Install JDBC Driver for Apache Cassandra

5. Download JDBC Driver

  1. Download Astra JDBC connector jar from Github

  2. Move the resulting .jar file to:

    • /Users/[user]/Library/Tableau/Drivers on macOS
    • C:\Program Files\Tableau\Drivers on Windows

Connect to Astra DB from Tableau Desktop

7. Restart Tableau Desktop

Start or restart Tableau Desktop for the JDBC Driver installation to take effect.

8. Setup a connection to Astra DB

Connect with the JDBC Driver

  • Select Other Databases (JDBC) under Connect
  • Fill out the dialog box with the connection information:

    • URL = jdbc:astra://<db>/<keyspace>?region=<region>
      Fields are as follows:

      • db (required) Your database identifier. It can be a name (then it must be unique) or a database identifier (UUID)
      • keyspace (required) The keyspace you want to use.
      • region (optional) Only useful if the database lives in multiple regions
    • Dialect = SQL92

    • Username = <Client ID>, where a client id value is generated with your application token.
    • Password = <Client Secret>, where a client secret is generated with your application token.

    • Click the Sign In button to establish a connection.

9. Create a data source from the banking database

  • Select cassandra under Database.
  • Select banking_db under Schema.
  • Drag and drop tables customer and accounts_by_customer into the main area and establish the relationship between the tables.



10. Create a new sheet with simple visualization

Add up all account balances per customer and visualize the results:

  • Click Sheet 1 at the bottom left corner.
  • Drag and drop Name to Columns.
  • Drag and drop Account Balance to Rows.
  • Customize coloring and formatting settings as needed.




Last update: 2023-10-13