Showing results for 
Search instead for 
Did you mean: 

How to create the data model without using sisense cli in my application using compose sdk

8 - Cloud Apps
8 - Cloud Apps,Generating%20a%20Data%20Model%20...

from the compose sdk tutorial above, the datamodel can be get by running cli. How do I achieve this dynamically in my application without running the cli? is there any sisense rest api can do this?

I'm getting the DM for building the data visualization as the tutorial provided here:


Sisense Team Member
Sisense Team Member

Hi @enmiwong 

You can use Compose SDK without generating a datamodel by dynamically creating 'attributes' using createAttribute in your code. (you'll need to import this from sdk-data)

The minimum needed is the name and expression properties, and depending on the column type you might want more control e.g. granularity and format for date columns.

Expression is a string that consists of the name of the table and column, separated by a period, and enclosed in square brackets as shown below.


value: [
            name: 'Total Revenue',
            expression: '[Commerce.Revenue]',

 Example of creating a date dimension:

    name: 'Years',
    expression: '[Commerce.Date]',
    granularity: "Years",
    format: 'yyyy'

 For more information, check this link to the docs.

Hope that helps!

Sisense Team Member
Sisense Team Member

To address your API request specifically, `sdk-cli` package uses `/api/datasources/<datasource_name>/fields/search` endpoint to grab initial datasource information which is then converted to attributes:

Note: using this endpoint will not give the final result as `sdk-cli` will, some additional code transformations will be required. `createAttribute` mentioned earlier is one of the tools that would help