Data blood relationship analysis method, electronic equipment, storage medium and program product

By obtaining the initial fields of the target data table in the data lineage analysis method and using the field-level data lineage table, the data lineage chain is constructed, which solves the problem of low accuracy of the data lineage chain in the existing technology and achieves a more accurate data lineage relationship. Sure.

CN118779322APending Publication Date: 2024-10-15CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410895119.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing methods for determining data lineage have low accuracy when building a data lineage chain by selecting the starting table, especially errors caused by the different sources and destinations of multiple fields.

Method used

By obtaining the initial fields of the target data table, use the preset field-level data lineage table to determine the data lineage of each initial field, build a data lineage chain based on the data flow relationship between fields, and refine it to the field level, thereby reducing errors.

Benefits of technology

It improves the accuracy of data lineage at the data table level, reduces errors caused by different sources and destinations of multiple fields, and improves the accuracy of data lineage chains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779322A_ABST
    Figure CN118779322A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data blood relationship analysis method, electronic equipment, a storage medium and a program product. The method comprises the steps of obtaining a data blood relationship analysis request, wherein the data blood relationship analysis request is used for indicating and determining the data blood relationship of a target data table; obtaining at least one initial field from the target data table; according to a preset field-level data consanguinity table, determining data consanguinity corresponding to each initial field; the field-level data blood relationship table stores a corresponding relationship between a transfer field and a relay field; and determining the data consanguinity of the target data table according to the data consanguinity corresponding to each initial field. The method is used for achieving the effect of improving the accuracy of determining the hierarchical data consanguinity of the data table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data tracing, and in particular to a data lineage analysis method, electronic device, storage medium and program product. Background Art

[0002] Data lineage refers to the natural relationship between data during its entire life cycle, from generation, processing, processing, fusion, circulation to final extinction, which records the link relationship of data generation. Through data lineage, we can clearly see how data flows and transforms between various systems, applications and tables. It assists in the accurate tracking and tracing of data, thereby effectively improving the location of data problems in big data systems and improving data quality.

[0003] The existing method of determining data lineage is to select a starting table, and then determine other data tables that have data lineage with the starting table based on the existing data lineage database between data table levels, thereby constructing a data lineage chain starting from the starting table. However, the data lineage chain at the data table level constructed in this way has low accuracy. Summary of the invention

[0004] The embodiments of the present application provide a data lineage analysis method, an electronic device, a storage medium, and a program product to achieve the effect of improving the accuracy of determining data lineage at the data table level.

[0005] In a first aspect, an embodiment of the present application provides a data lineage analysis method, comprising:

[0006] Obtaining a data lineage analysis request, where the data lineage analysis request is used to indicate the determination of data lineage of a target data table;

[0007] Acquire at least one initial field from the target data table;

[0008] According to a preset field-level data lineage table, the data lineage corresponding to each initial field is determined; the field-level data lineage table stores the correspondence between the flow field and the inheritance field, and there is a data flow relationship between the flow field and its corresponding inheritance field;

[0009] The data lineage of the target data table is determined according to the data lineage corresponding to each of the initial fields.

[0010] Optionally, the method described above, according to a preset field-level data lineage table, determines the data lineage corresponding to each initial field, including:

[0011] Determine the target fields corresponding to the initial fields according to the field-level data lineage table, wherein the target fields are fields that have a data flow relationship with the initial fields;

[0012] Each of the initial fields and the target fields corresponding to each of the initial fields are connected in series to obtain the data lineage corresponding to each of the initial fields.

[0013] Optionally, in the above method, determining the target fields corresponding to the initial fields respectively includes: performing the following operations on the initial fields respectively according to the field-level data lineage table:

[0014] Using the initial field to perform a value assignment operation on the initial source field, to obtain a flow field corresponding to the initial field;

[0015] The following steps are executed in a loop until there is no inherited field corresponding to the transfer field in the field-level data lineage table:

[0016] Perform a matching operation in the field-level data lineage table using the transfer field; obtain an inheritance field corresponding to the transfer field;

[0017] The inherited field is determined as the target field corresponding to the initial field, and the initial source field is assigned a value using the target field to obtain a transfer field corresponding to the initial field.

[0018] Optionally, in the method described above, the data lineage corresponding to the initial field includes a target field corresponding to the initial field, and a data flow order between the target field corresponding to the initial field and the initial field, and determining the data lineage of the target data table according to the data lineages corresponding to the initial fields respectively includes:

[0019] In the field-level data lineage table, the data table name of the data table to which each target field belongs is determined; the field-level data lineage table stores the data table name of the data table to which the transfer field belongs and the data table name of the data table to which the inheritance field belongs;

[0020] According to the data flow order between the target fields corresponding to the initial fields and the initial fields, the table name of the target data table and the table name of the data table to which the target fields belong are connected in series to obtain multiple blood relationship chains of the target data table;

[0021] The data lineage of the target data table is obtained according to the multiple lineage relationship chains of the target data table.

[0022] Optionally, in the above method, obtaining the data lineage of the target data table according to multiple lineage relationship chains of the target data table includes:

[0023] After deduplication, each of the blood relationship chains is merged to obtain the data blood relationship of the target data table.

[0024] Optionally, the method as described above, before determining the target fields corresponding to the initial fields respectively according to the field-level data lineage table, further comprises:

[0025] Get at least one SQL script execution log;

[0026] Obtaining at least one initial SQL statement from each of the SQL script execution logs;

[0027] Performing syntax analysis on each of the initial SQL statements to obtain the corresponding relationship between the flow-through fields and the inherited fields, the data table name of the data table to which the flow-through fields belong, and the data table name of the data table to which the inherited fields belong;

[0028] The field-level data lineage table is constructed according to the correspondence between the flow field and the inheritance field, the data table name of the data table to which the flow field belongs, and the data table name of the data table to which the inheritance field belongs.

[0029] Optionally, the method described above, performing syntax parsing on each of the initial SQL statements, includes:

[0030] Encapsulating each of the initial SQL statements respectively to obtain an abstract syntax tree corresponding to each of the initial SQL statements;

[0031] Determine the data format of each of the initial SQL statements based on each of the abstract syntax trees;

[0032] Determine the syntax parser corresponding to each of the initial SQL statements according to each of the data formats;

[0033] The syntax parsers corresponding to the initial SQL statements are used to perform syntax parsing on the initial SQL statements respectively.

[0034] Optionally, the method as described above, constructing the field-level data lineage table according to the correspondence between the flow field and the inherited field, the data table name of the data table to which the flow field belongs, and the data table name of the data table to which the inherited field belongs, includes:

[0035] The corresponding relationship between the transfer field and the inherited field, the corresponding relationship between the transfer field and the name of the data table to which it belongs, and the corresponding relationship between the inherited field and the name of the data table to which it belongs are stored in a preset data table to obtain an alternative data lineage table;

[0036] Determine the first field from the candidate data lineage table using a preset temporary table name;

[0037] Determine from the candidate data lineage table the second field corresponding to the first field and the third field corresponding to the first field; the second field is the inherited field corresponding to the first field when the first field is a flow-through field; the third field is the flow-through field corresponding to the first field when the first field is an inherited field;

[0038] Deleting, in the candidate data lineage table, the correspondence between the first field and the second field, the correspondence between the first field and the third field, and the correspondence between the first field and the name of the data table to which it belongs;

[0039] The corresponding relationship between the second field and the third field is stored in the candidate data lineage table to obtain the field-level data lineage table.

[0040] In a second aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;

[0041] The memory stores computer-executable instructions;

[0042] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0043] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0044] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementations of the first aspect.

[0045] The data lineage analysis method, electronic device, storage medium and program product provided by the embodiments of the present application determine the starting table, then determine the data lineage of each field in the starting table, and finally determine the data lineage between data table levels based on the data lineage between the fields. In this way, the data lineage constructed based on the data lineage library between data table levels is refined to be constructed based on the data lineage between fields, reducing the data lineage determination errors at the data table level caused by the different sources and destinations of multiple fields, thereby achieving the effect of improving the accuracy of determining the data lineage at the data table level. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0047] Figure 1 A schematic diagram of a scenario for building a data lineage library between data table levels provided by the prior art;

[0048] Figure 2 A flowchart of a data lineage analysis method provided in this application;

[0049] Figure 3 A schematic diagram of an operation interface of a client device capable of selecting a target data table provided by the present application;

[0050] Figure 4 A flowchart of a method for constructing a field-level data lineage table provided in this application;

[0051] Figure 5 A flowchart of another method for constructing a field-level data lineage table provided in this application;

[0052] Figure 6 A schematic diagram of the structure of the electronic device provided in this application.

[0053] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0055] It should be noted that the data involved in this application (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0056] With the development of computer technology, the era of big data has arrived. Big data, also known as massive data, is a collection of data that is so large that it far exceeds the capabilities of traditional database software tools in terms of acquisition, storage, management, and analysis. It has four major characteristics: massive data scale, fast data flow, diverse data types, and low value density.

[0057] The value of big data lies in data analysis and data mining and intelligent decision-making based on the analysis. By analyzing the data, we can discover changes in the data and the correlation between the data, explore the patterns that have been ignored in the past, obtain insights and new value, and predict human behavior, so that we can make targeted business decisions.

[0058] In order to improve the accuracy of data analysis and troubleshoot data problems, clear data lineage is needed. Data lineage can clearly show the source of data, data processing methods, mapping methods and data exports.

[0059] The existing method selects the starting table, and then determines other data tables that have data lineage with the starting table based on the existing data lineage library between the data table levels, thereby constructing a data lineage chain starting from the starting table. The data lineage library between the data table levels is used to store the correspondence between the transfer table and the inheritance table. The fields in the inheritance table are derived from the fields in the transfer table.

[0060] For example, if field A in the first data table is transferred to the second data table and becomes field B, then the first data table is a transfer table, and field A is the transfer field corresponding to field B. The second data table is an inheritance table corresponding to the first data table, and field B is the inheritance field corresponding to field A. Furthermore, field B is derived from field A. That is, field B is generated based on field A. In addition, field B and field A may be the same or different. Field B may be obtained after field A has been processed by format conversion, data cleaning, aggregation, splitting, etc., or may be obtained after field A has been added, deleted, modified, or checked.

[0061] Since there may be multiple fields in the starting table, the flow fields corresponding to each field may not belong to the same data table, and the inheritance fields corresponding to each field may not belong to the same data table. Therefore, if the data lineage chain with the starting table as the starting point is constructed only based on the data lineage library between data table levels, errors in determining the data lineage chain may occur.

[0062] For example, combined with Figure 1 As shown, Figure 1The present invention is a schematic diagram of a scenario for constructing a data lineage library between data table levels provided in the prior art. Data table A includes fields 1 and 2, data table B includes fields 3 and 4, data table C includes fields 5, 6, 7 and 8, data table D includes fields 9 and 10, and data table E includes fields 11 and 12. Among them, fields 1 and 2 in data table A flow to table C to form fields 5 and 6. Therefore, data table C is the inheritance table corresponding to data table A, and data table A is the flow table corresponding to data table C. Fields 3 and 4 in data table B flow to data table C to form fields 7 and 8. Therefore, data table C is the inheritance table corresponding to data table B, and data table B is the flow table corresponding to data table C. Fields 5 and 6 in data table C flow to data table D to form fields 9 and 10. Therefore, data table D is the inheritance table corresponding to data table C, and data table C is the flow table corresponding to data table D. Field 7 and field 8 in data table C flow into data table E, forming word 11 and field 12. Therefore, data table E is the inheritance table corresponding to data table C, and data table C is the transfer table corresponding to data table E. Based on this, the data lineage library between data table levels is obtained, and the corresponding relationship between the transfer table and the inheritance table stored in the data lineage library between data table levels is shown in Table 1.

[0063] Flow Table Inheritance Table Table A Table C Table B Table C Table C Table D Table C Table E

[0064] Table 1

[0065] If table A is used as the starting table and a data lineage chain is constructed based on the data lineage library between data table levels, the data lineage chains of table A->table C->table D and table A->table C->table E will be obtained. However, fields 1 and 2 in table A only flow to table C, and then flow to table D through table C. Therefore, table A actually only has data lineage with tables C and D, and does not have data lineage with table E. Therefore, the existing method of determining data lineage between data tables is not accurate.

[0066] In order to solve the above problems, the embodiment of the present application provides a data lineage analysis method, which determines the starting table, then determines the data lineage of each field in the starting table, and finally determines the data lineage between data table levels based on the data lineage between the fields. In this way, the data lineage constructed based on the data lineage library between data table levels is refined to be constructed based on the data lineage between fields, reducing the data lineage determination errors at the data table level caused by the different sources and destinations of multiple fields, thereby achieving the effect of improving the accuracy of determining the data lineage at the data table level.

[0067] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0068] Figure 2 A flow chart of a data lineage analysis method provided in this application, such as Figure 2 As shown, the method includes:

[0069] Step S201, obtaining a data lineage analysis request.

[0070] Specifically, a data lineage analysis request initiated by a user is received, where the data lineage analysis request is used to indicate the determination of data lineage of a target data table.

[0071] In one implementation scenario, the user can select the target data table for which data lineage needs to be determined on the client device. Since different users may have different target data tables, a client device that can select the target data table is provided so that different users can select according to their own needs and construct data lineage that meets the user's needs. For a specific schematic diagram, please refer to Figure 3 , Figure 3 A schematic diagram of an operation interface of a client device that can select a target data table is provided in an embodiment of the present application. The schematic diagram of the operation interface can be displayed through a user interaction interface of a visualization platform. Specifically, the data table selected by the user is the target data table.

[0072] Step S202: Acquire at least one initial field from the target data table.

[0073] Specifically, a field in the target data table is determined as an initial field. There are one or more fields in the target data table. If there is one field in the target data table, an initial field is obtained from the target data table; if there are multiple fields in the target data table, all the fields in the target data table are determined as initial fields, thereby obtaining multiple initial fields. This facilitates determining the data lineage corresponding to all the fields in the target data table, thereby more comprehensively determining the data lineage of the target data table.

[0074] Exemplarily, all fields in the target data table are read, and the English names of the fields are concatenated with the data table names of the target data table to form a correspondence between the initial fields and the data table names of the target data table, and the correspondence is stored in a newly created blank list.

[0075] Step S203, determine the data lineage corresponding to each initial field according to the preset field-level data lineage table, wherein the field-level data lineage table is used to store the correspondence between the flow field and the inheritance field, and the flow field and its corresponding inheritance field are a group of fields with a data flow relationship.

[0076] Exemplarily, the field-level data lineage table is shown in Table 2.

[0077]

[0078]

[0079] Table 2

[0080] Specifically, according to a preset field-level data lineage table, the data lineage corresponding to each initial field is determined, including: according to the preset field-level data lineage table, the target field corresponding to each initial field is determined. Each initial field and the target field corresponding to each initial field are connected in series to obtain the data lineage corresponding to each initial field. Among them, each initial field can correspond to one or more target fields.

[0081] Further, according to the preset field-level data lineage table, the following operations are performed on each initial field to obtain the target fields corresponding to each initial field: use the initial field to assign a value to the initial source field to obtain the transfer field corresponding to the initial field; loop the following steps until the inheritance field corresponding to the transfer field does not exist in the field-level data lineage table: use the transfer field to perform a matching operation in the field-level data lineage table; obtain the inheritance field corresponding to the transfer field; determine the inheritance field as the target field corresponding to the initial field, and use the target field to assign a value to the initial source field to obtain the transfer field corresponding to the initial field. In this way, based on the existing field-level data lineage table, the data lineage of each field in the target data table can be determined. Among them, the initial source field is a preset blank field, which is convenient for using the target field and the initial field to assign a value to the initial source field to obtain the transfer field.

[0082] Furthermore, each initial field and the target field corresponding to each initial field are connected in series, including: if there are multiple target fields corresponding to the initial field, each target field is connected in series with the initial field according to the data flow order between the target fields and the data flow order between the target field and the initial field.

[0083] Step S204, determining the data lineage of the target data table according to the data lineage corresponding to each initial field.

[0084] Specifically, the data lineage corresponding to the initial field includes the target field corresponding to the initial field and the data flow order between the target field and the initial field. According to the data lineage corresponding to each initial field, the data lineage of the target data table is determined, including:

[0085] In the field-level data lineage table, the data table name of the data table to which each target field belongs is determined; the field-level data lineage table stores the data table name of the data table to which the transfer field belongs and the data table name of the data table to which the inheritance field belongs.

[0086] According to the data flow order between the target fields corresponding to the initial fields and the initial fields, the data table name of the target data table and the data table name of the data table to which the target fields belong are connected in series to obtain multiple blood relationship chains of the target data table;

[0087] The data lineage of the target data table is obtained according to multiple lineage relationship chains of the target data table.

[0088] Furthermore, the data lineage of the target data table is obtained according to the multiple lineage relationship chains of the target data table, including: deduplication of each lineage relationship chain is combined to obtain the data lineage of the target data table. Since the data tables to which the target fields corresponding to different initial fields belong may be the same, which may lead to repeated data flows in multiple lineage relationship chains, the multiple lineage relationship chains are deduplication-processed and then combined to ensure the accuracy and uniqueness of the data lineage of the target data table.

[0089] The data lineage analysis method provided by the embodiment of the present application determines the starting table, then determines the data lineage of each field in the starting table, and finally determines the data lineage between data table levels based on the data lineage between the fields. In this way, the data lineage constructed based on the data lineage library between data table levels is refined to be constructed based on the data lineage between fields, reducing the data lineage determination errors at the data table level caused by the different sources and destinations of multiple fields, thereby achieving the effect of improving the accuracy of determining the data lineage at the data table level.

[0090] After step S204, the data lineage of the target data table is displayed. Specifically, the data lineage of the target data table is packaged in JSON format, and the packaged data lineage is sent to a terminal device with a display interface to trigger the terminal device to display the data lineage of the target data table using the display interface. In this way, the user can read the data lineage of the target data table.

[0091] Figure 4 A flowchart of a method for constructing a field-level data lineage table provided in this application is shown as follows: Figure 3 As shown, in this embodiment Figure 2Based on the embodiment, a method for constructing a field-level data lineage table is described in detail, and the method includes:

[0092] Step S401, obtaining at least one SQL (structured query language) script execution log.

[0093] The SQL script execution log is a log file that records various information during the SQL script execution process, including at least the SQL statement that needs to be executed, i.e., the initial SQL statement, the execution time, the execution result, and the error information.

[0094] Step S402: Obtain initial SQL statements from each SQL script execution log.

[0095] Here, the data of the initial SQL statement is not limited, and the initial SQL statement may be one or more. Preferably, all SQL statements to be executed in the SQL script execution log are initial SQL statements.

[0096] Step S403, parse each initial SQL statement to obtain the corresponding relationship between the transfer field and the inheritance field, the data table name of the data table to which the transfer field belongs, and the data table name of the data table to which the inheritance field belongs;

[0097] There is no limit on the number of transfer fields and inheritance fields, and the number of transfer fields and inheritance fields can be one or more, but the number of transfer fields is the same as the number of inheritance fields.

[0098] Specifically, the initial SQL statement is parsed, including: encapsulating the initial SQL statement to obtain an abstract syntax tree corresponding to the initial SQL statement; determining the data format of the initial SQL statement based on the abstract syntax tree; determining the syntax parser corresponding to the initial SQL statement according to the data format; and parsing the initial SQL statement using the syntax parser corresponding to the initial SQL statement. Since the abstract syntax tree is a structured representation of the SQL statement, it can clearly display the syntax structure of the SQL statement. Therefore, encapsulating the initial SQL statement can more accurately determine the data format of the initial SQL statement.

[0099] The syntax parser is, for example, one of an Insert into Select statement parser, an Update statement parser, and a Merge statement parser.

[0100] The Insert into Select statement analyzer is used to analyze the Insert into Select statement, and use the fields inserted into the target data table in the Insert into Select statement as the inherited fields, and use the fields selected from the source data table by the Insert into Select statement as the transfer fields. The name of the target data table is used as the name of the data table to which the inherited fields belong, and the name of the source data table is used as the name of the data table to which the transfer fields belong, to obtain the data lineage between the inherited fields and the transfer fields.

[0101] The Insert into Select statement represents selecting data from the source data table and inserting it into the target data table. The data format of the Insert into Select statement is, for example:

[0102] NSERT INTO target_table(column1, column2, column3,...);

[0103] SELECT column1, column2, column3,...;

[0104] FROM table_source;

[0105] [WHERE conditions].

[0106] Among them, table_destination is the data table name of the target data table. NSERT INTO target_table(column1, column2, column3, ...) indicates that data is inserted into columns such as column1, column2, column3, ... of the target data table. table_source is the data table name of the source data table. SELECTcolumn1, column2, column3, ... indicates that data of columns such as column1, column2, column3, ... are selected from the source data table. At the same time, the number and data of columns in the SELECT column1, column2, column3, ... statement need to be the same as the number and data of columns in the NSERT INTO target_table(column1, column2, column3, ...) statement. [WHERE conditions] is used to specify the conditions for selecting data from the source data table. In addition, the data format of the Insert intoSelect statement may not include the WHERE condition.

[0107] The Update statement analyzer is used to analyze the Update statement, taking the fields updated in the target data table in the Update statement as the inherited fields, and taking the fields selected from the source data table by the Update statement as the transfer fields. The name of the target data table is taken as the name of the data table to which the inherited fields belong, and the name of the source data table is taken as the name of the data table to which the transfer fields belong, to obtain the data lineage between the inherited fields and the transfer fields.

[0108] The Update statement represents selecting data from the source data table to update the data in the target data table or updating the data in the target data table using set data.

[0109] If the Update statement is used to select data from the source data table to update the data in the target data table, the Update statement analyzer is used to analyze the Update statement, and the fields updated in the target data table in the Update statement are used as inherited fields, and the fields selected from the source data table by the Update statement are used as flow-through fields. The name of the target data table is used as the name of the data table to which the inherited field belongs, and the name of the source data table is used as the name of the data table to which the flow-through field belongs, to obtain the data lineage between the inherited field and the flow-through field.

[0110] The data format is, for example:

[0111] UPDATE target_table;

[0112] SET target_table(column1, column2, column3,...)=table_source(column1, column2, column3,...);

[0113] FROM target_table INNER JOIN table_source;

[0114] [WHERE conditions].

[0115] Where target_table represents the name of the target data table, and table_source represents the name of the source data table; SET target_table(column1, column2, column3, ...) = table_source(column1, column2, column3, ...) represents selecting data from columns such as column1, column2, column3, ... from the source data table, and updating data from columns such as column1, column2, column3, ... in the target data table. FROMtarget_table INNER JOIN table_source represents connecting the source data table and the target data table through INNER JOIN. [WHERE conditions] is used to specify the conditions for selecting data from the source data table.

[0116] If the Update statement is used to update the data in the target data table using the set data, then the Update statement is not analyzed. The set data is, for example, data input by the user through the client device.

[0117] The Merge statement analyzer is used to analyze the Merge statement, taking the fields in the target data table in the Merge statement as the inherited fields and the fields in the source data table in the Merge statement as the transfer fields. The Merge statement represents updating or inserting the data in the target data table according to the data in the source data table to achieve data synchronization between the source data table and the target data table.

[0118] Step S404, constructing a field-level data lineage table according to the correspondence between the flow-through field and the inherited field, the data table name of the data table to which the flow-through field belongs, and the data table name of the data table to which the inherited field belongs.

[0119] Optionally, based on the correspondence between the flow field and the inherited field, the data table name of the data table to which the flow field belongs, and the data table name of the data table to which the inherited field belongs, a field-level data lineage table is constructed, including: storing the correspondence between the flow field and the inherited field, the correspondence between the flow field and the name of the data table to which it belongs, and the correspondence between the inherited field and the name of the data table to which it belongs into a preset data table to obtain a field-level data lineage table.

[0120] The method for constructing a field-level data lineage table provided by the embodiment of the present disclosure is adopted, by obtaining the initial SQL statement from the SQL script execution log, and encapsulating the initial SQL statement into an abstract syntax tree, and then determining the data format of the initial SQL statement based on the abstract syntax tree, and then determining the syntax parser corresponding to the initial SQL statement, and finally using the syntax parser corresponding to the initial SQL statement to parse the initial SQL statement to obtain field-level data lineage. In this way, the data lineage between fields can be accurately obtained.

[0121] like Figure 5 As shown, Figure 5 is a flow chart of the method for constructing a field-level data lineage table provided in this embodiment. Figure 4 Based on the embodiment, the method for constructing a field-level data lineage table according to the correspondence between the flow field and the inheritance field, the data table name of the data table to which the flow field belongs, and the data table name of the data table to which the inheritance field belongs is further described in detail. The method for constructing a field-level data lineage table provided in this embodiment may include the following steps:

[0122] Step S501, store the correspondence between the flow field and the inherited field, the correspondence between the flow field and the data table name to which it belongs, and the correspondence between the inherited field and the data table name to which it belongs into a preset data table to obtain an alternative data lineage table.

[0123] Exemplarily, the transfer field is concatenated with the name of the data table to which it belongs to obtain the source field, and the inheriting field is concatenated with the name of the data table to which it belongs to obtain the destination field. The source field and the destination field are stored in a preset data table in the form of key values ​​to obtain an alternative data lineage table. In this way, the correspondence between the inheriting field and the name of the data table to which it belongs can be known through the destination field in the alternative data lineage table. The correspondence between the transfer field and the name of the data table to which it belongs can be known through the source field. At the same time, using the source field as the key, searching in the alternative data lineage table can obtain the destination field corresponding to the source field, and then obtain the correspondence between the transfer field and the inheriting field. The storage example of the alternative data lineage table can be shown in Table 2, which will not be repeated here.

[0124] Step S502, using a preset temporary table name to determine the first field from the candidate data lineage table.

[0125] The temporary table name is used to identify and access the temporary table, and the temporary table name of each temporary table in the same SQL script execution log is unique to avoid confusion and conflict between multiple temporary tables during the execution of SQL statements. A temporary table is a data table temporarily created to store temporary data during the execution of SQL statements according to the SQL script execution log. After all SQL statements in the SQL script execution log are completed, the temporary table will be deleted.

[0126] Specifically, determining the first field from the candidate data lineage table using the preset temporary table name includes: determining the field corresponding to the temporary table name of the candidate data lineage table as the first field. The field corresponding to the temporary table name can be an inherited field or a flow field.

[0127] Furthermore, before determining the first field from the candidate data lineage table using the preset temporary table name, the method further includes: determining an abstract syntax tree including a temporary table creation statement from the abstract syntax trees corresponding to the initial SQL statements, and obtaining a temporary table name from the abstract syntax tree including the temporary table creation statement.

[0128] Step S503, determining the second field corresponding to the first field and the third field corresponding to the first field from the candidate data lineage table.

[0129] Among them, the second field is the inheritance field corresponding to the first field when the first field is a flow field; the third field is the flow field corresponding to the first field when the first field is an inheritance field.

[0130] Step S504, deleting the correspondence between the first field and the second field, the correspondence between the first field and the third field, and the correspondence between the first field and the name of the data table to which it belongs in the candidate data lineage table.

[0131] Step S505, storing the correspondence between the second field and the third field into the candidate data lineage table to obtain a field-level data lineage table.

[0132] By adopting the method for constructing a field-level data lineage table provided in this embodiment, the field-level data lineage table is obtained by processing the data related to the temporary table in the candidate data lineage table. The data in the field-level data lineage table is associated only with the data in the actual data table, but not with the temporary table, thereby reducing invalid lineage and storage, which is conducive to releasing storage resources and improving lineage tracing efficiency.

[0133] Figure 6 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 6As shown, the electronic device 600 provided in this embodiment includes: at least one processor 601 and a memory 602. Optionally, the device 600 further includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus.

[0134] In a specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, so that at least one processor 601 executes the above method.

[0135] The specific implementation process of the processor 601 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0136] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0137] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0138] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0139] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0140] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0141] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0142] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0143] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0144] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0146] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0147] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0148] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A data lineage analysis method, characterized in that: include: Obtaining a data lineage analysis request, where the data lineage analysis request is used to indicate the determination of data lineage of a target data table; Acquire at least one initial field from the target data table; According to a preset field-level data lineage table, the data lineage corresponding to each initial field is determined; the field-level data lineage table stores the correspondence between the transfer field and the inheritance field, and there is a data transfer relationship between the transfer field and its corresponding inheritance field; The data lineage of the target data table is determined according to the data lineage corresponding to each of the initial fields.

2. The data lineage analysis method according to claim 1, characterized in that: According to the preset field-level data lineage table, determine the data lineage corresponding to each initial field, including: Determine the target fields corresponding to the initial fields according to the field-level data lineage table, wherein the target fields are fields that have a data flow relationship with the initial fields; Each of the initial fields and the target fields corresponding to each of the initial fields are connected in series to obtain the data lineage corresponding to each of the initial fields.

3. The data lineage analysis method according to claim 2, characterized in that: Determining the target fields corresponding to the initial fields respectively includes: performing the following operations on the initial fields respectively according to the field-level data lineage table: Using the initial field to perform a value assignment operation on the initial source field, to obtain a flow field corresponding to the initial field; The following steps are executed in a loop until there is no inherited field corresponding to the transfer field in the field-level data lineage table: Perform a matching operation in the field-level data lineage table using the transfer field; obtain an inheritance field corresponding to the transfer field; The inherited field is determined as the target field corresponding to the initial field, and the initial source field is assigned a value using the target field to obtain a transfer field corresponding to the initial field.

4. The data lineage analysis method according to claim 1, characterized in that: The data lineage corresponding to the initial field includes a target field corresponding to the initial field, and a data flow order between the target field corresponding to the initial field and the initial field. According to the data lineage corresponding to each of the initial fields, the data lineage of the target data table is determined, including: In the field-level data lineage table, the data table name of the data table to which each target field belongs is determined; the field-level data lineage table stores the data table name of the data table to which the transfer field belongs and the data table name of the data table to which the inheritance field belongs; According to the data flow order between the target fields corresponding to the initial fields and the initial fields, the data table name of the target data table and the data table name of the data table to which the target fields belong are connected in series to obtain multiple blood relationship chains of the target data table; The data lineage of the target data table is obtained according to the multiple lineage relationship chains of the target data table.

5. The data lineage analysis method according to claim 4, characterized in that: Acquiring the data lineage of the target data table according to the multiple lineage relationship chains of the target data table includes: After deduplication, each of the blood relationship chains is merged to obtain the data blood relationship of the target data table.

6. The method according to claim 2, characterized in that Before determining the target fields corresponding to the initial fields according to the field-level data lineage table, the method further includes: Get at least one SQL script execution log; Obtaining at least one initial SQL statement from each of the SQL script execution logs; Performing syntax analysis on each of the initial SQL statements to obtain the corresponding relationship between the flow-through fields and the inherited fields, the data table name of the data table to which the flow-through fields belong, and the data table name of the data table to which the inherited fields belong; The field-level data lineage table is constructed according to the correspondence between the flow field and the inheritance field, the data table name of the data table to which the flow field belongs, and the data table name of the data table to which the inheritance field belongs.

7. The data lineage analysis method according to claim 6, characterized in that: Performing syntax analysis on each of the initial SQL statements, including: Encapsulating each of the initial SQL statements respectively to obtain an abstract syntax tree corresponding to each of the initial SQL statements; Determine the data format of each of the initial SQL statements based on each of the abstract syntax trees; Determine the syntax parser corresponding to each of the initial SQL statements according to each of the data formats; The syntax parsers corresponding to the initial SQL statements are used to perform syntax parsing on the initial SQL statements respectively.

8. The data lineage analysis method according to claim 6, characterized in that: According to the correspondence between the transfer field and the inherited field, the data table name of the data table to which the transfer field belongs, and the data table name of the data table to which the inherited field belongs, the field-level data lineage table is constructed, including: The corresponding relationship between the transfer field and the inherited field, the corresponding relationship between the transfer field and the name of the data table to which it belongs, and the corresponding relationship between the inherited field and the name of the data table to which it belongs are stored in a preset data table to obtain an alternative data lineage table; Determine the first field from the candidate data lineage table using a preset temporary table name; Determine from the candidate data lineage table the second field corresponding to the first field and the third field corresponding to the first field; the second field is the inherited field corresponding to the first field when the first field is a transfer field; the third field is the transfer field corresponding to the first field when the first field is an inherited field; Deleting the correspondence between the first field and the second field, the correspondence between the first field and the third field, and the correspondence between the first field and the name of the data table to which it belongs in the candidate data lineage table; The corresponding relationship between the second field and the third field is stored in the candidate data lineage table to obtain the field-level data lineage table.

9. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.

Citation Information

Patent Citations

  • Data blood relationship processing method and device, storage medium and equipment

    CN112084270A

  • Data processing method and device and electronic equipment

    CN114528313A

  • Data blood relationship analysis method, device and equipment and computer readable storage medium

    CN115658072A

  • Data blood relationship tracing method and device, electronic equipment and storage medium

    CN115687289A

  • Full-link field-level blood relationship analysis method, system and equipment and storage medium

    CN115934855A