Represents metadata about a column in a table.
(Optional) The default aggregation type for this column.
(Optional) The user friendly alias of this column. If this property is omitted, the column id will be used.
(Optional) The default role of this column: dimension or measure.
(Optional) The default type of this column: discrete or continuous.
The data type of this column.
(Optional) A description of the column. This description is added to the metadata for the column and is saved when you save the workbook. You can view the column metadata in the Simulator.
(Optional) Whether the column should be used as the join filtering column in the dependent table. For more information, see Join Filtering.
Note: This feature is only supported in version 2.2 and later of the WDC.
(Optional) An object that specifies the table ID and column ID to use in join filtering to create the primary to foreign key relationship. Set this property on the column used in the dependent table (the foreign key) and point to the table ID and column ID of the primary table (the primary key). For more information, see Join Filtering.
Note: This feature is only supported in version 2.2 and later of the WDC.
For example, you might enter a foreign key object like this:
foreignKey: { "tableId": "users", "columnId": "id" }
(Optional) The default geographic role of this column.
The id of this column. Column ids must be unique within a table. The id can only contain alphanumeric (a-z, A-Z, 0-9) and underscore characters (_
). The id must match the regular expression: "^[a-zA-Z0-9_]\*$"
.
(Optional) The default number formatting for this column.
(Optional) The default units formatting for this column.
Callback function to tell Tableau that the connector has finished gathering data.
Callback function to tell Tableau the connector's init method has finished.
Callback function for reporting the tables this WDC contains. tables is a list of all tables in the connection and is required.
Callback function to tell Tableau the connector's shutdown method has finished.
The metadata for standard connections, or predefined joins.
Note: This feature is only supported in version 2.1 and later of the WDC.
An alias for the standard connection. This is the name of the connection that is displayed in Tableau Desktop.
Specifies the tables that you want to join. The table properties must match the properties defined in the table schema.
"tables": [{ "id": "The table id", "alias": "The table alias" }, { "id": "The table id", "alias": "The table alias" }]
An array of join objects which specifies which objects to join and with which join type. Each join object takes the following form:
"joins": [{ "left": { "tableAlias": "The alias for the table", "columnId": "The id for the column" }, "right": { "tableAlias": "The alias for the table", "columnId": "The id for the column" }, "joinType": "The join type, either 'inner' or 'left'" }]
var standardConnection = { "alias": "Joined earthquake data", "tables": [{ "id": "magPlace", "alias": "Magnitude and Place" }, { "id": "timeUrl", "alias": "Time and URL" }], "joins": [{ "left": { "tableAlias": "Magnitude and Place", "columnId": "id" }, "right": { "tableAlias": "Time and URL", "columnId": "id" }, "joinType": "inner" }] };
Object which is used to actually append data when creating an extract.
If this is an incremental refresh and the table supports incremental refreshes, this property will contain the largest value from the incrementColumn in the current extract. This value will be an empty string otherwise. See Incremental Refresh for details.
The metadata about this table
Called to actually append rows of data to the extract and is called in the getData
function during the Gather Data Phase. Takes either an array of arrays or an array of objects which contain the actual rows of data for the extract. The format for these match version 1 of the API.
To avoid overwhelming the data pipeline, which currently has a 128MB limit per function call, you can create a while
loop for the appendRows
function. This is important if you are working with very large data sets. The following code uses a size
variable along with the row_index
to add rows of data in size
increments. Each row in the table is assigned an index value, represented by the row_index
value. It is a best practice to also call the reportProgress
function as you add data so that Tableau can report the progress to end-users during the extract creation process. In this example, 1000 rows are added at a time. If you are working with a large data set, you might want to choose a larger size to improve performance. Each append operation needs to be under the 128MB data limit.
var row_index = 0; var size = 1000; while (row_index < tableData.length){ table.appendRows(tableData.slice(row_index, size + row_index)); row_index += size; tableau.reportProgress("Getting row: " + row_index); }
Represents metadata about a table of data
An array of columns that belong to this table.
(Optional) An alias for this table to be shown to the user. This alias is editable by the user and must be unique across all tables used in a join. If this property is omitted, the table id will be used.
(Optional) A user friendly description of the contents in this table.
A unique id for this particular table. The id can only contain alphanumeric (a-z, A-Z, 0-9) and underscore characters (_
). The id must match the regular expression: "^[a-zA-Z0-9_]\*$"
.
Note: May not contain certain characters such as a hyphen.
(Optional) The id of the column which can be used for incremental refreshes. Must be an int, date, or datetime column. See Incremental Refresh for details.
(Optional) Whether you want to make join filtering required for this table. If you set this value to true, you cannot connect to the table without first connecting to the other table. Join Filtering for details.
This is the actual interface a WDC will be asked to implement. init and shutdown are optional and will be filled in automatically if a connector does not implement these.
Called to create or update the data for a particular instance of this WDC. data is returned for each table in the connection. Once all data has been returned, the connector must call doneCallback to indicate that data gathering has finished.
Callback function to indicate data gathering is completed.
Called to retrieve the schema information for this WDC.
Called to inform Tableau about the schema.
Called first in each phase of the web data connector. See WDC Lifecycle and Phases for details. @param initCallback - Called to inform Tableau when the connector has finished initializing.
Called at the end of each phase of the web data connector. See WDC Lifecycle and Phases for details. @param shutdownCallback - Called to inform Tableau when the connector has finished shutdown.
The tableau object represents state and functionality of the Tableau product.
Current context of auth. See WDC Authentication for details.
Current type of authentication for this connector.
A string that you can use to store data between phases. For example, you might store user input that you want to use in the getData
phase. Note that this string is saved as plain text, so you should not use connectionData
to store sensitive information. For passwords or authentication tokens, use the password property.
To store and retrieve JavaScript objects with the connectionData
property, that is to serialize and deserialize objects, use JSON.stringify
and JSON.parse
.
Name of this connection.
Current locale, or locale with most similar language, of the web data connector user
You can use this property to store a password, OAuth authentication token, or other secret. This property can be a JSON object and is not written to disk.
Current phase of the web data connector.
The build number for Tableau Desktop.
Note: This feature is only supported in version 2.1 and later of the WDC.
For example, you might see a build number like this:
10100.16.1005.2001
The edition of Tableau Desktop.
Note: This feature is only supported in version 2.1 and later of the WDC.
Either pro
, standard
, or
public
.
The operating system on which Tableau Destkop is installed.
Note: This feature is only supported in version 2.1 and later of the WDC.
Either win
for Windows or mac
for MacOS.
The version of Tableau Desktop.
Note: This feature is only supported in version 2.1 and later of the WDC.
Tableau uses semantic versioning, which means that the version matches the following syntax:
major.minor.patch
For example, you might see the following version:
10.1.0
Username tied to data source, persisted in a .twb
, .twbx
, etc.
Current version of the Web Data Connector API
Called whenever the connector has invalid credentials and needs to reauthenticate its user. This method must be called from the init method during the gather data phase.
message which only shows up in logs and on Tableau Server.
Throws an error within Tableau with the passed errorMessage
message to display to the user in Tableau.
Enables cookie persistence in the current Tableau Desktop session. Cookies generated in any WDC will be made available to all WDC connections in a given Tableau Desktop session after this function is called. Once enabled, this behavior will remain in effect until Tableau Desktop is closed. This does not have an effect on WDC extract refreshes in Tableau Server.
Logs a message in the Tableau log system
Returns a new instance of a WebDataConnector.
Registers your connector with Tableau. You call this function after you have created the connector instance and attached functions to the instance.
Displays a progress message to the user while an extract is being created. For example, if you switch from the Data Source pane to a sheet, a dialog appears that displays the progress message.
Note: This feature is only supported in version 2.1 and later of the WDC.
In the getData
function of your connector, you iterate over the rows in a table where each row has an index value assigned to a variable called row_index
. You use the following code to display a progress message after every 100 rows:
if (row_index % 100 === 0) { tableau.reportProgress("Getting row: " + row_index); }
Tells Tableau that the connector has finished the interactive phase or the authentication phase. After this method is called, Tableau proceeds to the gather data phase.
This enum represents the default aggregation that can optionally be assigned as metadata for columns of the int and float dataType.
This enum represents the context in which authentication is being requested.
See WDC Authentication for details.
This enum represents the authentication type of the web data connector. See WDC Authentication for details.
This enum represents the default role of a column.
This enum represents the default type of a column.
This Enum represents the different data types available to each column
This enum represents the default geographic role that can be assigned to a column.
This enum represents the locale, or the locale with the most similar language, of the of the web data connector user.
This enum represents the default number format that can optionally be assigned as metadata for columns of the int and float dataType.
This enum represents the different phases in which a web data connector can be run. See WDC Lifecycle and Phases for details.
This enum represents the default unit format that can optionally be assigned as metadata for columns of the int and float dataType.
This API Reference contains all of the functions and objects for the WDC API version 2. WDC version 1 is no longer supported.