Couchbase Analytics Tabular Views
- how-to
Create Tabular Analytics Views (TAVs) from Couchbase datasets for use with Tableau.
Tableau requires data sources to be in tabular form and accessible through SQL. To meet this requirement, Couchbase provides Tabular Analytics Views (TAVs).
A TAV is a type of Analytics view that enables Couchbase Analytics to interact with software tools designed for relational databases. TAVs present data as a table with uniform rows and columns and a well-defined schema. For more information, see Tabular Analytics Views.
The following example shows how to create a TAV.
Step 1: Load the Sample Bucket
This example uses the travel-sample bucket, which comes with predefined Analytics collections and tabular views.
To load the bucket:
-
Open the Couchbase Server Web Console.
-
Go to .
-
Select
travel-sample. -
Click Load Sample Data.
Step 2: Create a Tabular Analytics View
While the travel-sample dataset includes default Tabular Analytics Views (TAVs), you can also create custom ones.
To create a TAV:
-
Open Couchbase Server Web Console and go to Analytics.
-
In the Analytics Workbench, set the scope to
travel-sample.inventory. -
Run the following statement in the Query Editor.
CREATE OR REPLACE ANALYTICS VIEW hotel_custom_view ( id STRING, name STRING, city STRING, country STRING ) DEFAULT NULL PRIMARY KEY (id) NOT ENFORCED AS SELECT meta().id AS id, name, city, country FROM hotel;This statement creates a TAV named
hotel_custom_viewin thetravel-sample.inventoryscope. The view includes theid,name,city, andcountryfields from thehotelcollection.
Step 3: Verify Analytics Collections and Tabular Views
Before connecting to Tableau, verify that your Analytics collections and tabular views are available.
-
Open Couchbase Server Web Console and go to Analytics.
-
In the Analytics Scopes pane, confirm that the default and custom views appear in the list.
-
Click the drop-down arrow next to a view name to see its schema.