Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 2.31 KB

File metadata and controls

83 lines (56 loc) · 2.31 KB

QueryApi

All URIs are relative to https://app.hotdata.dev

Method HTTP request Description
query POST /v1/query Execute SQL query

query

QueryResponse query(queryRequest)

Execute SQL query

Execute a SQL query against all registered connections and datasets. Use standard Postgres-compatible SQL to reference tables from any connection using the format `connection_name.schema.table`. Results are returned inline and a `result_id` is provided for later retrieval via the Results API. Set `async: true` to execute asynchronously — returns a query run ID for polling. Optionally set `async_after_ms` to attempt synchronous execution first, falling back to async if the query exceeds the timeout.

Example

import {
  Configuration,
  QueryApi,
} from '@hotdata/sdk';
import type { QueryOperationRequest } from '@hotdata/sdk';

async function example() {
  console.log("🚀 Testing @hotdata/sdk SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: BearerAuth
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new QueryApi(config);

  const body = {
    // QueryRequest
    queryRequest: ...,
  } satisfies QueryOperationRequest;

  try {
    const data = await api.query(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);

Parameters

Name Type Description Notes
queryRequest QueryRequest

Return type

QueryResponse

Authorization

BearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query executed successfully -
202 Query submitted asynchronously -
400 Invalid request -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]