cancel
Showing results for 
Search instead for 
Did you mean: 
ashprukh
Sisense Team Member
Sisense Team Member

How to Update Live Model Dataset Configuration Through API Call

In this article, we'll discuss how we can update Live Model query settings through API calls.

Dataset resource represents a single data source of your Datamodel - for example, if your Datamodel contains data from a mix of several CSV files and MySQL databases, each CSV file and each database will be represented by a Dataset entity. Accordingly, the Dataset entity will contain the connection information to that data source.

Unlike ElastiCube models, Live models run queries directly against the data source. With live connections, you can refresh your dashboards manually or set them to refresh automatically every few seconds. This provides you with near real-time data updates in your dashboard, meaning that in a lot of cases, the queries are only as fast as the data source. With Live connections, queries are run against the data source itself. This means that you do not have to wait for ElastiCube to finish building before you see the results. However, your data source must be able to handle the potential load of multiple refreshes.

The Live Model query settings allow configuring of how much data would be pulled from the data source, data refresh, or query timeout. More information can be found in this article.

The update of those settings can be done through UI or it could be done through API call.

The below procedure describes a process of how Live Model query settings can be updated through API call when a developer doesn’t have access to the Sisense UI portal 

All API calls done through API V2

  1. Extract dataset ID

​GET /elasticubes​/live​/by_title​/{title}

This process requires from developer to know the name of the Live Model and it is done through API 1.0

 

jcordell_0-1683646134853.png

 

Response example with dataset ID

 

jcordell_1-1683646164761.png

2. Update designated DataSet through API 2.0
PATCH /datamodels​/{datamodelId}​/schema​/datasets​/{datasetId} Update Dataset
Update a Dataset by ID.
Only the connection property can be updated.

Please note that dataset name should be changed each time the update process occurs

jcordell_2-1683646225605.png

{
  "name": "test2",
  "type": "live",
  "connection": {
    "provider": "PostgreSQL",
    "parameters": {},
    "schema": "public",
    "fileName": "null",
    "timeout": 70000,
    "autoRefresh": true,
    "refreshRate": 35000,
    "resultLimit": 2000,
    "uiParams": {},
    "globalTableConfigOptions": {}
  }
}

In this post, we went through the steps on how to update Live Model connecting string through API.

Rate this article:
Version history
Last update:
‎05-09-2023 08:37 AM
Updated by:
Contributors