(ai.tables)
- list - Get a list of existing tables with metadata.
- getMeta - Get table metadata.
- delete - Drop table.
- create - Create new table.
Get a list of existing tables with metadata.
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();
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. |
Promise<errors.BadRequest>
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 | / |
Get table metadata.
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();
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. |
Promise<components.Table>
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 | / |
Drop table.
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();
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. |
Promise<components.SuccessResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.KdbAiTableDeleteResponseBody | 400 | application/json |
errors.KdbAiTableDeleteAiTablesResponseBody | 404 | application/json |
errors.SDKError | 4xx-5xx | / |
Create new table.
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();
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. |
Promise<components.SuccessResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.KdbAiTableCreateResponseBody | 400 | application/json |
errors.SDKError | 4xx-5xx | / |