Skip to main content
Solved

Executing transformation from Cognite Function


Forum|alt.badge.img+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!

Best answer by tharindudg

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

View original
Did this topic help you find an answer to your question?

2 replies

  • Senior Software Engineer
  • 2 replies
  • Answer
  • April 13, 2023

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


Forum|alt.badge.img+3
  • Author
  • Committed
  • 3 replies
  • April 26, 2023

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


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings