Query NoSQL Table
Catalyst enables you to query a NoSQL table and retrieve data by identifying the items using the primary keys of the table. For instance, you can use just the partition key or a combination of the partition key and sort key to retrieve the item.
You can define the key condition that identifies the item by specifying the attributes, their required values, and the supported operator to be used. Refer to the help section for a list of supported operators and help on querying from the Catalyst console.
To query the data with ZCNoSQLTable Instance, the snippet below can be used.
copy//public ZCNoSQLResponseBean queryTable(ZCNoSQLPartitionKeyCondition partitionKeyCondition, boolean forwardScan, int limit) throws Exception; table.query(<ZCNoSQLPartitionKeyCondition>, <true/false>, <limit>);
To query with ZCNoSQLQueryHelper ZCNoSQLQueryHelper This class can be used to query data from the table and also specifiy other conditions, sorting order, limit etc. This can be obtained from ZCNoSQLTable instance.
copy//public ZCNoSQLQueryHelper getQueryHelper(ZCNoSQLPartitionKeyCondition partitionKeyCondition, boolean forwardScan, int limit) throws Exception; //public ZCNoSQLResponseBean queryTable() throws Exception; table.getQueryHelper(<ZCNoSQLPartitionKeyCondition>, <true/false>, <limit>).queryTable();
ZCNoSQLPartitionKeyCondition
This is used to construct partition key criteria. This is necessary to query data from the table or index.
copy//public ZCNoSQLPartitionKeyCondition(ZCNoSQLAttribute attribute, ZCNoSQLValue value) throws Exception; //public static ZCNoSQLPartitionKeyCondition getInstance(ZCNoSQLAttribute attribute, ZCNoSQLValue value) throws Exception; new ZCNoSQLPartitionKeyCondition(<ZCNoSQLAttribute>, <ZCNoSQLValue>) ZCNoSQLPartitionKeyCondition.getInstance(<ZCNoSQLAttribute>, <ZCNoSQLValue>)
Secondary Key Condition This is used to construct sort key criteria. This will be used to indicate if sort key should be used or additional sort key should be used while querying the table.
copy//public static ZCNoSQLSecondaryKeyCondition getInstance(ZCNoSQLAttribute attribute, SECONDARY_KEY_CONDITION_OPERATOR operator, ZCNoSQLValue value) throws Exception new ZCNoSQLSecondaryKeyCondition(<ZCNoSQLAttribute>, <SECONDARY_KEY_CONDITION_OPERATOR>, <ZCNoSQLValue>) ZCNoSQLSecondaryKeyCondition.getInstance(<ZCNoSQLAttribute>, <SECONDARY_KEY_CONDITION_OPERATOR>, <ZCNoSQLValue>) //public ZCNoSQLQueryHelper withSecondaryKeyCondition(ZCNoSQLSecondaryKeyCondition secondaryKeyCondition, Boolean isAdditionalSortKey) throws Exception; table.getQueryHelper(<ZCNoSQLPartitionKeyCondition>, <true/false>, <limit>).withSecondaryKeyCondition(<ZCNoSQLSecondaryKeyCondition>, <true/false>).queryTable();
Other methods available in ZCNoSQLQueryHelper
SECONDARY_KEY_CONDITION_OPERATOR This can have the values begins_with, between, equals, greater_than, less_than, greater_equal, less_equal;
Other Conditions This can be used to filter the data retrieved using partition key and sort key if specified. This will apply only on top on the data retrieved using the keys. So there can be scenarios where data maybe present for the given partition key, sort key and other conditions but to the maximum limit of 100 items, 0 items may be returned after applying the other condition along with the start key.
copy//public ZCNoSQLQueryHelper withOtherCondition(ZCNoSQLCondition otherCondition) throws Exception; table.getQueryHelper(
, , ).withOtherCondition( ).queryTable();
Start Key This is used for pagination. Upon querying data from the table/index, if more record exists, the start key will be returned. To fetch the next set of data, this value has to be set from the previous request’s response.
copy//public ZCNoSQLQueryHelper withStartKey(ZCNoSQLItem startKey); table.getQueryHelper(<ZCNoSQLPartitionKeyCondition>, <true/false>, <limit>).withStartKey(<ZCNoSQLItem>).queryTable();
Last Updated 2025-06-20 16:21:48 +0530 +0530
Yes
No
Send your feedback to us