Utils
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 |
Last updated on Mar 04, 2024