Using the Couchbase Tableau Connector

  • how-to
    +
    The Couchbase Analytics Connector for Tableau is compatible with Couchbase Server running version 7.1 or higher.

    Configure Connection

    Configure the Tableau connector based on the type of Couchbase Server instances you are using.

    Configure Couchbase Analytics Connector for Couchbase Server Instances

    To connect to your Couchbase instance:

    1. Set the Server field to the address of the Couchbase instance — for example, localhost.

    2. Enter your Username and Password, and click Sign In.

    3. (Optional) To securely connect to Couchbase with certificates enabled, select the Require SSL option.

    Tableau Connection Without SSL

    Set Up SSL Support — Tableau Connector 1.0.x

    Tableau Connector 1.0.x

    This section only applies to Tableau Connector 1.0.x.

    To configure SSL support for Tableau Connector 1.0.x, go to the Advanced tab and add the absolute paths where your TLS certificate and keystore are located.

    Tableau Connection Advanced

    For more information on managing certificates for Couchbase Server, check out the Manage Certificates page.

    Set Up SSL Support — Tableau Connector 1.1.x

    Tableau Connector 1.1.x

    This section only applies to Tableau Connector 1.1.x.

    To set up SSL support for Tableau Connector 1.1.0 and later, see the following sections:

    Configure Advanced Settings

    To set up the connection timeout and the scan consistency mode, go to the Advanced tab.

    Tableau Connection Advanced Scan Consistency

    Setting the scan consistency to Request plus displays a dropdown to select the scan wait time.

    Configure Tableau Server Connection on Tableau Desktop

    Reports and dashboards created on Tableau Desktop can be published and viewed on Tableau Server. To configure your Tableau Server connection, go to Server  Tableau Online.

    Connect to Tableau Server

    You will then be prompted to sign in to your Tableau Server account. Once signed in, you should see the connection in the Server section.

    Verify Tableau Server Connection
    If you’re using an on-premise instance of Tableau Server, you will need to configure SSL. This can be done by logging into the Tableau Services Manager UI and going to Configuration  Security  External SSL.
    Tableau Server SSL Configuration

    For more information on configuring SSL on your Tableau Server, follow the guide on the Configuring SSL on Tableau Server page.

    View Data from Analytic Views on Tableau

    Once Tableau has successfully established a connection with your Couchbase Server, you should see it in the Connections section. You should also see the Analytics scopes set up in the previous steps.

    Analytics Scopes in Tableau

    The collections are listed based on the tabular views created. Dragging and dropping a view onto the data pane will then display the data for the view in a table.

    Analytics Views in Tableau

    Use Couchbase Analytics Views to Build Tableau Worksheets

    Now that you have your Couchbase Analytics Tabular views set up on Tableau, you can now use these views as the data source to build your Tableau worksheets.

    From the Data Source pane, drag and drop the airline_view onto the data pane. This will bring up two views. The first view shows you details about the view including the mapping from the view column names to their corresponding document fields.

    Analytics View

    Next select Sheet1, which should now show the individual columns from the view along with a subset of the columns called Measure Values.

    Analytic Views Columns

    Drag the City column on to the Rows section to add cities to the sheet. Next, add Airport Name to the columns section. Select the drop-down and choose Measure  Count.

    Airports Per City

    This will create a simple bar graph that shows the number of airports for each city.

    Airports Per City Graph

    You can also filter your results by using the Filters section. Drag and drop the Country field into the Filters section and select the country to filter by.

    Filter Graph by Country

    Selecting France then filters out cities from the other countries.

    Filter Result

    Depending on the view you are using and the type of report you want to build, you can also select how the data is plotted by choosing one of the options in the Marks drop-down.

    Change Graph Style

    Use Couchbase Analytics Queries to Build Tableau Worksheets

    Apart from the predefined views or any other custom views you create, the Couchbase Tableau connector also supports the use of Analytics queries as the data source.

    To use Analytics queries, go to the Data Source tab and select New Custom SQL. Here you can submit queries through the Tableau Connector/JDBC driver that run in a special SQL-compatible mode where certain language constructs operate differently from the regular SQL++ execution.

    New Custom Query
    The default scope is set based on the scope if specified in the connection dialog. If no scope is explicitly mentioned, it is set to Default, however users can provide any other scope when setting up the connection. To run Analytics queries, you may specify the Analytics scope along with the collection in your queries. If no scope is specified in a query, the scope set in the connection dialog will be used. For example, to use the airline Analytics collection, use `travel-sample`.inventory.airline.

    Run Analytics Queries on Tableau

    A simple Analytics query you can execute is to get the counts of the hotels per city. In the Edit Custom SQL window, add the following query and select Preview Results.

    select
     country,
     city,
     count(id) as count
    from `travel-sample`.inventory.hotel
    group by country, city
    order by count(id) desc
    Query 1

    You can also use queries that join multiple Analytics collections. For example, to get the airlines with the most routes you can run the following query.

    select a.id,
     a.callsign,
     a.name,
     a.country,
     count(r.id) as route_count
    from `travel-sample`.inventory.airline a
    join `travel-sample`.inventory.route r on META(a).id = r.airlineid
    group by a.id, a.callsign, a.name, a.country
    order by route_count desc
    Query 2

    The previous query can be expanded upon further by getting the percentile rank of airlines with the most routes with the following query.

    select
     a.id,
     a.callsign,
     a.name,
     a.country,
     count(r.id) as route_count,
     PERCENT_RANK() OVER (
      ORDER BY count(r.id)
      ) AS `rank`
    from `travel-sample`.inventory.airline a
    join `travel-sample`.inventory.route r on META(a).id = r.airlineid
    group by a.id, a.callsign, a.name, a.country
    order by route_count desc
    limit 100
    Query 2

    Use Analytics Queries as the Data Source to Build Tableau Reports

    Once you have executed your query, you should be able to see the data from the query in a tabular form.

    Analytics Query In Table

    Go to the Sheet tab and add the name field to the Rows section and the rank field generated by the query to the Columns section. You can then click on the rank label on the graph to sort the chart in from highest to lowest rank.

    Graph Using Analytics Query As Data Source

    Publish Workbook to Tableau Server

    Once you have created your reports, you can then publish them onto Tableau Server. From the menu, select Server  Publish Workbook.

    Publish Report to Tableau Server

    Select the project to publish the workbook to and give it a name. Once you have selected the options you need, click on the Publish button.

    Publish Workbook Dialog

    Once published your browser will launch, and you will be prompted to log in to Tableau Server. Log in using you Tableau Server user account credentials.

    Tableau Server Login

    Once you are successfully logged in, you should see the workbook you created using Tableau Desktop.

    Published Workbooks

    You can click on the workbook to view it in greater detail. From this page you can also refresh the data so that your report reflects any updates made to the source.

    Published Workbook View

    Publish Data Sources to Tableau Server

    You can also publish you data source directly to Tableau Server from Tableau Desktop. This will allow users with access to your Tableau Server project to view and build their own workbooks and reports using the Couchbase Analytics data source you have set up on Tableau Desktop. From the menu, select Server  Publish Data Source.

    Publish Data Source

    Select the project to publish to and give the data source a name and hit Publish.

    Publish Data Source Dialog

    Once successfully configured, you will receive a notification on Tableau Server. Here you will be prompted to log in to Tableau Server again.

    Published Data Source

    Once logged in you should be able to see your data source. Using the data source you can then create your own workbooks and reports that use the data source set up by Tableau Server.

    Using Published Data Source