Get Table Metadata

Get Metadata of a Specific Table

The metadata of a single specific table in the Data Store can be obtained by calling the getTable() method. If the operation is successful, this method can return the metadata of the table such as the details of all the columns in the table, the table scope, the details of the individual that created the table, its last modification details, and more.

The metadata of a specific table can be fetched in two different ways. The <DATA_STORE_INSTANCE> used in both the methods is the instance defined in the Data Store Instance page .

i. Get a Table by its ID

The meta data of a table of the given Data Store instance can be fetched by passing the unique table ID as the argument to the getTable() method, as shown in the code syntax below:

    
copy
<DATA_STORE_INSTANCE>.getTable( id: Long, success: (ZCatalystTable) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ZCatalystTable>>?

Parameters:

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTable(2823000000017011, //Replace this with your Table ID { table -> println("Get Table Success") println("The name of the table is: ${table.tableName}") }, { exception -> println("Get table by its ID failed! $exception") })

ii. Get a Table by its Name

Alternatively, you can fetch the meta data of a table of the given Data Store instance by passing the table name as the argument to the getTable() method, as shown in the code syntax below:

    
copy
<DATA_STORE_INSTANCE>.getTable( name: String, success: (ZCatalystTable) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ZCatalystTable>>?

Parameters:

  • name: The name of the specific table to be retrieved

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTable("EmployeeDetails", //Replace this with your table name { table -> println("Get Table Success") println("The ID of the table is: ${table.id}") }, { exception -> println("Get table failed! $exception") })

Get Metadata of all Tables

You can retrieve the metadata of all the tables in the Data Store of a Catalyst project using the getTables() method, as shown in the code syntax below. If the operation is successful, this method can return the metadata of all the tables of the given data store instance.

The <DATA_STORE_INSTANCE> used in the code below is the instance defined in the Data Store Instance page .

    
copy
<DATA_STORE_INSTANCE>.getTables( success: (List<ZCatalystTable>) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ArrayList<ZCatalystTable>

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTables( { tables -> println("Get Tables Success") for (table in tables){ println("${table.tableName}") } }, { exception -> println("Get Tables Failed! $exception") } )