--- title: "Execute Query" url: https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/execute-zcql-query/ description: "This page describes the method to execute ZCQL queries on a table in the Data Store in your Python application with sample code snippets." last_updated: 2026-02-16T15:02:46Z service: Cloud Scale type: general related_links: - name: "Execute query - API" url: /en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery - name: "ZCQL Help" url: /en/cloud-scale/help/zcql/introduction - name: "Data Store Help" url: /en/cloud-scale/help/data-store/introduction - name: "SDK Scopes" url: /en/sdk/python/v1/sdk-scopes --- # Execute Query The `zcql_service` reference used in the code snippet below is the component instance created [earlier](https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/get-component-instance/). 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: ```javascript #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. ```javascript //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](https://docs.catalyst.zoho.com/en/sdk/python/v1/sdk-scopes) to determine the required permission level for performing the above operation.