Solved

Executing transformation from Cognite Function

  • 31 March 2023
  • 2 replies
  • 101 views

Badge +3

Is it a good practice to execute transformations from a Cognite Function?

Our team implemented a Cognite Function which executes transformations on tables from Cognite RAW. We chose this solution as we wanted to parametrize the SQL query of the transformation, essentially applying a different filter on raw tables every time.

Also, it would easier for the end user, e.g. a plant operator, to provide a JSON input to the function then to edit the query every time in multiple locations. E.g., if the JSON is:

{
"plant": "Plant.1",
"equipment": "equipment.1"
}

the user can just change the ID for the plant and equipment. Furthermore, these values can be validated by the function before making the replacements in the query and executing the updated transformations.

Let me know your thoughts!

icon

Best answer by tharindudg 13 April 2023, 14:47

View original

2 replies

Yes this can be done. In my personal opinion, I’m not sure that its the best choice. 
Why is it not possible to create a RAW table that include the filter criteria as columns and use sql joins to enforce those values?
In order to change the filter criteria you can change the data of the filter table? 🤔 
EDIT: A CDF Event can also be created with metadata

Badge +3

The end user will have limited or no access to RAW, and each end user will use a different filter every time they generate their own data. Plus, editing tables in RAW is not user friendly. It is much more easier to change the JSON input of a Cognite function, where the validity of the user input can also be checked.

Reply