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 Simba JDBC Driver for Apache Cassandra

5. Download JDBC Driver

Go to https://downloads.datastax.com/#odbc-jdbc-drivers and download the latest version of Simba JDBC Driver for Apache Cassandra.

6. Install JDBC Driver

Extract the JDBC Driver .zip archive and 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

  • Select Other Databases (JDBC) under Connect
  • Fill out the dialog box with the connection information:
    • URL = jdbc:cassandra://;AuthMech=2;UID=token;PWD=<ApplicationToken>;SecureConnectionBundlePath=<SecureConnectBundle>;TunableConsistency=1, where
      • AuthMech specifies whether the driver connects to a Cassandra or Astra DB database, and whether the driver authenticates the connection. It should be set to 2 to connect to an Astra database, and authenticate the connection using a user name, password, and secure connection bundle.
      • UID and PWD specify user name and password credentials. They should be set to literal token and the actual application token value. See how to generate an application token if you do not have one already.
      • SecureConnectionBundlePath specifies the full path and name of the secure connection bundle associated with your Astra database. On Windows, you may need to escape the backslashes \ in your file path by typing another backslash \\. See how to download a secure connect bundle for your database.
      • TunableConsistency specifies the consistency level for requests to the database. The supported values are 0 for ANY, 1 for ONE, 2 for TWO, 3 for THREE, 4 for QUORUM, 5 for ALL, 6 for LOCAL_QUORUM, 7 for EACH_QUORUM, and 10 for LOCAL_ONE. Set it to 6 for this example.
    • 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: 2022-12-23