RestBI Documentation
  • Welcome to RestBI
  • Getting Started
    • Quickstart Guide for RestBI
    • Installation
      • Docker Compose
      • Kubernetes
  • Object Definitions
    • Data Model
      • Model
      • Connection
      • Table
      • Join
      • Column
      • Formula
      • ValidationResult
    • Query
      • Query
      • QueryFilter
      • SQLResult
  • SDK
    • Overview
    • Reference
      • RestBIClient
      • executeQuery
      • getMetadata
      • validateModel
  • API
    • Overview
    • Reference
      • POST /query
      • POST /validate
      • POST /metadata
      • GET /
  • Examples
    • RestBI Demo App
      • Installation
      • Report Builder
      • Drill Anywhere
      • Model Helper
Powered by GitBook
On this page
  • Structure of SQLResult
  • Example of an SQLResult
  • How It's Used
  • See Also
  1. Object Definitions
  2. Query

SQLResult

Understanding SQL Results in RestBI

The SQLResult type is the structure that contains the data returned from executing a SQL query. This is the result that your application will use to display or further process the data retrieved from the database.

Structure of SQLResult

  • columns: string[]

    • An array of column names representing the columns in the result set. Each entry corresponds to a column in the returned rows.

  • rows: Record<string, any>[]

    • An array of row objects, where each object represents a row in the result set. The keys in each object are the column names, and the values are the corresponding data for that row.

Example of an SQLResult

Here’s an example of an SQLResult:

const result: SQLResult = {
    columns: ['OrderID', 'CustomerName', 'TotalDue'],
    rows: [
        { OrderID: 10248, CustomerName: 'Paul Jones', TotalDue: 250.75 },
        { OrderID: 10249, CustomerName: 'Mary Smith', TotalDue: 1000.00 },
        { OrderID: 10250, CustomerName: 'John Doe', TotalDue: 500.50 }
    ]
};

In this example:

  • The columns array lists the names of the columns returned by the query: CustomerID, OrderDate, and TotalDue.

  • The rows array contains individual records where each record is an object with keys corresponding to the column names.

How It's Used

When you use the SDK to execute a query against the backend service, the SQLResult is returned. You can then use this result in your application to display the data in a user-friendly format, such as in tables, charts, or other visual components.

The SQLResult format ensures that your data is organized and easy to work with, allowing you to focus on building great user experiences without worrying about the underlying data structure.

See Also

PreviousQueryFilterNextOverview

Last updated 9 months ago

- Understand how data is organized into Tables, the foundation of your database.

- Learn about the individual fields within Tables that store your data.

- Explore how to retrieve data from your database using structured Queries.

- Discover how to refine your data retrieval by applying conditions to your Queries.

Tables
Columns
Queries
Query Filters