Warning: Under active development. Currently only known to work on OSX and Ubuntu using LTS versions of node (v6, v8, v10). Check the issue queue for updates or to contribute improvements!
- Install the C/C++ Tableau SDK for your platform,
- You may need to install node-gyp (
npm install node-gyp -g)
- If you're on OS X, be sure XCode and command line tools are installed. You
may need to run
- Pull the SDK from npm.
npm install tableau-sdk --save,
Check the examples folder for sample usage, or see some examples below.
For simplicity, this API borrows the TableInfo
data structures from the Tableau Web Data Connector API. In addition to the data
types supported by the WDC API. Note, while the underlying C++ Extract API uses
Spatial to indicate spatial data types, the WDC API uses
geometry. We follow
that convention here too.
Create an extract and add data
let ExtractApi =tableDefinitionextract;// Define a two-column table named "Product Prices"tableDefinition =id: 'Extract'defaultAlias: 'Product Prices'columns:id: 'Product' dataType: 'string'id: 'Price' dataType: 'float';// Instantiate a new extract using the definition from above.extract = '/path/to/your.hyper' tableDefinition;// Insert data into the extract.extract;// Close the extract.extract;
Open an existing extract and add data
let ExtractApi =extract;// Open an extract that already exists.extract = '/path/to/your.hyper';// Insert data. Arrays are okay too.extract;extract;
Create a multi-table extract and add data
let ExtractApi =tablesextract;// Define a two-column table named "Product Prices"tables =products:id: 'Products'defaultAlias: 'Products'columns:id: 'ProductID' dataType: 'int'id: 'Product' dataType: 'string'id: 'Price' dataType: 'float'orders:id: 'Orders'defaultAlias: 'Product Orders'columns:id: 'OrderID' dataType: 'int'id: 'ProductID' dataType: 'int'id: 'Customer' dataType: 'string';// Instantiate a new extract and add your tables.extract = '/path/to/your.hyper';extract;extract;// Insert data into the Products table.extract;// Insert data into the Orders table.extract;// Close the extract.extract;
If your extract includes a date or datetime, you can pass the value in one of three ways:
- As a string that is in an ISO format recognized by moment.js. This is the simplest way to insert dates into to your extract
- As a string exactly conforming to either
YYYY-MM-DD HH:MM:SS. This is the most performant way to insert dates into your extract, and is recommended for very large datasets wherever possible.
- As an object instance of
moment. This may be the most performant way to insert dates into your extract in situations where you are already using the
moment.jslibrary to manipulate dates prior to insertion.
Advanced usage (native APIs)
This API provides a thin wrapper around the native C/C++ Tableau SDK that handles most use-cases. If you have more advanced use-cases (for example, if you need certain columns in your extract to be collated a certain way), it's possible for you to more directly interface with the native C/C++ API.
In those cases, the following static methods are available for you on the main SDK object:
var tableau = ;// @seetableaudataExtract;// @seetableautableDefinition;// @seetableautableRow;// Methods for converting between C/C++ and JS type constants.tableauenums;