Skip to content

Latest commit

 

History

History
234 lines (176 loc) · 22.1 KB

README.md

File metadata and controls

234 lines (176 loc) · 22.1 KB

Tables

(ai.tables)

Available Operations

  • list - Get a list of existing tables with metadata.
  • getMeta - Get table metadata.
  • delete - Drop table.
  • create - Create new table.

list

Get a list of existing tables with metadata.

Example Usage

import { Kx } from "kx";

const kx = new Kx({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await kx.ai.tables.list();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<errors.BadRequest>

Errors

Error Object Status Code Content Type
errors.Unauthorized 401 application/json
errors.Forbidden 403 application/json
errors.NotFound 404 application/json
errors.TooManyRequests 429 application/json
errors.InternalServerError 500 application/json
errors.ServiceUnavailable 503 application/json
errors.SDKError 4xx-5xx /

getMeta

Get table metadata.

Example Usage

import { Kx } from "kx";

const kx = new Kx({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await kx.ai.tables.getMeta("<value>");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
name string ✔️ N/A
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Table>

Errors

Error Object Status Code Content Type
errors.BadRequest 400 application/json
errors.Unauthorized 401 application/json
errors.Forbidden 403 application/json
errors.NotFound 404 application/json
errors.TooManyRequests 429 application/json
errors.InternalServerError 500 application/json
errors.ServiceUnavailable 503 application/json
errors.SDKError 4xx-5xx /

delete

Drop table.

Example Usage

import { Kx } from "kx";

const kx = new Kx({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await kx.ai.tables.delete("<value>");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
name string ✔️ N/A
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.SuccessResponse>

Errors

Error Object Status Code Content Type
errors.KdbAiTableDeleteResponseBody 400 application/json
errors.KdbAiTableDeleteAiTablesResponseBody 404 application/json
errors.SDKError 4xx-5xx /

create

Create new table.

Example Usage

import { Kx } from "kx";

const kx = new Kx({
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await kx.ai.tables.create("<value>", {
    type: "splayed",
    blockSize: 10000,
    prtnCol: "realTime",
    sortColsOrd: "sym",
    sortColsDisk: "sym",
    columns: [
      {
        name: "time",
        description: "Time",
        type: "timespan",
      },
      {
        name: "sym",
        description: "Symbol name",
        type: "symbol",
        attrMem: "grouped",
        attrDisk: "parted",
        attrOrd: "parted",
      },
      {
        name: "realTime",
        description: "Real timestamp",
        type: "timestamp",
      },
      {
        name: "price",
        description: "Trade price",
        type: "reals",
      vectorIndex:     {
            type: "flat",
            metric: "L2",
            dims: 10,
          },
      },
      {
        name: "size",
        description: "Trade size",
        type: "long",
      },
    ],
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
name string ✔️ N/A
table components.Table ✔️ An object with table metadata and list of columns
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<components.SuccessResponse>

Errors

Error Object Status Code Content Type
errors.KdbAiTableCreateResponseBody 400 application/json
errors.SDKError 4xx-5xx /