Skip to main content

How to Debug and Monitor Cognite Transformations [Cognite Official]

  • May 28, 2025
  • 0 replies
  • 83 views

Gaetan  Helness
MVP
Forum|alt.badge.img+1

To ensure the reliability and accuracy of your data transformations in Cognite Data Fusion (CDF), you need to be able to effectively debug and monitor them. Here's how:

1. Debugging Transformations

  • Preview Transformation Results: Before running a transformation, use the "Preview" functionality in the CDF UI. This allows you to see a sample of the output data based on your transformation logic, without writing to the destination. This is crucial for verifying that your mapping and SQL queries are correct.AD_4nXfkbCRRi6D-Abb5D32XluGld8Qh9qEcnil49Y_XLBlRS-mPiZ5tFlQHskWVbzlLSvyYCFoGj04jZDtT31YGkoCMJACxkCqWY7SccmMSPJWdJa0la47_6mirhrVcgLiYZbQku6qZ?key=iiVGUowMb7Pb-qf58rFcrQ

 

  • Check Transformation Syntax: If you're using the SQL editor, ensure that your SQL syntax is valid. Use the formatter to help you checking the syntax.

          AD_4nXfeLEklVJymYKSZ2af566jGwpE8NN4ySKcbfMZFUb3v5ZLonK4cHrIwp3G4swOmRr98B6Y2fr01chQE2EeY4ZIPeyeLsnGAjJwIpwH37alcVuzpqw0DrGQHpWVCjbytkRMQzoBg8g?key=iiVGUowMb7Pb-qf58rFcrQ

  • Review Error Messages: When a transformation fails, CDF provides error messages. These messages can help you identify the source of the problem, such as issues with data types, missing values, or incorrect logic.AD_4nXdHC715OB4bVU-hxZv4tVMaeJ9ygEslmnU2sS0hgKDoeiIwQZn6iRxP2ivq51D0UsTOKkmNeuIXqBH2jH8L1pFdadxODRPkZhuL2_j5GlYkdW5xyxd7WSJZ-Xggqhrr3_EfC-tsjQ?key=iiVGUowMb7Pb-qf58rFcrQ

 

  • Use Cognite AI to explain the code: Cognite AI can help explaining the code and help you troubleshoot.

           AD_4nXdsyxInMTBUj459lyD9_oL-dqXOjnLbI3LVJwrOJ7BARJR9NUyeNut1_66VAf84ibKdEwlbrfSi2CDXGnhdRkxnU-Ux9QBDAyQS9hhDJV8XJJrULtvich5HOvCKZMQvxbJ3HhaPyQ?key=iiVGUowMb7Pb-qf58rFcrQ

 

  • Modularize Transformations: Break down complex transformations into smaller, more manageable parts. This makes it easier to isolate and debug specific sections of your code.
  • Test with Sample Data: Use a small, representative sample of your data to test your transformation logic. This can speed up the debugging process and make it easier to identify issues, for example add a where in your code or limit the number of data you are selecting.
  • Logging: While you don't directly control logging within the transformation SQL code itself, consider how the data being processed might indicate issues. For example, if certain values are consistently missing or out of range in the output, this could point to a problem in your transformation logic. You can always select additional data to show them in the Preview as column to troubleshoot.

2. Monitoring Transformations

  • Transformation Status: CDF provides information about the status of transformation runs, including whether they are running, completed successfully, or failed. Monitor this status to track the progress of your transformations and identify any issues.AD_4nXdPwvTfA7WH58ZWme-g1b_SgRsqLtBA4X--85auEtlQVKjbNDrwjWoivkquwNz_bdWKY37c5n-eTLZae5yjaehmmEg7_xbXVMfTZ2kY8miJoherpVNxZ25Y_JBjRo-8QlI1EeVd6Q?key=iiVGUowMb7Pb-qf58rFcrQ

 

  • Run History: Review the history of transformation runs to see how often they have been running, how long they take, and if there are any recurring failures.AD_4nXfBAX5S5WYQaHpXjwtikIRg1Dco7OXUFEzvfrHKdpqc7EPIZGMUcLxkrOhqjnWbM4yG6R53Ukmgm4lyKBKO130VH4keAjIezLAfiTvxGcWLr9v2HKSS7TAZmACx-Q94zQ571403rw?key=iiVGUowMb7Pb-qf58rFcrQ

 

  • Email Notifications: Set up email notifications for transformation failures. This will alert you to any problems so you can take corrective action promptly. You can configure these notifications in the transformation settings within the CDF UI. 

           AD_4nXfzmL4XOW1i8eVtHebWefDct-jBzLS3yK-m1_ajyufCIAm1djJKU6uUhCKgkD2b7pUpUAcuS3-hIt4ovmqrxDMLAS-MandukBu6xg7rIcx5TgjwWVZy9MEBZgATzezz0ohwHRnwEA?key=iiVGUowMb7Pb-qf58rFcrQ

         AD_4nXcPa4X3KDr2bQ8JiHPysgxivgq_xSfOngzGqebDaGR2pwkNsI-mJEQPPA8Woy0R3aK8GeVAaC9sAB5a5iKDIXmLpzUu6jR6Ty-ipRC7ETMhFEbqbqLUHov3THVsorFJUP8Jem8PHQ?key=iiVGUowMb7Pb-qf58rFcrQ

  • Data Workflows: Use Cognite Data Workflows to effectively manage your Transformations, and take advantage of built-in tooling for error handling and scheduling. Workflows provide orchestration and monitoring capabilities, allowing you to define dependencies between transformations, track their execution, and manage the overall data flow.

        AD_4nXf7Aah5DR4C4C89Tah_B855oWV29xmdg0Ed89S0fmwhwffyr6OgK5xdR5jIPy7OHix0wj-iSCAd3xiIXa9JCF5xt4fXfCXqMaueT7TIhMXsSWPjOePPaQuwGcDst5sZmOJUhyJO?key=iiVGUowMb7Pb-qf58rFcrQ

By combining these debugging and monitoring techniques, you can ensure that your data transformations in CDF are running smoothly and producing accurate, reliable data. Also refer to the built-in functions and help on writing SQL syntax, on this page https://docs.cognite.com/cdf/integration/guides/transformation/write_sql_queries

 

 

Examples

Error in the code, missing fieldAD_4nXdSD-nicVkFmQ2RirOMN1dG1GjQftC4qTrUVJXEatY1EdSo5b1PvV-YFn_8-rFffbecU4MyMqXMSeBFUh3qZxd1A4ak6RGVJfR2bUKowhiw9UyxrGlHDBS00eq2ShF3LNOdY8LT-Q?key=iiVGUowMb7Pb-qf58rFcrQ

This error indicates that the isStep field is not present in the select sql code. This will be picked up by the Preview since isStep is a mandatory field.

 

Error in the code, syntax error

AD_4nXe0y8qRviyUw2b5CWteUPmBtUxrwqd8Yjknup1IS4w2I04rleIwL0b-JMaDdMJTmQvc9g97TZPpfWtET95lT0XMA7K8kw3T_aM1vZAl1jTksONHZ0n1Gpgg_lXbymkRl_vD4-_Ibg?key=iiVGUowMb7Pb-qf58rFcrQ

This error indicates that the tostring function does not exist and cannot be used in the code.

AD_4nXdlmovFqxHcMG0K0WrDWCZJfqnNxxxA9hCgaA4XOU7bGg9nR1jadkJ4PJioE12CyCIdQgeSqdigIg32PLrzT7FCq6nDCNl58FOuQdA6jgVO1YvMiXwwmIyvvyeYR5iNF9Ern9dtPw?key=iiVGUowMb7Pb-qf58rFcrQ

This error indicates that we are missing a , on line 6 to split the fields.