Version 0.9

Skip to end of metadata
Go to start of metadata

SQL for Extracting Data

You can run SQL queries to extract data from ElastiCubes. You can either use the SQL Runner, or your own tools. Both options are explained below.

Using the SQL Runner to Extract Data from the ElastiCube

With the SQL Runner, you can run standard SQL queries on data within an ElastiCube, and see results in a JSON format.

To access the SQL Runner:

  1. Open Sisense web in a browser and log in.
  2. In your browser, add the extension sqlrunner#datasource=<ElastiCubeName> at the end of the Sisense web URL. For example: If the URL is localhost:8081, type in localhost:8081/sqlrunner#datasource=<ElastiCubeName>.
  3. Enter your sql queires in the left panel and click execute. Results will be returned in the right panel.

Using the SQL API to Extract Data from the ElastiCube

You can also run SQL queries using API calls from your own tools. The syntax below executes an SQL query against a data source, and returns json results:

site/api/datasources/[datasource-name]/sql?query=[sql-query]
For example: http://www.sitename.com/api/datasources/laptopsales/sql?query=select sales.city count(*) from sales group by sales.city

The example returns the city name and number of occurences from the sales table, and corresponds to the SQL statement below:

Select city, count(*)
From sales
Group By city

Your results can also be downloaded in a csv format by adding the &format=csv query parameter.

Example: http://beta.sisense.com/api/datasources/laptopsales/sql?query=select sales.city count(*) from sales group by sales.city&format=csv

Click here to see another example in our support forums.

 

  • No labels