Utils

Last updated on Mar 04, 2024
On This Page

The Utils class provides a set of methods to transform data, such as formatting and replacing field values. This class is often used along with other data Transformation tasks.

For each method, the following table is provided that describes the method, the type of parameter(s) that it takes as argument(s), and the data type of the object returned by it:

Definition: Contains the method definition. It consists of:
- The method name
- The arguments along with their data types
- The data type of the returned value

<Method name>(<arg 1>: <data type1>, <arg2>: <data type2>,…) → <Return value data type>.

Example: Utils.isDict(properties[‘name: str’]) → str
Description: Describes what the method does
Parameters: The variables that the method accepts as arguments
Returns: The data of the variable(s) created or acted upon by the method

List of Methods in the Utils Class

Hevo provides the following Transformation methods in the Utils class. You can use them in your script to modify the properties, and test the Transformation on sample Events before deploying it:

Definition Description
Utils.isDict Check if an object is a dictionary object
Utils.getType Retrieve the type for a value
Utils.replaceUnicode Replace Unicode values
Utils.round Round off BigDecimal values
Utils.trimUnicode Trim Unicode values
Utils.jsonStringToDict Convert JSON string to dictionary object
Utils.dictToJsonString Convert Python dictionary object to JSON string



Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Jul-14-2023 NA Updated the page to improve the readability.
Jun-26-2023 NA Created as a new document and moved the information for each method to a new page.

Tell us what went wrong