Package Exports
- tableau-sdk
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tableau-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Tableau SDK (Node.js)
The unofficial port of the Tableau SDK (Tableau Data Extract API and Tableau Server API) for Node.js. Create Tableau Data Extracts and publish them to Tableau Server and Tableau Online using JavaScript!
Installation
Warning: Under active development. Currently only known to work on OSX 10.9. Check the issue queue for updates.
Install the C/C++ Tableau SDK for your platform.
- Install the C/C++ Tableau SDK for your platform.
- Pull the SDK from npm.
npm install tableau-sdk --save.
Usage
Check the examples folder for sample usage, or see some simple examples below.
The API currently very closely mirrors the C++ API, whose reference docs can be found here.
Create an extract and add data
var tableau = require('tableau-sdk'),
enums = tableau.enums,
extract,
tableDef,
table,
row;
// Define your two-column table.
tableDef = tableau.tableDefinition();
tableDef.addColumn('Product', enums.type('CharString'));
tableDef.addColumn('Price', enums.type('Double'));
// Create an extract at /path/to/your.tde
extract = new tableau.extract('/path/to/your.tde');
// Add your table definition to the extract.
table = extract.addTable('extract', tableDef);
// Create a row of data.
row = tableau.tableRow(tableDef);
row.setCharString(0, '12 oz Latte');
row.setDouble(1, 3.99);
// Insert the row into the extract.
table.insert(row);
// Close the extract.
extract.close();Publish a TDE to Tableau Server
var tableau = require('tableau-sdk'),
serverConnection;
// Instantiate the server connection.
serverConnection = tableau.serverConnection();
// Connect to the server.
serverConnection.connect('http://localhost', 'username', 'password', 'siteId');
// Publish your.tde to the server under the default project, named My-TDE.
serverConnection.publishExtract('/path/to/your.tde', 'default', 'My-TDE', false);
// Disconnect from the server and close the connection.
serverConnection.disconnect();
serverConnection.close();