Execute Query

The zcql_service reference used in the code snippet below is the component instance created earlier. Based on the query object being passed, the response returns a row object or an array of row objects.

Construct and Execute the Query on the Primary Data Store

For the ZCQL queries to be executed on the primary Data Store, you can construct the query object and pass it to the execute_query() method as shown below. These queries can include SELECT, INSERT, UPDATE, or DELETE statements.

A sample INSERT query is shown below:

copy
#Construct the ZCQL query
query = 'INSERT into ShipmentData (productID, productName, region) VALUES (3782, A4 Reams, India)'
result = zcql_service.execute_query(query)

Construct and Execute the Query on the OLAP Database

The queries that you execute on the OLAP database must only include the SELECT statement, as direct write operations on it are not allowed. You can construct the query object and pass it to the execute_olap_query() method. A sample analytical SELECT query is shown below.

copy
//Construct the query to execute 
query = 'SELECT SUM(price) FROM ShipmentData';
result = zcql_service.execute_olap_query(query);

Parameters Used

Parameter Name Data Type Definition
query String A Mandatory parameter. Will store the query to be executed.
Info : Refer to the SDK Scopes table to determine the required permission level for performing the above operation.

Last Updated 2026-02-16 20:32:46 +0530 IST