Get Table Metadata

Note: Ensure you have installed the required package to use this SDK method.

Using the getTableDetails() SDK method, you can get the metadata of a particular table in the Catalyst Datastore.

Get a Table’s Metadata by Table ID

A table’s metadata is fetched by referring the table’s ID, using the getTableDetails() SDK method. The datastore reference used in the following code snippet is the component instance.

copy
const datastore = new Datastore();
const table = await datastore.getTableDetails(20660000000012118);
console.log(table);

Example of Expected Response

You have the choice to convert the resultant promise (table metadata) to either a string or JSON output by accessing the .toString() or .toJSON() methods.

copy
{
  project_id:{
    project_name:"AlienCity",
    id:"2136000000007733"
  },
  table_name:"AlienCity",
  modified_by:{
    zuid:"66466723",
    is_confirmed:false,
    email_id:"emma@zylker.com",
    first_name:"Amelia",
    last_name:"Burrows",
    user_type:"Admin",
    user_id:"2136000000006003"
  },
  modified_time:"Aug 13, 2021 01:47 PM",
  column_details:[
    {
      table_id:"2136000000007781",
      column_sequence:"1",
      column_name:"ROWID",
      category:1,
      data_type:"bigint",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:false,
      column_id:"2136000000007784"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"2",
      column_name:"CREATORID",
      category:1,
      data_type:"bigint",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007786"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"3",
      column_name:"CREATEDTIME",
      category:1,
      data_type:"datetime",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007788"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"4",
      column_name:"MODIFIEDTIME",
      category:1,
      data_type:"datetime",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007790"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"5",
      column_name:"CityName",
      category:2,
      data_type:"varchar",
      max_length:"100",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:true,
      search_index_enabled:true,
      column_id:"2136000000008503"
    }
  ],
  table_id:"2136000000007781"
}

Get a Table’s Metadata By Table Name

A table’s metadata is fetched by referring the name of the table, using the getTableDetails() SDK method. The datastore reference used in the following code snippet is the component instance.

Note: If you change the name of your table at any point, you will need to ensure that the same change is reflected in your codebase in places where you have referred to the required table using the table's name.
copy
//Get a Single Table's details using the table name 
const datastore = new Datastore(); 
const table = await datastore.getTableDetails('VendorSystems');
console.log(table);

Example of Expected Response

You have the choice to convert the resultant promise (table metadata) to either a string or JSON output by accessing the .toString() or .toJSON() methods.

copy
{
  project_id:{
    project_name:"AlienCity",
    id:"2136000000007733"
  },
  table_name:"AlienCity",
  modified_by:{
    zuid:"66466723",
    is_confirmed:false,
    email_id:"emma@zylker.com",
    first_name:"Amelia",
    last_name:"Burrows",
    user_type:"Admin",
    user_id:"2136000000006003"
  },
  modified_time:"Aug 13, 2021 01:47 PM",
  column_details:[
    {
      table_id:"2136000000007781",
      column_sequence:"1",
      column_name:"ROWID",
      category:1,
      data_type:"bigint",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:false,
      column_id:"2136000000007784"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"2",
      column_name:"CREATORID",
      category:1,
      data_type:"bigint",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007786"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"3",
      column_name:"CREATEDTIME",
      category:1,
      data_type:"datetime",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007788"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"4",
      column_name:"MODIFIEDTIME",
      category:1,
      data_type:"datetime",
      max_length:"50",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:false,
      search_index_enabled:true,
      column_id:"2136000000007790"
    },
    {
      table_id:"2136000000007781",
      column_sequence:"5",
      column_name:"CityName",
      category:2,
      data_type:"varchar",
      max_length:"100",
      is_mandatory:false,
      decimal_digits:"2",
      is_unique:true,
      search_index_enabled:true,
      column_id:"2136000000008503"
    }
  ],
  table_id:"2136000000007781"
}

Get Metadata of all Tables

The getAllTables() SDK method can be used to retrieve the metadata of all the tables in the Catalyst project. The datastore reference used in the following code snippet is the component instance.

copy
const datastore = new Datastore();
const tables = await datastore.getAllTables();
console.log(tables);

Example of Expected Response

The promise (metadata of all the tables) here will be resolved to an array of table meta details.

copy
[
  {
    project_id:{
      project_name:"AlienCity",
      id:"2136000000007733"
    },
    table_name:"AlienCity",
    modified_by:{
      zuid:"66466723",
      is_confirmed:false,
      email_id:"emma@zylker.com",
      first_name:"Amelia",
      last_name:"Burrows",
      user_type:"Admin",
      user_id:"2136000000006003"
    },
    modified_time:"Aug 13, 2021 01:47 PM",
    table_id:"2136000000007781"
  },
  {
    table_name:"CityDetails",
    modified_by:{
      zuid:"66466723",
      is_confirmed:false,
      email_id:"emma@zylker.com",
      first_name:"Amelia",
      last_name:"Burrows",
      user_type:"Admin",
      user_id:"2136000000006003"
    },
    modified_time:"Aug 13, 2021 01:47 PM",
    table_id:"2136000000009090"
  }
]

Last Updated 2026-07-02 14:51:41 +0530 IST