cancel
Showing results for 
Search instead for 
Did you mean: 

Get a list of Datasets in an elasticube with ComposeSDK

francoisvv
9 - Travel Pro
9 - Travel Pro

I want to create a dropdown containing all the tables/datasets within a specific elasticube with React.  I created a dropwdown that I can populate all the elasticubes in my instance with, but I want to be able to see the list of datasets from that elasticubes but I am struggling to find the api end-point or if there is another way.  Ideally would then also like to be able to build a table, containing all the data from that table, once selected, but trying to take it one step at a time 🙂  Any advise would be greatly appreciated.

7 REPLIES 7

steve
Sisense Team Member
Sisense Team Member

Hi @francoisvv 

We're hoping to add some things in future that could make some of this easier, but for now if you're using React then you can try using useFetch with /api/datasources/<modelname>/fields/search API

Here's a quick / basic example, hope it helps

import { useFetch } from "@sisense/sdk-ui";
import { measureFactory } from "@sisense/sdk-data";

const CodeExample = () => {
  const { data, isLoading, error } = useFetch<unknown, Error>(
    "api/datasources/Sample%20ECommerce/fields/search",
    {
      method: "POST",
      body: JSON.stringify({
        offset: 0,
        count: 50,
      }),
    }
  );

  data && console.log(data);

  return (
    <>
      {data &&
        data.map((row) => (
          <p>
            Table: {row.table}, Dim: {row.id}, Title: {row.title}
          </p>
        ))}
    </>
  );
};

export default CodeExample;

Ok great, thanks a lot for this valuable information!  I played around but I still can't get the data to load successfully. I attached my code if it will provide some clarity and thanks so very much for your insights!  Greatly appreciated!

Hey @francoisvv ,

Additionally to the API shared by @steve , please consider using the Data Model api's in version 2.0.

  1. GET​ /datamodels​/schema
  2. GET​ /datamodels​/{datamodelId}​/schema

Each API contain the Datasets, Tables and Columns information

Best Regards

Assaf

Hey Assaf,  I tried the suggested but I could not get it working though.  I am still experimenting with both suggestions, but have not yet gotten it to work.

DRay
Community Team Leader
Community Team Leader

Hello @francoisvv,

I’m following up to see if the solution offered by @steve and @AssafHanina worked for you.

If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.

Thank you.

David Raynor (DRay)

Hey David,

Thanks for following up.  Currently I have not gotten it to work with the suggested solutions.

DRay
Community Team Leader
Community Team Leader

Hi @francoisvv,

I'm sorry to hear that. Would you like me to get the ball rolling on finding a technical resource to work with you directly to help get this implemented?

David Raynor (DRay)