Logo
MicroStrategy REST API API Documentation

Get the SQL view of cube by cube ID

GET {{baseUrl}}/api/v2/cubes/:cubeId/sqlView

Get the SQL view of cube by Cube ID

 

Body PARAM

Key Datatype Required Description 
fields
null Comma-separated, top-level field whitelist that allows the client to selectively retrieve part of the response model. If specified, extra filtering is applied, and for top-level object (if root model is an array, each array element), only the listed fields are kept in the response. For example, "id,elements" keeps only the "id" field and whole "elements" array field, omitting all other fields in the top-level response model.



HEADERS

Key Datatype Required Description 
X-MSTR-AuthToken
string (Required) Authorization token
X-MSTR-ProjectID
string (Required) Project ID




RESPONSES

status OK

{ "sqlStatement": "select\tdistinct a11.PBTNAME AS PBTNAME\nfrom\tpublic.pmt_inventory\ta11\n\tjoin\tpublic.lu_quarter\ta12\n\t on \t(a11.quarter_id = a12.quarter_id)\nwhere\ta12.year_id in (2016)\n\n[BEGIN PARTITION SQL, all 3 branches are shown and only one will be executed]\n[1st BRANCH]\ncreate table ZZPO00 (\n\tmonth_id\tINTEGER, \n\titem_id\tSMALLINT, \n\tcall_ctr_id\tSMALLINT, \n\tWJXBFS1\tDOUBLE PRECISION)\n\n\n[2nd BRANCH]\ncreate table ZZPO00 (\n\tmonth_id\tINTEGER, \n\titem_id\tSMALLINT, \n\tcall_ctr_id\tSMALLINT, \n\tWJXBFS1\tDOUBLE PRECISION)\n\n\ninsert into ZZPO00 \nselect\ta11.month_id AS month_id,\n\ta11.item_id AS item_id,\n\ta12.call_ctr_id AS call_ctr_id,\n\ta11.eoh_qty AS WJXBFS1\nfrom\tpublic.{|Partition_Base_Table|}\ta11\n\tcross join\tpublic.lu_call_ctr\ta12\n\tjoin\tpublic.lu_month\ta13\n\t on \t(a11.month_id = a13.month_id)\nwhere\ta13.year_id in (2016)\n\n[3rd BRANCH]\ncreate table ZZPO00 (\n\tmonth_id\tINTEGER, \n\titem_id\tSMALLINT, \n\tcall_ctr_id\tSMALLINT, \n\tWJXBFS1\tDOUBLE PRECISION)\n\n\ninsert into ZZPO00 \nselect\ta11.month_id AS month_id,\n\ta11.item_id AS item_id,\n\ta12.call_ctr_id AS call_ctr_id,\n\ta11.eoh_qty AS WJXBFS1\nfrom\tpublic.{|Partition_Base_Table|}\ta11\n\tcross join\tpublic.lu_call_ctr\ta12\n\tjoin\tpublic.lu_month\ta13\n\t on \t(a11.month_id = a13.month_id)\nwhere\ta13.year_id in (2016)\n\n[END PARTITION SQL]\n\ncreate table ZZSP01 (\n\tmonth_id\tINTEGER, \n\titem_id\tSMALLINT, \n\tcall_ctr_id\tSMALLINT, \n\tWJXBFS1\tDOUBLE PRECISION)\n\n\ninsert into ZZSP01 \nselect\ta11.month_id AS month_id,\n\ta11.item_id AS item_id,\n\ta12.call_ctr_id AS call_ctr_id,\n\ta11.units_received AS WJXBFS1\nfrom\tpublic.inventory_orders\ta11\n\tcross join\tpublic.lu_call_ctr\ta12\n\tjoin\tpublic.lu_month\ta13\n\t on \t(a11.month_id = a13.month_id)\nwhere\ta13.year_id in (2016)\n\ncreate table ZZSP02 (\n\tmonth_id\tINTEGER, \n\titem_id\tSMALLINT, \n\tcall_ctr_id\tSMALLINT, \n\tWJXBFS1\tDOUBLE PRECISION, \n\tWJXBFS2\tDOUBLE PRECISION, \n\tWJXBFS3\tDOUBLE PRECISION, \n\tWJXBFS4\tDO
Curl
curl -X GET 'baseUrl/api/v2/cubes/:cubeId/sqlView?fields=' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-ProjectID: projectId'

ENDPOINTS