{"id":2062,"date":"2022-05-24T04:26:50","date_gmt":"2022-05-24T09:26:50","guid":{"rendered":"https:\/\/www.dpriver.com\/blog\/?p=2062"},"modified":"2022-05-24T04:26:50","modified_gmt":"2022-05-24T09:26:50","slug":"how-to-use-gudu-sqlflow-data-lineage-tool","status":"publish","type":"post","link":"https:\/\/www.dpriver.com\/blog\/2022\/05\/how-to-use-gudu-sqlflow-data-lineage-tool\/","title":{"rendered":"How to use Gudu SQLFlow data lineage tool to analyze case-when statement\uff1f"},"content":{"rendered":"

Gudu SQLFlow<\/a> <\/strong>is a platform for analyzing data lineage. You can directly submit SQL statements online for analysis, or you can choose to connect to a specified database to obtain metadata, upload a file directory from the local, or obtain scripts from a specified git repository for analysis. In this article, we’ll introduce how to use Gudu SQLFlow data lineage tool<\/a><\/strong> to analyze column dependencies in SQL case-when statements.<\/p>\n

Gudu SQLFlow Data Lineage Tool<\/figcaption><\/figure>\n

### A simple case<\/h3>\n

Consider the following SQL:<\/p>\n

<\/p>\n

SQL returns the column teur, and its value is directly in the calculation result of case-when.<\/p>\n

In the design concept of Gudu SQLFlow, case-when is considered to be a special function, but unlike ordinary functions, it does not have arguments. Gudu SQLFlow directly analyzes the when, then, and else clauses in case when.\u00a0What needs to be considered is the when clause. The result of teur is indirectly dependent on the when clause. If different when clauses are satisfied, different then results will be returned, which will affect the return value of the final teur column. Therefore:<\/p>\n

<\/p>\n

The when clause here is very similar to the where statement, except that it affects the then clause instead of the resultset column directly.<\/p>\n

As the picture shows:<\/p>\n

teur and two when clauses: a.kamut=1 and b.teur IS null, a.kamut=1, resulting in an fdr relationship, so<\/p>\n

<\/p>\n

teur and two then clauses and else clauses produce an fdd relationship, so<\/p>\n

<\/p>\n

Among them, b.teur and teur directly have the relationship of fdd and fdr at the same time. Since the priority of the fdd relationship is higher than that of the fdr relationship, only the fdd relationship is displayed in the graph.<\/p>\n

### A slightly more complex case, with nested case-when statements<\/h3>\n

<\/p>\n

<\/p>\n

Check out the case-when statement in it.<\/p>\n

<\/p>\n

You can see that the ResultSet Column FLDR_COMPLETE is affected by a case-when statement, and the second When clause contains a case-when statement.<\/p>\n

When the case-when statement as a whole is used as a when clause, the fdd relationship of this clause is actually a part of the fdr relationship of the outer when clause, namely:<\/p>\n

<\/p>\n

Therefore, the relationship between the then clause of the inner case-when and the resultset column FLDR_COMPLETE is an fdr relationship, not an fdd relationship.<\/p>\n

As shown in the figure, the fdd columns that ultimately affect FLDR_COMPLETE are only the then statement and the else statement of the outer case-when, and the others are displayed as fdr relationships.<\/p>\n

### Conclusion<\/h3>\n

The above is an introduction to the processing flow of using Gudu SQLFlow to analyze the case-when statement. For more functions of Gudu SQLFlow, please log on to Gudu SQLFlow official website<\/a><\/strong>.<\/p>\n

As one of the best data lineage softwares<\/a><\/strong> available on the market today, Gudu SQLFlow can not only analyze SQL script files, obtain data lineage, and perform visual display, but also allow users to provide data lineage in CSV format and perform visual display.<\/p>\n","protected":false},"excerpt":{"rendered":"

Gudu SQLFlow is a platform for analyzing data lineage. You can directly submit SQL statements online for analysis, or you can choose to connect to a specified database to obtain metadata, upload a file directory from the local, or obtain scripts from a specified git repository for analysis. In this article, we’ll introduce how to use Gudu SQLFlow data lineage tool to analyze column dependencies in SQL case-when statements. A simple case Consider the following SQL: SQL returns the column teur, and its value is directly in the calculation result of case-when. In the design concept of Gudu SQLFlow, case-when\u2026<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,12],"tags":[38,35,27],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nHow to use Gudu SQLFlow data lineage tool to analyze case-when statement\uff1f<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n