Metadata

Application programs can use the metadata APIs to retrieve metadata information about the data grid or a specific table.

The outline of the process involved in retrieving metadata information:

  1. Your program needs to get a reference to valid connection object if you don't already have one.

    Your program needs to get a reference to a valid connection object if you do not already have one. For convenience, a program can use a table accessor method to get the reference to the parent session and then the parent connection.

  2. Call the get grid metadata API for the connection.

    This makes a network request to the data grid for the metadata information (including all tables) at that point in time.

    The program must destroy the grid metadata object after it has finished using it. If updated grid metadata is needed, the existing metadata object must be destroyed. Another request must be made using the same API to retrieve the latest metadata information.

  3. The table metadata object and any strings retrieved from it do not need to be destroyed since they are all owned by the grid metadata object and are destroyed as part of its destroy method.

Grid Metadata Object

The grid metadata object contains the array of table metadata objects that exist in the data grid at the time the request was made.

A single metadata object for a table is retrieved using its table name. If the names of the tables are not known to the program, the grid metadata object provides a method to get the array of all table names, which in turn can be used to get a single table metadata object as described previously.

Similarly, a column name or index name is used to get information about that column or index from a table metadata object. If the column names or index names are not known to the program, the table metadata object provides a method to get the array of those names.

Additionally, a method to get the primary index name exists in the table metadata object and is used to determine the table's primary index and then the column (or columns) that make up that index (often known as the primary key(s) of the table).

Related concepts