Logo
MicroStrategy REST API API Documentation

Update a logical table

PATCH {{baseUrl}}/api/model/tables/:tableId

This API updates a detailed definition for a specified (logical) table in the changeset.

For a normal logical table or a warehouse partition mapping table, you can update the following: the logical table name in the information field, isTrueKey, logicalSize, isLogicalSizeLocked, primaryDatasource, secondaryDatasource field, prompt ids in sapHanaParameters field, physical table object name, physical table name, and the table prefix in physicalTable field. When the primaryDatasource or secondaryDatasource of this logical table is updated, the related primaryDatasource or secondaryDatasource of all other logical tables that share the same physical table with this logical table are updated.

For a freeform SQL table, you can update the following: the logical table name in the information field, isTrueKey, logicalSize, isLogicalSizeLocked, primaryDatasource, encloseSqlInParentheses field, physical table object name, sqlStatement, and columns in physicalTable field. The primaryDatasource change will not affect other logical tables that share the same physical table with this logical table.

For a metadata partition mapping table, you can update the logical table name in the information field, logicalSize, isLogicalSizeLocked, partition base tables and their partition filters in partitionTables field.

For all kinds of tables, the table name cannot be duplicated within the project.

The response contains the updated definition and specific field information of the logical table.

A changeset ID is required to execute the request and can be obtained using the changeset creation API. An authorization token is required to execute the request and can be obtained using Authentication endpoints.

To update the detailed definition for the specified table to metadata, commit using the POST /model/{changesetId}/commit API.

 

Body PARAM

Key Datatype Required Description 
columnMergeOption
string Defines a column merge option. For example, say a project includes a table named Table1 and a column named C1 whose data type is char(1). You add Table2, which has a C1 column with char(4). To be consistent, columns' data types are modified in following ways: * reuse_any: Updates the column data type to use the most recent column definition. In the example above, the column data type for C1 is changed to char(4) since Table2 was added after Table1. * reuse_compatible_data_type: Updates the column data type to use the data type with the largest precision or scale. In the example above, the column data type for C1 is changed to char(4), as defined in Table2. * reuse_matched_data_type: Renames the column in newly added table to allow it to have different data types. In the example above, column C1 uses char(1) for Table1. Column C1 in Table2 is defined as a separate copy of C1 and uses char(4). This option can cause unwanted schema changes and should be used only when necessary. If this value is not set, use the option that set on DBRole catalog setting.
fields
null A comma-separated, top-level field whitelist that allows the client to selectively retrieve part of the response model. By default, all fields are returned. If specified, extra filtering is applied, and for the top-level object (if the root model is an array, each array element), only the listed fields are kept in the response. For example, "information,logicalSize" keeps only the "information" and "logicalSize" fields, omitting all other fields in the top-level response model.
showFilterTokens
boolean Specify whether "qualification" is returned in "tokens" format, along with "text" and "tree" formats. A filter's "qualification" is presented in the following formats: * "text": A human readable, but non-parsable text, describing a filter's qualification. * "tree": A tree data structure fully defining the filter's qualification. * "tokens": A list of parsed tokens that define a filter's qualification. Be aware that generating tokens requires additional time. If omitted or `false`, only "text" and "tree" formats are returned. If `true`, all "text", "tree" and "tokens" formats are returned.
showExpressionAs
string
Curl
curl -X PATCH 'baseUrl/api/model/tables/:tableId?columnMergeOption=reuse_compatible_data_type&fields=&showFilterTokens=true&showExpressionAs=tree' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-MS-Changeset: rd_changesetId' -d '{"information":{"name":"new Table"},"primaryDataSource":{"objectId":"DAD6CAD6457DAF29E34463961688EA60"},"physicalTable":{"tableName":"lu_inspection_question_photo","namespace":"public"}}'

ENDPOINTS