To work with Scriptable Worksheets, Views, tables, Answers, SpotIQ results, and Pinboards in ThoughtSpot, you can download these objects to a flat file in TML
format, modify it, and subsequently upload this file either to the same cluster, or to a different cluster. To learn how to export, change, and update Worksheets, Views, Tables, Answers, SpotIQ results, and Pinboards, see Scriptability.
Syntax of the Worksheet TML file
The TML
file for Scriptable Worksheets has a specific syntax.
See the Parameters section for details about the keywords used in this example.
You may not see each of these parameters in your own TML files, depending on whether each variable is explicitly defined. For example, if you do not have any filters on your Worksheet, the filters
parameter does not appear. You can add that variable to the TML file to specify filters for your Worksheet.
worksheet: name: <worksheet_name> description: This is a multi-line description of the worksheet Description line 2 tables: - name: <table_name_1> id : <optional_table_id_1> fqn : <optional_GUID_of_table_name_1> - name: <table_name_2> - name: <table_name_n> joins: - name: <join_name_1> source: <source_table_name> destination: <destination_table_name> type: [RIGHT_OUTER | LEFT_OUTER | INNER | OUTER] on: <on_string> is_one_to_one: [ false | true ] - ... table_paths: - id: <table_path_name_1> table: <table_name_1> join_path: - join: - <join_name_1> - id: <table_path_name_2> table: <table_name_2> join_path: - {} - id: <table_path_name_3> table: <table_name_3> join_path: - join: - <join_name_1> - join: - <join_name_2> - <join_name_3> - join: - <join_name_4> - <join_name_5> - <join_name_6> formulas: - name: <formula_name_1> expr: <formula_definition_1> [id]: <optional_unique_identifier> - name: <formula_name_2> expr: <formula_definition_2> - name: <formula_name_3> expr: <formula_definition_3> filters: - column: <filtered_column_name_1> oper: <filter_operator> values: <filtered_values> - value 1 - value 2 - value n - column: <filtered_column_name_2> worksheet_columns: - name: <column_name_1> description: <optional_column_description> column_id: <column_id_1> properties: column_type: [ MEASURE | ATTRIBUTE ] aggregation: [ SUM | COUNT | AVERAGE | MAX | MIN | COUNT_DISTINCT | NONE | STD_DEVIATION | VARIANCE] index_type: [ DONT_INDEX | DEFAULT | PREFIX_ONLY | PREFIX_AND_SUBSTRING | PREFIX_AND_WORD_SUBSTRING ] index_priority: <index_priority> synonyms : <synonym_1> <synonym_2> is_attribution_dimension : [true | false] is_additive : [ true | false ] calendar : [ default | calendar_name ] format_pattern : <format_pattern_string> currency_type : is_browser : true OR column : <column_name> OR iso_code : <valid_ISO_code> is_hidden: [ true | false ] geo_config : latitude : true OR longitude : true OR country : true OR region_name: - country : <name_supported_country> - region_name : <region_name_in_UI> spotiq_preference: <spotiq_preference_string> search_iq_preferred: [ true | false ] name: <column_name_2> description: <column_description> column_id: <column_id_2> ... properties: is_bypass_rls: [ true | false ] join_progressive: [ true | false ] guid: <worksheet_guid>
Syntax of the View TML file
The TML
file for Scriptable Views has a specific syntax.
See the Parameters section for details about the keywords used in this example.
You may not see each of these parameters in your own TML files, depending on whether each variable is explicitly defined. For example, if you do not have a description for your View, the description
parameter does not appear. You can add that variable to the TML file to specify a description for your View.
view: name: <view_name> description: This is a multi-line description of the View. Description line 2 tables: identity: - id: <table_id_1> name: <table_name_1> fqn: <optional_table_GUID_1> identity: - id: <table_id_n> name: <table_name_n> fqn: <optional_table_GUID_n> joins: - name: <join_name_1> source: <source_table_name> destination: <destination_table_name> type: [RIGHT_OUTER | LEFT_OUTER | INNER | OUTER] on: <on_string> is_one_to_one: [ false | true ] table_paths: - id: <table_path_name_1> table: <table_name_1> join_path: - {} formulas: - id: <formula_id_1> name: <formula_name_1> expr: <formula_definition_1> properties: <formula_properties_1> column_type: [ MEASURE | ATTRIBUTE ] data_type: [ BOOL | VARCHAR | DOUBLE | FLOAT | INT | BIGINT | DATE | DATETIME | TIMESTAMP | TIME ] aggregation: [ SUM | COUNT | AVERAGE | MAX | MIN | COUNT_DISTINCT | NONE | STD_DEVIATION | VARIANCE] - id: <formula_id_n> name: <formula_name_n> expr: <formula_definition_n> properties: <formula_properties_n> filters: - column: <filtered_column_name_1> oper: <filter_operator> values: <filtered_values> - value 1 - value 2 - column: <filtered_column_name_n> view_columns: - name: <column_name_1> description: <optional_column_description> column_id: <column_id_1> phrase: <phrase_string_1> properties: column_type: [ MEASURE | ATTRIBUTE ] aggregation: [ SUM | COUNT | AVERAGE | MAX | MIN | COUNT_DISTINCT | NONE | STD_DEVIATION | VARIANCE] index_type: [ DONT_INDEX | DEFAULT | PREFIX_ONLY | PREFIX_AND_SUBSTRING | PREFIX_AND_WORD_SUBSTRING ] index_priority: <index_priority> synonyms : <synonym_1> <synonym_2> is_attribution_dimension : [true | false] is_additive : [ true | false ] calendar : [ default | calendar_name ] format_pattern : <format_pattern_string> currency_type : is_browser : true OR column : <column_name> OR iso_code : <valid_ISO_code> is_hidden: [ true | false ] geo_config : latitude : true OR longitude : true OR country : true OR region_name: - country : <name_supported_country> - region_name : <region_name_in_UI> spotiq_preference: <spotiq_preference_string> search_iq_preferred: [ true | false ] name: <column_name_2> description: <column_description> column_id: <column_id_2> ... query: <query_string> guid: <view_guid>
Syntax of the table TML file
The TML
file for scriptable tables has a specific syntax.
See the Parameters section for details about the keywords used in this example.
You may not see each of these parameters in your own TML files, depending on whether each variable is explicitly defined. For example, if you did not define an index_priority
for your table, the index_priority
parameter does not appear. You can add that variable to the TML file to specify an index priority for the table.
table: name: <table_name> db: <database_name> schema: <schema_name> db_table: <database_table_name> connection: name: <connection_name> type: <connection_type> columns: - name: <column_name_1> db_column_name: <database_column_name> data_type: [ BOOL | VARCHAR | DOUBLE | FLOAT | INT32 | INT64 | DATE | TIME ] properties: column_type: [ MEASURE | ATTRIBUTE ] aggregation: [ SUM | COUNT | AVERAGE | MAX | MIN | COUNT_DISTINCT | NONE | STD_DEVIATION | VARIANCE] index_type: [ DONT_INDEX | DEFAULT | PREFIX_ONLY | PREFIX_AND_SUBSTRING | PREFIX_AND_WORD_SUBSTRING ] index_priority: <index_priority> synonyms : <synonym_1> <synonym_2> is_attribution_dimension : [true | false] is_additive : [ true | false ] calendar : [ default | calendar_name ] format_pattern : <format_pattern_string> currency_type : is_browser : true OR column : <column_name> OR iso_code : <valid_ISO_code> is_hidden: [ true | false ] geo_config : latitude : true OR longitude : true OR country : true OR region_name: - country : <name_supported_country> - region_name : <region_name_in_UI> spotiq_preference: <spotiq_preference_string> search_iq_preferred: [ true | false ] - name: <column_name_2> - name: <column_name_n> guid: <table_guid>
Syntax of the Answer TML file
The TML
file for Scriptable Answers has a specific syntax.
See the Parameters section for details about the keywords used in this example.
You may not see each of these parameters in your own TML files, depending on whether each variable is explicitly defined. For example, if you did not define any conditional formatting, the conditional_formatting
variable does not appear. You can add that variable in the TML file to specify conditional formatting.
answer: name: <answer_name> description: This is a multi-line description of the answer Description line 2 tables: - id: <table_id> name: <table_name_1> fqn : <optional_GUID_of_table_name_1> joins: - name: <join_name_1> source: <source_table_name> destination: <destination_table_name> type: [RIGHT_OUTER | LEFT_OUTER | INNER | OUTER] on: <on_string> is_one_to_one: [ false | true ] - ... table_paths: - id: <table_path_name_1> table: <table_name_1> join_path: - {} formulas: - id: <formula_id_1> name: <formula_name_1> expr: <formula_definition_1> properties: <formula_properties_1> column_type: [ MEASURE | ATTRIBUTE ] data_type: [ BOOL | VARCHAR | DOUBLE | FLOAT | INT | BIGINT | DATE | DATETIME | TIMESTAMP | TIME ] aggregation: [ SUM | COUNT | AVERAGE | MAX | MIN | COUNT_DISTINCT | NONE | STD_DEVIATION | VARIANCE] - id: <formula_id_2> name: <formula_name_2> expr: <formula_definition_2> properties: <formula_properties_2> - id: <formula_id_3> name: <formula_name_3> expr: <formula_definition_3> properties: <formula_properties_3> search_query: <search_query_string> answer_columns: - id: <column_id_1> name: <column_name_1> custom_name: <custom_name_1> - name: <column_name_2> table: table_columns: - column_id: <column_id_1> conditional_formatting: - range: min: <conditional_formatting_minimum> max: <conditional_formatting_maximum> - rule: <conditional_formatting_rule_1> range: min: <conditional_formatting_minimum> max: <conditional_formatting_maximum> color: <color_string> plotAsBand: [ true | false ] - rule: <conditional_formatting_rule_2> show_headline: [ true | false ] headline_aggregation: <headline_aggregation_string> - column_id: <column_id_2> ordered_column_ids: - column_id: <column_id_1> - column_id: <column_id_2> client_state: <client_state_string> chart: type: <chart_type> chart_columns: <chart_column_1> - column_id: <column_id_1> conditional_formatting: - rule: <conditional_formatting_rule_1> range: min: <conditional_formatting_minimum> max: <conditional_formatting_maximum> color: <color_string> plotAsBand: [ true | false ] - rule: <conditional_formatting_rule_2> - column_id: <column_id_2> axis_configs: <axis_config_1> - x: - column_id: <column_id_x_axis> - y: - column_id: <column_id_y_axis> color: - column_id: <column_id_color> axis_configs: <axis_config_2> locked: [ true | false ] client_state: <client_state_string> display_mode: <display_mode_string> guid: <answer_guid>
Syntax of the Pinboard and SpotIQ result TML file
The TML
file for Scriptable Pinboards has a specific syntax. Note that SpotIQ results are in the form of Pinboards. Use the Pinboard TML syntax to edit a SpotIQ TML file.
See the Parameters section for details about the keywords used in this example.
You may not see each of these parameters in your own TML files, depending on whether each variable is explicitly defined. For example, if you do not have any filters on your Pinboard, the filters
parameter does not appear. You can add that variable to the TML file to specify filters for your Pinboard.
pinboard: name: <pinboard_name> description: This is a multi-line description of the pinboard Description line 2 visualizations: - answer: This section includes all the Answer specification for a visualization, fromname
todisplay_mode
, in the Answer syntax section above. id: <viz_id_1> - answer: This section includes all the Answer specification for a second visualization. In this case, the visualization is a headline. id: <viz_id_2> display_headline_column: <headline_column> filters: - column: <filtered_column_name_1> oper: <filter_operator> values: <filtered_values> - value 1 - value 2 - column: <filtered_column_name_2> layout: tiles: - visualization_id: <visualization_id_1> size: <viz_id_1_size> - visualization_id: <visualization_id_2> guid: <pinboard_guid>
Parameters of TML files
- aggregation
- The default aggregation of the Worksheet, View, or Table column, or the aggregation of the output for a formula.
Aggregation options depend on the data type.
Possible values:SUM
,COUNT
,AVERAGE
,MAX
,MIN
,COUNT_DISTINCT
,NONE
,STD_DEVIATION
, andVARIANCE
Default:SUM
- answer
- Top-level container for all object definitions within an Answer.
- answer_columns
- A list of columns generated by the search query.
- axis_configs
- Specifies the columns for each axis on a chart. If you are displaying a column chart with a line chart overlaying it, for example, you would need to specify more than one
axis_config
. - calendar
- Specifies the calendar used by a date column
Can be the Gregorian calendar (default
), a fiscal calendar, or any custom calendar.
See Set up a custom calendar - chart
- Contains configuration for the Answer, if it displays in chart format.
- chart_columns
- A list of columns in the chart.
- client_state
- A JSON string with more advanced chart and table configuration.
- color
- Color to use for conditional formatting or for the columns of an Answer in chart form, in the form of a HEX value.
- column
- The id of the column being filtered on.
- columns
- The columns in the table.
- column_id
- The
id
of the Worksheet or View column.
For Answers,column_id
refers to how the column appears in the query. For example, if you sorted byQuarter
in your search, from theCommit Date
column, thecolumn_id
of the column isQuarter(Commit Date)
. - column_type
- The type of data the column represents. For a formula, the
column_type
refers to the output of the formula.
Possible values:MEASURE
orATTRIBUTE
For Worksheets, the default is:MEASURE
For formulas, the default depends on the data_type. If the data type isINT
orBIGINT
, the formula output’scolumn_type
defaults toMeasure
. If the data type isBOOL
,VARCHAR
,DOUBLE
,FLOAT
,DATE
,DATETIME
, orTIME
, the formula output’scolumn_type
defaults toAttribute
. - conditional_formatting
- Conditional formatting for the chart or table of an Answer.
- connection
- A way to identify the external data warehouse connection that the table resides in.
- currency_type
- The source of currency type
One of:
is_browser : true
infer the currency data from the locale of your browsercolumn : <column_name>
extracts the currency information from a specified columniso_code : <valid_ISO_code>
applies currency based on the ISO code; see ISO 4217 Currency Codes
- custom_name
- Optional display name for a column.
- data_type
- The data type of the formula output or column. If the data type is
INT
orBIGINT
, the formula output’scolumn_type
defaults toMeasure
. If the data type isBOOL
,VARCHAR
,DOUBLE
,FLOAT
,DATE
,DATETIME
, orTIME
, the formula output’scolumn_type
defaults toAttribute
. The possible data types areBoolean
,Text
,Date
,Datetime
,Time
,Numeric
, andDecimal
. - db
- The database that a table resides in. Note that this is not the same as the data warehouse (Falcon, Amazon Redshift, or Snowflake, for example).
- db_column_name
- The name of the column in the database. Note that this database is not the same as the data warehouse (Falcon, Amazon Redshift, or Snowflake, for example).
- db_table
- The name of the table in the database. Note that this database is not the same as the data warehouse (Falcon, Amazon Redshift, or Snowflake, for example).
- description
- The text that describes an object: a
worksheet
, aworksheet_column
,answer
,pinboard
,view
,view_column
and so on. - destination
- Name of destination table or view of the join
- display_mode
- Determines whether the Answer displays as a chart or a table. Specify either
CHART_MODE
orTABLE_MODE
. - display_headline_column
- If the visualization is a headline, this parameter specifies the column the headline comes from.
- expr
- The definition of the formula
- filters
- Contains specifications for Pinboard, View, and Worksheet filters.
- format_pattern
- The format pattern string that controls the display of a number, date, or currency column
See Set number, date, and currency formats - formulas
- The list of formulas in the Worksheet, View, or Answer.
Each formula is identified byname
, theexpr
(expression), and an optionalid
attribute. - fqn
- The table's GUID. You can find this string of letters and numbers at the end of the URL for that table. For example, in https://<company>.thoughtspot.com/#/data/tables/34226aaa-4bcf-4d6b-9045-24cb1e9437cb, the GUID is 34226aaa-4bcf-4d6b-9045-24cb1e9437cb.
- geo_config
- Specifies the geographic information of a column
One of:
latitude : true
for columns that specify the latitudelongitude : true
for columns that specify the longitudecountry : true
for columns that specify the countryregion_name
for specifying a region in a country
Uses two paired parameters:
-country: <country_name>
-region_name: <region_name_in_UI>
, which can be State, Postal Code, District, and so on.
- guid
- The GUID for the Answer, Pinboard, SpotIQ result, Table, Worksheet, or View. You can find this string of letters and numbers at the end of the URL for an object.
- headline_aggregation
- Specifies the type of headline aggregation. Can be
COUNT
,COUNT_DISTINCT
,SUM
,MIN
,MAX
,AVERAGE
, orTABLE_AGGR
. - id
- Specifies the id of an object, such as
table_paths
,formula
.
For Answers,id
refers to how the column appears in the query. For example, if you sorted byQuarter
in your search, from theCommit Date
column, theid
of the column isQuarter(Commit Date)
. Refer to Components of a Search Query to understand syntax.
For formulas within Answers,id
refers to the display name of the formula. If you do not give your formula a name, it appears as 'Untitled Formula'. - identity
- Specifies the identity of a table, based on its
name
,id
, andfqn
. - index_priority
- A value (1-10) that determines where to rank a column’s name and values in the search suggestions
ThoughtSpot prioritizes columns with higher values.
See Change a column’s suggestion priority. - index_type
- The indexing option of the Worksheet, View, or table column
Possible values:DONT_INDEX
,DEFAULT
(see Understand the default indexing behavior),PREFIX_ONLY
,PREFIX_AND_SUBSTRING
, andPREFIX_AND_WORD_SUBSTRING
Default:DEFAULT
See Index Type Values - is_additive
- Controls extended aggregate options for attribute columns
For attribute columns that have a numeric data type (FLOAT
,DOUBLE
, orINTEGER
) or a date data type (DATE
,DATETIME
,TIMESTAMP
, orTIME
)
Possible values:true
orfalse
Default:true
See Making an ATTRIBUTE column ADDITIVE - is_attribution_dimension
- Controls if the column is an attribution dimension
Used in managing chasm traps.
Possible values:true
by default,false
to designate a column as not producing meaningful attributions across a chasm trap
Default:true
See Change the attribution dimension - is_bypass_rls
- Specifies if the worksheet supports bypass of Row-level security (RLS)
Possible values:true
orfalse
Default:false
See Privileges that allow users to set, or be exempt from, RLS - is_one_to_one
- Specifies the cardinality of the join
Possible values:true
,false
Default:false
- join
- Specific join, used in defining higher-level objects, such as table paths
Defined asname
withinjoins
definition - join_path
- Specification of a composite join as a list of distinct
join
attributes
Thesejoin
attributes list relevant joins, previously defined in thejoins
, by name.
Default:{}
- join_progressive
- Specifies when to apply joins on a worksheet
Possible values:true
when joins are applied only for tables whose columns are included in the search, andfalse
for all possible joins
Default:true
See How the worksheet join rule works - joins
- List of joins between tables and views, used by the Worksheet or View.
Each join is identified byname
, and the additional attributes ofsource
,destination
,type
, andis_one_to_one.
- layout
- Specifies the Pinboard layout, in the order that a
visualization_id
is listed. - locked
- The 'automatically select my chart' option in the UI. If set to
true
, the chart type does not change, even when you add items to the query. - max
- Maximum value for conditional formatting.
- min
- Minimum value for conditional formatting.
- name
- The name of an object. Applies to
worksheet
,table
,join
,formula
,answer
,pinboard
,view
,table
,connection
and so on.
For Answers,name
refers to how the column appears in the query. For example, if you sorted byQuarter
in your search, from theCommit Date
column, thename
of the column isQuarter(Commit Date)
. Refer to Components of a Search Query to understand syntax. - on
- The keys that your tables are joined on.
- oper
- The operator of the Pinboard, View or Worksheet filter. Accepted operators are
"in"
,"not in"
,"between"
,=<
,!=
,<=
,>=
,>
, or<
. - ordered_column_ids
- A list of columns, in the order they appear in the table.
- phrase
- Phrase associated with a View column.
- pinboard
- Top-level container for all object definitions within the Pinboard or SpotIQ result.
- properties
- The list of properties of a Worksheet, Table, or View column, a Worksheet or View itself, or the properties of the output for a formula within an Answer, Worksheet, or View.
For Worksheets, Views, and Tables, each column can have the following properties, depending on its definition:column_type
,aggregation
,index_type
,is_hidden
,index_priority
,synonyms
,is_attribution_dimension
,is_additive
,calendar
,format_pattern
,currency_type
,geo_config
,spotiq_preference
, andsearch_iq_preferred
.
Worksheets and Views themselves can have the following properties that affect query generation:is_bypass_rls
, andjoin_progressive
.
For Answers, each formula's output can have the following properties, depending on its definition:column_type
andaggregation
. - plotAsBand
- Specifies whether to plot the chart conditional formatting like a band on the Visualization. This is the 'fill chart' option in the UI.
- query
- The query that the View is based on.
- range
- Range for the conditional formatting to apply to, with a specified
min
andmax
. - rule
- A conditional formatting rule.
- schema
- The schema that the table is a part of.
- search_query
- A string that represents the fully disambiguated search query. Refer to Components of a Search Query to understand syntax.
- show_headline
- Determines whether to show the headline for this column.
true
shows the headline. - size
- The size of a visualization in a Pinboard. The options are
EXTRA_SMALL
,SMALL
,MEDIUM
,LARGE
,LARGE_SMALL
,MEDIUM_SMALL
, andEXTRA_LARGE
. - source
- Name of source table or view of the join
- spotiq_preference
- Specifies whether to include a column in SpotIQ analysis. Specify
EXCLUDE
, or this property defaults to include the column in SpotIQ Analysis.
Refer to Set columns to exlude from SpotIQ analyses. - synonyms
- Alternate names for the column, used in search
See Create synonyms for a column - table
- Top-level container for all object definitions within the Table.
Specific table, used in defining higher-level objects, such as table paths.
Defined asname
withintables
definition.
For Answers, this parameter contains configuration for the Answer, if it displays in table format. - table_columns
- The columns in an Answer that is being displayed in table format.
- table_paths
- The list of table paths
Each table path is identified by theid
, and additional attributes oftable
andjoin_path
. - tables
- List of tables used by the Worksheet or Answer.
Each table is identified byname
. - type
- For Worksheets and Views, this is the join type.
Possible values:LEFT_OUTER
for left outer join,RIGHT_OUTER
for right outer join,INNER
for inner join,OUTER
for full outer join
Default:INNER
For Tables, this is the Embrace connection type.
Possible values:Snowflake
orAmazon Redshift
.
For Answers, this is the chart type
Possible values:COLUMN
,BAR
,LINE
,PIE
,SCATTER
,BUBBLE
,STACKED_COLUMN
,AREA
,PARETO
,COLUMN
,GEO_AREA
,GEO_BUBBLE
,GEO_HEATMAP
,GEO_EARTH_BAR
,GEO_EARTH_AREA
,GEO_EARTH_GRAPH
,GEO_EARTH_BUBBLE
,GEO_EARTH_HEATMAP
,WATERFALL
,TREEMAP
,HEATMAP
,STACKED_AREA
,LINE_COLUMN
,FUNNEL
,LINE_STACKED_COLUMN
,PIVOT_TABLE
,SANKEY
,GRID_TABLE
,SPIDER_WEB
,WHISKER_SCATTER
,STACKED_BAR
, orCANDLESTICK
. - values
- The values being filtered (excluded or included) in a Pinboard, View, or Worksheet.
- view
- Top-level container for all object definitions within the View.
- view_columns
- The list of columns in the View.
Each column is identified byname
,description
,column_id
,phrase
andproperties
. - visualizations
- The visualizations in a Pinboard: tables, charts, and headlines.
- visualization_id
- The id of a visualization. Used to specify the Pinboard's layout.
- worksheet
- Top-level container for all object definitions within the worksheet
- worksheet_columns
- The list of columns in the worksheet
Each worksheet is identified byname
,description
,column_id
, andproperties
.
Limitations of working with TML files
There are certain limitations to the changes you can apply by editing a Worksheet, Answer, table, View, SpotIQ result, or Pinboard through TML.
-
Formulas and columns can either have a new name, or a new expression. You cannot change both, unless migrating or updating the worksheet two times.
-
It is not possible to reverse the join direction in the TML script.
-
You cannot create new tables using Scriptability. You can only update existing tables.
-
You can only change logical tables using Scriptability. You cannot change the physical version of the table that exists in a database. When you change the
column_name
, for example, the name changes in the application, but not in the physical table in the database. -
You cannot import manually compressed .zip files. You can only import .zip files that you exported from ThoughtSpot: either an object and its associated data sources, or multiple objects of the same type that you exported from the object list page.
-
You cannot create Scriptable representations of R- or Python-powered visualizations.