Get a Data Table
Get metadata for a Data Table by ID.
Permissions Required
You must have View permissions to the data table for this request to succeed
Method Signature
get(id: string): Promise<DataTable>;
get(id: string, callback: (err?: Error, dataTable: DataTable) => any): void;
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The id of the Data Table to get |
callback | (err?: Error, dataTable: DataTable) => any | Optional The callback |
returns | DataTable | The requested Data Table |
Example
/*
* This example demonstrates getting a Data Table's metadata by ID
* and printing out the table's name and columns
*/
const { CatalyticClient } = require('@catalytic/sdk');
const catalytic = new CatalyticClient();
const id = 'c9f2beec-10c0-4f2f-b4e0-1d884c7e053c';
const table = await catalytic.dataTables.get(id);
console.log(table.name);
table.columns.forEach(column => console.log(`${column.name} (${column.type})`));
Updated almost 4 years ago