Systems and methods for graph-based query analysis
By generating fine-grained query graphs and aggregated attribute graphs, the problem of cross-system data lineage analysis in existing technologies is solved, and efficient and detailed data lineage report generation is achieved.
Patent Information
- Application Number
- CN201980062106.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-09-20
- Filing Date
- 2019-09-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2039-09-19
AI Technical Summary
Existing data lineage tools are often specific to certain database management systems, making it difficult to perform fine-grained data lineage analysis across systems, and they also have a high false positive rate.
By generating fine-grained query graphs, database queries are parsed to detect data entities and flows, data lineage analysis is performed using graph databases, aggregated attribute graphs are generated, and visualization reports are output.
It enables fine-grained data lineage analysis across systems, reduces false alarm rates, and provides detailed data lineage reports.
Smart Images

Figure CN112753029B_ABST
Abstract
Description
[0001] Cross-references to related applications
[0002] This application claims priority to U.S. Provisional Patent Application No. 62 / 733,998, filed September 20, 2018, entitled "Systems and Methods for Graph-Based Query Analysis," the entire contents of which are incorporated herein by reference. Technical Field
[0003] This invention relates to data lineage management, and more specifically, to a system and method for graph-based query analysis for fine-grained data lineage management. Background Technology
[0004] Data lineage is the genetic makeup of data; it describes what happens to data as it undergoes different processes and data operations. More specifically, data lineage makes analytics pipelines visible and simplifies the process of tracing the origins of errors. Now, businesses can use data lineage analysis to discover potential causal relationships when anomalies are detected in the final data reports, or to assess the impact of data table modifications. Such data management and analysis tasks are crucial for maintaining the smooth operation of the business.
[0005] In a "big data" environment, enterprises may have numerous data sources that need to be merged, connected, and filtered to generate data reports regularly, which increases the complexity of maintaining data lineage. Therefore, tools for representing, managing, and evaluating data lineage are essential for companies. Summary of the Invention
[0006] Various examples will now be described to briefly introduce some concepts, which will be further described in the detailed embodiments. This summary is not intended to identify key or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter.
[0007] According to a first aspect of the present invention, a computer-implemented method for determining data lineage based on a database query is provided. A received database query is parsed to detect multiple data entities associated with multiple data streams. A query graph is generated based on the received database query. The query graph includes multiple nodes connected by edges. The multiple nodes correspond to the multiple data entities, and the edges correspond to the multiple data streams. A data lineage query is retrieved from memory. The data lineage query includes one or more data entities from the multiple data entities associated with the multiple nodes within the generated query graph. A representation of the generated query graph is output based on the data lineage query.
[0008] In a first implementation of the method provided in the first aspect, at least one second query graph is retrieved, wherein the second query graph includes at least one node shared with the generated query graph.
[0009] In a second implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the at least one node shared with the generated query graph includes at least one of the following: a data table, a table column, a data view, a query result set, and a user-defined function. In this respect, by modeling user-defined tables, columns, and data transformations (including user-defined functions) during the generation of the query graph, fine-grained operations can be involved in the graph, thereby allowing fine-grained data analysis associated with data lineage.
[0010] In a third implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, a combined attribute graph is generated based on the query graph and the second query graph. The combined attribute graph traces the data lineage of the data from a starting node within the query graph through the at least one shared node and terminates at the node that outputs the final representation of the data. In this regard, the query graph can be aggregated by merging vertices / nodes referencing the same entities (e.g., data tables, UDFs, etc.), which helps generate an aggregated attribute graph so that all influencing paths are naturally presented in a lineage graph with high-performance access optimization. Furthermore, another benefit is that data lineage analysis can be performed on the aggregated lineage graph to generate a more detailed data lineage report, which can be generated based on the data lineage query performed in conjunction with the aggregated attribute graph.
[0011] In a fourth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the combined attribute graph is used and a graph visualization or JavaScript Object Notation (JSON) is output based on the data lineage query. The graph visualization is based on at least a portion of the combined attribute graph, the at least a portion including nodes corresponding to the plurality of data entities referenced in the query.
[0012] In a fifth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the data lineage query is converted into one or more graph query languages compatible with the generated query graph.
[0013] In a sixth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, multiple attributes of the plurality of data entities are detected. The plurality of nodes corresponding to the plurality of data entities are associated with the plurality of attributes.
[0014] In a seventh implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the received database query is verified before the parsing. The verified query is executed to generate a query report.
[0015] In an eighth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the execution of the verified query and the generation of the query graph are performed simultaneously.
[0016] In a ninth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, one or more of the plurality of data streams are detected to be associated with data operations that manipulate the data without affecting the query report.
[0017] In a tenth implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, one or more data streams from the plurality of data streams are excluded from the query graph.
[0018] In an eleventh implementation of the method provided by the first aspect or any of the foregoing implementations of the first aspect, the database query includes a nested query, and one of the plurality of nodes in the query graph is associated with a structured query language (SQL) operation of the nested query.
[0019] According to a second aspect of the present invention, an apparatus is provided, the apparatus including a memory and one or more processors, wherein the memory includes instructions, and the one or more processors communicate with the memory. The one or more processors execute the instructions to perform operations including: parsing a received database query to detect a plurality of data entities associated with a plurality of data streams; generating a query graph based on the received database query, the query graph including a plurality of nodes connected by edges; the plurality of nodes corresponding to the plurality of data entities, the edges corresponding to the plurality of data streams; retrieving a data lineage query from the memory, wherein the data lineage query includes one or more data entities among the plurality of data entities associated with the plurality of nodes within the generated query graph; and outputting a representation of the generated query graph based on the data lineage query.
[0020] In a first implementation of the device provided in the second aspect, the one or more processors execute the instructions to perform an operation further comprising retrieving at least one second query graph. The second query graph includes at least one node shared with the generated query graph.
[0021] In a second implementation of the device provided in the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further comprising generating a combined attribute graph based on the query graph and the second query graph.
[0022] In a third implementation of the device provided by the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further comprising using the combined property graph and querying according to the data lineage to output a graph visualization or JavaScript Object Notation (JSON).
[0023] In a fourth implementation of the device provided in the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further including detecting multiple attributes of the plurality of data entities.
[0024] In a fifth implementation of the device provided in the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further comprising attaching the plurality of attributes to the plurality of nodes corresponding to the plurality of data entities.
[0025] In a sixth implementation of the device provided in the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further comprising detecting that one or more of the plurality of data streams are associated with a data operation that manipulates the data without affecting the query report generated by the execution of the database query.
[0026] In a seventh implementation of the device provided in the second aspect or any of the foregoing implementations of the second aspect, the one or more processors execute the instructions to perform an operation, the operation further comprising excluding the one or more data streams from the plurality of data streams in the query graph.
[0027] According to a third aspect of the invention, a non-transitory computer-readable medium is provided, the non-transitory computer-readable medium storing instructions for determining data lineage based on a database query, which, when executed by one or more processors, cause the one or more processors to perform operations. The operations include parsing a received database query to detect a plurality of data entities associated with a plurality of data streams. A query graph is generated based on the received database query, the query graph including a plurality of nodes connected by edges. The plurality of nodes correspond to the plurality of data entities, and the edges correspond to the plurality of data streams. A data lineage query is retrieved from memory. The data lineage query includes one or more data entities among the plurality of data entities associated with the plurality of nodes within the generated query graph. A representation of the generated query graph is output based on the data lineage query.
[0028] In a first implementation of the non-transitory computer-readable medium provided in the third aspect, the instructions further cause the one or more processors to perform operations including detecting multiple attributes of the plurality of data entities.
[0029] In a second implementation of the non-transitory computer-readable medium provided by the third aspect or any of the foregoing implementations of the third aspect, the instructions further cause the one or more processors to perform operations including attaching the plurality of attributes to the plurality of nodes corresponding to the plurality of data entities.
[0030] Any of the foregoing examples can be combined with any one or more of the other foregoing examples to produce new embodiments within the scope of the present invention. Attached Figure Description
[0031] In the accompanying drawings, which are not necessarily drawn to scale, the same numbers in different views may describe similar components. The accompanying drawings generally illustrate the various embodiments described herein by way of example rather than limitation.
[0032] Figure 1A These are illustrations of multiple data lineages within a data warehouse using multiple data management systems, provided by some exemplary embodiments.
[0033] Figure 1B These are some exemplary embodiments provided. Figure 1A Example data lineage representation of a data warehouse;
[0034] Figure 2 These are illustrations of data processing architectures that provide graph-based query analysis, provided by some exemplary embodiments;
[0035] Figure 3 These are some exemplary embodiments provided. Figure 2A block diagram of the graph database module used in query graph generation and processing;
[0036] Figure 4 These are example node and edge diagrams provided by exemplary embodiments for extracting query graphs using database queries;
[0037] Figure 5A These are illustrations of the processing flow for node and edge extraction provided by some exemplary embodiments;
[0038] Figure 5B These are some exemplary embodiments that provide the use of a sample database for querying and based on... Figure 5A A diagram illustrating the process of extracting nodes;
[0039] Figure 6 These are illustrations of query graphs generated using a first database query, provided by some exemplary embodiments;
[0040] Figure 7 These are illustrations of query graphs generated using queries from a second database, provided by some exemplary embodiments;
[0041] Figure 8 These are illustrations of query graphs generated using queries from a third database, provided by some exemplary embodiments;
[0042] Figure 9 These are illustrations of query graphs generated using a fourth database query, provided by some exemplary embodiments;
[0043] Figure 10 These are illustrations of example attribute graphs generated by aggregating multiple query graphs, provided by some exemplary embodiments;
[0044] Figure 11 These are circuit block diagrams of clients and servers that provide implementation algorithms and execution methods, as provided by some exemplary embodiments;
[0045] Figure 12 These are flowcharts illustrating methods suitable for graph-based query analysis provided by some exemplary embodiments. Detailed Implementation
[0046] First, it should be understood that even though illustrative implementations of one or more embodiments are provided below, in conjunction with... Figures 1A to 12 The disclosed systems and / or methods described may be implemented using any number of techniques, whether currently known or not. This invention should not be limited to the illustrative implementations, drawings, and techniques set forth below, including the exemplary designs and implementations illustrated and described herein, but may be modified within the full scope of the appended claims and their equivalents.
[0047] The following description is taken in conjunction with the accompanying drawings, which are part of the description and illustrate specific embodiments in which the invention can be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the subject matter of the invention. It should be understood that other embodiments can be utilized and structural, logical, and electrical changes can be made without departing from the scope of the invention. Therefore, the following description of exemplary embodiments is not intended to be limiting, and the scope of the invention is defined by the appended claims.
[0048] In one embodiment, the functions or algorithms described herein may be implemented in software. The software may include computer-executable instructions stored in a computer-readable medium or computer-readable storage device, such as one or more non-transitory memories or other types of hardware-based local or network storage devices. The software may execute in a digital signal processor, application-specific integrated circuit (ASIC), programmable data plane chip, field-programmable gate array (FPGA), microprocessor, or other type of processor running in a computer system (such as a switch, server, or other computer system), thereby transforming such a computer system into a specially programmed machine.
[0049] As used herein, the term "data lineage" refers to the representation of how data is handled as it undergoes various processes (e.g., data manipulation, aggregation, etc.). In one aspect, data lineage can be represented in a graph (e.g., Figure 1A and Figure 1B The data is represented as a line, starting from the beginning of data processing (e.g., from the data source), traversing through other data sources or data-related functions or operations, and ending at the final destination of the data (e.g., an output table or view).
[0050] As used herein, the term "coarse-grained analysis" refers to a data analysis technique that can be used to analyze the data lineage up to the database table level. As used herein, the term "fine-grained analysis" refers to a data analysis technique that can be used to analyze the data lineage beyond a database table (e.g., table sub-components that include table columns and fields). As used herein, the terms "node" and "vertex" are interchangeable and refer to a stateful entity in a graph (i.e., a data-related entity that can be characterized by specific states, characteristics, and / or attributes). As used herein, the terms "edge" or "arc" are interchangeable and refer to a connection between two nodes, indicating a specific data transformation or other data operation that occurs between the nodes.
[0051] Enterprises currently face challenges in managing data lineage. For example, existing data lineage tools are often coarse-grained analytics tools provided by specific data management systems, with limited functionality. More specifically, when using two or more different database systems, traditional data lineage tools may struggle to perform data lineage analysis (in fact, business platforms typically consist of several database systems). Furthermore, currently used coarse-grained data lineage management and analytics tools generate high false positive rates due to the presence and impact of wide tables in the databases being analyzed. Therefore, cross-system data lineage management with high availability and fine-grained data analysis is needed.
[0052] The techniques disclosed in this paper can be used to provide fine-grained data lineage analysis based on query graph representation and aggregation. More specifically, graph-based query analysis techniques can include three parts. First, a fine-grained query graph is generated from database queries. Queries are parsed and decomposed to detect stateful entities, such as any object a user can create in a data management system, including tables (external, internal, and temporary), columns, views, stored procedures, query result sets, user-defined functions (UDFs), etc. Each stateful entity can be assigned a graph node. Edges in the graph can be connections between two nodes, representing data flows or data transformations between nodes. Other characteristics can be assigned to each node, where characteristics can include attributes and descriptions. By modeling user-defined tables, columns, and data transformations (including user-defined functions), fine-grained operations can be involved in the graph, allowing for fine-grained data analysis associated with data lineage. Second, the query graph can be aggregated by merging vertices / nodes that reference the same entities (e.g., data tables, UDFs, etc.) to generate an aggregated attribute graph, so that all influence paths are naturally presented in a lineage graph with high-performance access optimization. Third, data lineage analysis can be performed on aggregated lineage graphs, and data lineage reports can be generated based on data lineage queries performed in conjunction with aggregated attribute graphs.
[0053] Existing data lineage tools are specific to certain database management systems, while business platforms can consist of multiple different database systems. Existing data lineage analysis tools perform only coarse-grained data analysis (e.g., based on database tables as the smallest analytical component), which introduces many false positives when performing data lineage tracing. By using the techniques disclosed in this paper, fine-grained lineage analysis can be performed by generating a lineage graph based on database queries, where user-defined components (including table sub-components such as columns and fields) are represented by a single node, thus allowing for fine-grained and efficient data lineage analysis.
[0054] Figure 1A These are illustrations of multiple data lineages within a data warehouse using multiple data management systems, provided by some exemplary embodiments. (Reference) Figure 1AThe data lineage representation can include the initial point or starting point at table 105 in the data warehouse (DW), which can represent the starting point of data processing within data warehouse 100. Various data operations can be performed on table 105, such as generating the initial DW view 110. Subsequent data processing can generate additional views, such as DW views 115 and 120. In the final processing stage, DW report 125 (or other output views or representations) can be output. Figure 1A The multiple lines visible in the image represent multiple data lineages, where each line tracks the movement / processing of data from the originating data source to the destination (e.g., a table or view). Figure 1B The example data lineage representation of several visible data lineages is shown in more detail in section 130.
[0055] Figure 1B These are some exemplary embodiments provided. Figure 1A An example data lineage representation of a data warehouse. (Reference) Figure 1B Data lineage representation 130 illustrates the originating data source 135, which may include multiple distinct data tables (e.g., country, location, department, employee, job history, job type, and region). When multiple data management systems within the data warehouse 100 perform data operations on the originating data source 135, the data is transformed into different views and output in one or more final reports. For example, the generation of data hierarchy 140, data storage 145, and DW view 150 can be performed on the originating data source 135. The final report 155 can be generated based on the DW view 150. The final report 155 may include one or more discrepancies, and tracing these discrepancies back to one or more sources 135 may be difficult using traditional coarse-grained data analysis tools. In some aspects, the techniques disclosed herein can be used to perform query-based data lineage analysis, including fine-grained data lineage analysis to detect discrepancies or perform data lineage-related queries.
[0056] Figure 2 These are illustrations of data processing architectures that provide graph-based query analysis, provided by some exemplary embodiments. (Reference) Figure 2The data processing architecture 200 can be used to process database queries within a database management system and to generate aggregated query graphs in response to data lineage queries. In operation 215, a database query 210 is received from one or more users 205A. The database query 210 may include a standard query language (SQL) query or other types of queries. In operation 220, SQL validation can be performed, and a validated query 225 is generated. In operation 230, the validated query 225 can be executed in conjunction with a database management system (DBMS) 235. The DBMS 235 may include one or more data repositories 240. As a result of executing the validated query 225, in operation 250, a query report 245 is generated and sent back to one or more users 205A.
[0057] In some aspects, the validated query 225 is also used for query graph generation 255 to obtain query graph 260. In an exemplary embodiment, query graph generation 255 can occur concurrently with query execution 230. In operation 265, query graph 260 can be aggregated with one or more previously generated query graphs stored in the attribute graph memory 275 of the graph database module 270 to generate one or more attribute graphs (details of the graph database module 270 are in...). Figure 3 (Shown in more detail below). Different users (e.g., inspector 205B) can transmit a data lineage query 280 to analyze data lineage in conjunction with attribute graphs stored in the graph database module 270. In operation 285, one or more attribute graphs stored in the attribute graph memory 275 can be analyzed based on the lineage query 280 to generate a final result 290. In operation 295, the final result 290 is returned to inspector 205B.
[0058] Figure 3 These are some exemplary embodiments provided. Figure 2 A more detailed view of the graph database module used in query graph generation and processing is shown in the 300-page block diagram. (Reference) Figure 3 The query graph 260 is received by the RF receiver 305 within the graph database module 270. The subgraph receiver 305 includes appropriate interfaces, circuitry, and / or code for performing initial processing of the query graph 260, such as node and edge detection. The query graph 260 and information about the detected nodes and edges are transmitted to the graph fusion module 310.
[0059] Graph fusion module 310 includes appropriate interfaces, circuitry, and / or code for aggregating query graphs to generate attribute graphs. More specifically, graph fusion module 310 retrieves one or more stored graphs 315 (e.g., based on nodes and edges detected within query graph 260) and performs graph aggregation with query graph 260 to generate attribute graph 320. Attribute graph 320 is then stored back in attribute graph memory 275.
[0060] The data pedigree query 280 is received by the query conversion module 325. The query conversion module 325 includes suitable interfaces, circuitry, and / or code for performing a conversion of the pedigree query 280 from a data query language to a graph query language (e.g., Gremlin or Cypher) using a graph query algorithm 330. The converted data pedigree query is executed to generate a pedigree query execution result 335. The pedigree query execution result 335 can be further reformatted to generate a final result 290 transmitted to the inspector 205B. For example, the pedigree query execution result 335 can be reformatted by a graph visualization module 340, which can be used to reformat the result 335 into JavaScript Object Notation (JSON) or another type of visualization for presentation to the inspector 205B.
[0061] Figure 4 This is a block diagram 400 illustrating example nodes and edges of a query graph extracted using database queries, provided by some exemplary embodiments. (See reference...) Figure 4 Example database query 405, which may include data-related entities, is shown. As used herein, the term "data-related entity" includes user-created objects that have a specific state within a data processing system, such as tables (e.g., external, internal, and time), table columns, data views, table rows, stored procedures, query result sets, user-defined functions (UDFs), etc. Data-related entities can be further characterized by characteristics, which may include attributes and descriptions.
[0062] like Figure 4 As shown, database query 405 can be analyzed for data-related entities, and these entities can be extracted as nodes (or vertices) within the query graph. For example, data views 410 and 415, table 425, and user-defined function 420 can be detected as stateful data-related entities (i.e., data-related entities with given state and characteristic representations). Database query 405 can be further analyzed to determine the data flows and transformations occurring between data-related entities. Such data flows and transformations can be represented as edges or arcs between nodes. For example, data flows or transformations 430, 435, and 440 in... Figure 4The edge is referenced as connecting nodes 410, 415, 420, and 425.
[0063] Figure 5A This is an illustration of a processing flow 500 for node and edge extraction provided by some exemplary embodiments. Figure 5B These are some exemplary embodiments that provide the use of a sample database for querying and based on... Figure 5A The diagram illustrates the node extraction process in the processing flow. (Reference) Figure 5A In operation 505, sample database query 520 can be parsed. In operation 510, entities and data flows can be extracted from the parsed query 520. More specifically, and in conjunction with query 520, tables HIGH-SAL-EMP and EMPLOYEE can be extracted as entities 530 and 535, respectively. Furthermore, each table HIGH-SAL-EMP and EMPLOYEE includes at least one column, represented as entities 540 and 545, respectively. The SQL operations of the query (e.g., INSERT / SELECT) can be extracted as entity 525. In operation 515, a query graph can be generated based on the extracted entities (creating vertices or nodes for each entity) and the data flows or transformations between entities (creating edges or arcs for each data flow or transformation). Figure 6 The graph shows an example query related to query 520.
[0064] Figure 6 This is an illustration of a query graph 600 generated using a first database query, provided by some exemplary embodiments. (See reference) Figure 6 Querying Figure 600 can generate it based on querying Database 640, which is consistent with... Figure 5B The query 640 is identical to query 520. Database query 640 can be interpreted as selecting all columns from the EMPLOYEE table for employees with salaries greater than 200,000 and inserting the results into a new table HIGH_SAL_EMP. The select and insert functions are performed by the SQL statement in query 640; therefore, the SQL statement will be represented by a separate node 620. The origin and destination tables (EMPLOYEE and HIGH_SAL_EMP) are represented by nodes 605 and 625, respectively.
[0065] Both tables, HIGH_SAL_EMP and EMPLOYEE, have their own columns / fields. More specifically, table EMPLOYEE may include columns / fields called EMP_ID, NAME, etc. Table HIGH_SAL_EMP is derived from table EMPLOYEE (i.e., the contents of HIGH_SAL_EMP are derived from EMPLOYEE via the INSERT-WITH-SELECT statement in SQL query 640). The columns / fields of table EMPLOYEE can be represented as nodes 610 and 615, and the corresponding columns / fields in table HIGH_SAL_EMP, which is derived from table EMPLOYEE, are represented as nodes 630 and 635.
[0066] Furthermore, one or more nodes in query graph 600 can be annotated with node characteristics such as attributes and descriptions. For example, node 620 is annotated with the label “SQL statement” and the subclass “Insert_Select” describing the SQL operation associated with query 640. Nodes 605 and 625 are annotated with the label “table” to indicate the existence of a data table, and have a “name” annotation to indicate the table name used in query 640. Table column / field nodes (e.g., 610, 615, 630, and 635) are annotated with attributes such as “label”, “name”, and “type”.
[0067] The data transfers and transformations represented by each edge of the query graph 600 can also be annotated with edge attributes. For example, the dashed edge between nodes 610-630 and 615-635 is annotated with the label "derived" to indicate that data is derived from one table to another.
[0068] In some contexts, dashed boxes (or other types of diagram names) can be placed in query diagrams to represent tables or views. For example, as... Figure 6 As shown, boxes 645 and 650 represent tables HIGH_SAL_EMP and EMPLOYEE, and box 65 represents the data view associated with the SQL statement of query 640.
[0069] Figure 7 This is an illustration of a query graph 700 generated using a second database query 705, provided by some exemplary embodiments. (See reference) Figure 7Database query 705 involves processing data stored in the table "Customers". As a result of parsing query 705, node 710 can be created for the table "Customers", and additional nodes 715 and 720 can be created for the columns "Country" and "Customer ID" of the table "Customers". A separate node 725 is created for the SQL statement of query 705. Since the data in the "Country" and "Customer ID" columns of the table "Customers" is used by the SQL statement for Customer ID, referencing nodes 730 and 735 (corresponding to nodes 715 and 720 respectively) can be created, allowing the data-related functionality of query 705 to be shown as edges associated with nodes 730 and 735.
[0070] The operation to determine the count of the Customer ID column greater than 5 is represented by function nodes 740 and 745. For example, node 745 represents the "HAVING…>5" filter operation, where the operator ID 14 corresponds to the comparison function ">", and the parameter "5" represents ">5". As a result of executing query 705, the output of result representation 750 is generated. Since result representation 750 is a view (i.e., time data) and is not stored in a table, the output arrow of node 725 associated with result representation 750 is shown as a dashed arrow within query graph 700.
[0071] In some instances, one or more node connections in the query graph can be omitted to simplify the graph. For example, the dashed "OrderBy" and "GroupBy" connections between nodes 740-725 and 730-725 can be omitted from the graph because these connections represent data rearrangement functions that ultimately do not change the query results. (See also...) Figure 8 This shows a simplified query graph with the data rearrangement function omitted.
[0072] Figure 8 This is an illustration of a query graph 800 generated using a third database query 805, provided by some exemplary embodiments. (See reference) Figure 8 Query 805 is similar to Query 705, except that Query 805 includes an additional user-defined function 840. As a result of parsing Query 805, a node 810 can be created for the table "Customers," and additional nodes 815 and 820 can be created for the columns "Country" and "Customer ID" of the table "Customers." A separate node 830 is created for the SQL statement (i.e., the SELECT function) of Query 805. Since the data in the "Country" and "Customer ID" columns of the table "Customers" is used by UDF 840, a separate node 825 is created for UDF 840 in Figure 800. Figure 8 As shown, data rearrangement functions (e.g., ORDER BY and HAVING COUNT>5) can be omitted, thus simplifying query graph 800. The output from node 830 is the result representation 835 from executing query 805.
[0073] Figure 9 This is an illustration of a query graph 900 generated using a fourth database query 905, provided by some exemplary embodiments. (See reference) Figure 9 Query 905 includes a nested query (i.e., a query within a query) 975. As a result of parsing query 905, node 915 can be created for the table "MyEmployee", and additional nodes 920, 925, and 930 can be created for the columns "Department", "New Title", and "Revenue". An outline box 985 can be created in query graph 900 to represent the table "MyEmployee", including nodes 915, 920, 925, and 930.
[0074] Create a separate node 935 for the SQL statement (i.e., the SELECT function) of nested query 975. Data reference nodes 940 and 950 can be generated using data from nodes 925 and 930, respectively. The WHERE function in nested query 975 is associated with node 945 via input from node 920. An outline box 910 can be created within query graph 900 to represent nested query 975 and its associated data processing and manipulation functions.
[0075] Create a separate node 955 for the SQL statement (i.e., the SELECT function) of the main query 905. Generate a data reference node 960 using reference data from node 925. The AVG function in query 905 is associated with node 965 via data from node 930. An outline box 980 can be created within query graph 900 to represent the main query 905 and its associated data processing and manipulation functions. The output from node 955 is the result representation 970 from executing query 905.
[0076] Figure 10 This is an illustration of an example attribute graph 1000 generated by aggregating multiple query graphs, provided by some exemplary embodiments. (See reference) Figure 10 The first query graph 1005 is shown, which can generate nodes 1010A, 1010B, 1010C, 1010D, 1010E, 1010F, 1010G, 1010H, 1010I, 1010J, and 1010K. The second query graph 1015 can generate nodes 1020A, 1020B, 1020C, 1020D, 1020E, 1020F, 1020G, 1020H, 1020I, 1020J, and 1020K.
[0077] In one exemplary aspect, a single query graph can be aggregated to generate an aggregated attribute graph by locating a common node in a single query graph and aggregating the single graph around the common node. A single query graph can also be aggregated if the output of one query graph is the input of another query graph. Multiple attribute graphs can also be aggregated based on one or more common nodes.
[0078] For example, since the output from node 1010K of query graph 1005 is the input to node 1020A of query graph 1015, query graphs 1005 and 1015 can be aggregated. In another scenario, node 1010K can be the same as node 1020A, and query graphs 1005 and 1015 can be aggregated based on shared nodes.
[0079] like Figure 10 As shown, attribute graph 1000 also includes node 1025, which is connected to node 1030 (associated with an unknown operation) and generates output to node 1035. Furthermore, outputs from nodes 1020K and 1020J are passed to node 1040. In this respect, query graphs 1005 and 1015, as well as nodes 1025, 1030, 1035, and 1040, can all be aggregated into attribute graph 1000. A first result indicates that 1045 can output from node 1035, and a second result indicates that 1050 can output from node 1040. Figure 10 The attribute graph representation in the document is exemplary, and other variations and aggregations of query graphs to attribute graphs are possible using the techniques described herein.
[0080] Figure 11 These are circuit block diagrams of clients and servers providing implementation algorithms and execution methods according to some exemplary embodiments. Not all components need to be used in various embodiments. For example, the client, server, and cloud-based network resources may each use different sets of components, or, in the case of the server, a larger storage device.
[0081] An exemplary computing device in the form of a computer 1100 (also referred to as computing device 1100 and computer system 1100) may include a processor 1105, a memory 1110, a removable memory 1115, a non-removable memory 1120, an input interface 1125, an output interface 1130, and a communication interface 1135, all of which are connected via a bus 1140. Although the exemplary computing device is shown and described as computer 1100, the computing device may take different forms in different embodiments.
[0082] Memory 1110 may include volatile memory 1145 and non-volatile memory 1150, and may store program 1155. Computer 1100 may include or have access to a computing environment, which includes various computer-readable media, such as volatile memory 1145, non-volatile memory 1150, removable memory 1115, and non-removable memory 1120. Computer memory includes random-access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD ROM), digital versatile disk (DVD) or other optical disc storage, magnetic tape cassettes, magnetic tape, disk storage or other magnetic storage devices, or any other medium capable of storing computer-readable instructions.
[0083] Computer-readable instructions stored in a computer-readable medium (e.g., program 1155 stored in memory 1110) can be executed by processor 1105 of computer 1100. Hard disk drives, CD-ROMs, and RAM are some examples of articles of manufacture that include non-transitory computer-readable media (such as storage devices). The terms "computer-readable medium" and "storage device" do not include carrier waves that are considered too transient. "Computer-readable non-transitory medium" includes all types of computer-readable media, including magnetic storage media, optical storage media, flash memory media, and solid-state storage media. It should be understood that software can be installed in a computer and sold with the computer. Alternatively, software can be obtained and loaded into a computer, including obtaining software through physical media or distribution systems, including, for example, obtaining software from a server owned by the software author or from a server not owned by the software author but used. For example, software can be stored on a server for distribution over the Internet. As used herein, the terms "computer-readable medium" and "machine-readable medium" are interchangeable.
[0084] Program 1155 may utilize a customer preference structure, which employs modules such as query parsing module 1160, query verification module 1165, attribute graph generation module 1170, and lineage query processing module 1175. Any one or more modules described herein may be implemented using hardware (e.g., a machine's processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or any suitable combination thereof). Furthermore, any two or more of these modules may be combined into a single module, and the functionality of a single module described herein may be subdivided among multiple modules. Moreover, modules described herein as being implemented within a single machine, database, or device may be distributed across multiple machines, databases, or devices, according to various exemplary embodiments.
[0085] The query parsing module 1160 includes appropriate circuitry, logic, interfaces, and / or code, and is used to parse database queries to detect data-related entities within the query. Such entities may include user-created objects with specific states within the data processing system, such as tables (e.g., external, internal, and temporary), table columns, data views, table rows, stored procedures, query result sets, user-defined functions (UDFs), etc. Data-related entities can be further characterized by characteristics, which may include attributes and descriptions. The query parsing module 1160 is also used to detect data flows and transformations associated with the database query.
[0086] The query verification module 1165 includes appropriate circuitry, logic, interfaces, and / or code, and is used to perform query verification on the received query (e.g., such as...). Figure 2 The query verification operation performed in section 20).
[0087] The attribute graph generation module 1170 includes suitable circuitry, logic, interfaces, and / or code, and is used to generate one or more query graphs and to perform aggregation on the query graphs to generate one or more attribute graphs. More specifically, the attribute graph generation module 1170 is used to generate query graphs based on nodes, edges, and attributes obtained by the query parsing module 1160. The attribute graph generation module 1170 can perform aggregation on... Figure 2 The functions in the graph generation (255), subgraph receiver (305), graph fusion (310), and attribute graph storage are the same, such as combining... Figure 3 As stated above.
[0088] The pedigree query processing module 1175 includes suitable circuitry, logic, interfaces, and / or code, and is used to process data pedigree queries and generate pedigree query execution results using one or more attribute graphs. More specifically, the pedigree query processing module 1175 can perform the same functions as the query transformation module 325 and the graph visualization module 340, such as in combination with... Figure 3 As stated above.
[0089] In some respects, one or more modules in modules 1160-1175 may be integrated into a single module to perform the corresponding functions of the integrated module.
[0090] Figure 12 These are flowcharts illustrating methods suitable for graph-based query analysis provided by some exemplary embodiments. Method 1200 includes operations 1205, 1210, and 1215. By way of example and not limitation, method 1200 is described as being used by device 1100. Figure 12 Modules 1160-1175 are executed.
[0091] In operation 1205, the received database query is parsed to detect multiple data entities associated with multiple data streams. For example, query parsing module 1160 can receive and parse query 805 to detect data-related entities, data streams, transformations, and attributes associated with query 805.
[0092] In operation 1210, a query graph associated with the received database query is generated. For example, the attribute graph generation module 1170 can generate a query graph 800 based on the data-related entities, data flows, transformations, and attributes detected by the query parsing module 1160. The query graph 800 includes multiple nodes (e.g., 810, 815, 820, 825, and 830) connected by edges, where the multiple nodes correspond to multiple data entities, and the edges correspond to multiple data flows.
[0093] In operation 1215, a data pedigree query is retrieved from memory. The data pedigree query includes one or more data entities from a plurality of data entities associated with multiple nodes within a generated query graph. For example, pedigree query processing module 1175 retrieves (e.g., from volatile memory 1145 or non-volatile memory 1150) a pedigree query 280 originating from user (e.g., data inspector) 205B. Peer query processing module 1175 translates the query into a query graph language (e.g., using graph query algorithm 330).
[0094] In the case where the data lineage query does not include data entities associated with the generated query graph, the lineage query processing module 1175 can retrieve another query graph (or an attribute graph based on multiple aggregated query graphs) from the attribute graph storage 275, wherein the retrieved query graph includes data entities from the data lineage query.
[0095] In operation 1220, the pedigree query processing module 1175 generates a representation of the query graph based on the data pedigree query output. For example, the pedigree query processing module 1175 performs a transformed data pedigree query using one or more attribute graphs stored in memory 275 to generate a pedigree query execution result 335. The pedigree query processing module 1175 uses the graph visualization module 340 to generate a final result 290 that can be returned to the user 205B.
[0096] Although several embodiments have been described in detail above, other modifications are possible. For example, the logical flow depicted in the figures does not require the specific or sequential order shown to achieve the desired result. Additional steps may be provided to or removed from the described flow, and other components may be added to or removed from the described system. Other embodiments are within the scope of the appended claims.
[0097] It should also be understood that software comprising one or more computer-executable instructions may be installed in and sold with one or more computing devices conforming to the invention, which facilitate the processing and operation as described above in conjunction with any or all of the steps of the invention. Alternatively, the software may be acquired and loaded into one or more computing devices, including acquiring the software via physical media or a distributed system, including, for example, acquiring the software from a server owned by the software creator or from a server not owned by the software creator but used by the software creator. For example, the software may be stored on a server for distribution via the Internet.
[0098] Furthermore, those skilled in the art will understand that the invention, in its application, is not limited to the details of the construction and arrangement of the components set forth in the specification or illustrated in the drawings. The embodiments described herein are applicable to other embodiments and can be practiced or performed in various ways. Furthermore, it should be understood that the wording and terminology used herein are for descriptive purposes and should not be considered limiting. The use of “comprising,” “including,” or “having,” and variations thereof herein is intended to cover the items listed thereafter and their equivalents, as well as other items. Unless otherwise limited, the terms “connected,” “coupled,” and “mounted,” and variations thereof are used extensively herein and cover direct and indirect connections, couplings, and mountings. Furthermore, the terms “connected” and “coupled,” and variations thereof, are not limited to physical or mechanical connections or couplings. Additionally, terms such as “upper,” “lower,” “bottom,” and “top” are relative and used for illustrative purposes but are not limiting.
[0099] Components of the illustrative apparatus, system, and method used according to the described embodiments may be implemented at least partially in digital electronic circuits, analog electronic circuits, or computer hardware, firmware, software, or combinations thereof. For example, these components may be implemented as computer program products (such as computer programs, program code, or computer instructions) tangibly embodied in an information carrier or a machine-readable storage device for execution by a data processing apparatus (such as a programmable processor, computer, or multiple computers) or for controlling the operation of the data processing apparatus.
[0100] Computer programs can be written in any programming language (including compiled or interpreted languages) and can be deployed in any form, including as standalone programs or as modules, components, subroutines, or other units suitable for use in a computing environment. Computer programs can be deployed to execute in one or more computers at a single site, or distributed across multiple sites interconnected via a communication network. Furthermore, the functional programs, code, and code segments used to implement the techniques described herein are readily understood by programmers in the art to which the techniques described herein belong to be within the scope of the claims. The method steps associated with the illustrative embodiments can be executed by one or more programmable processors, thereby executing computer programs, code, or instructions to perform functions (e.g., manipulating input data and / or generating output). For example, the method steps can also be executed by special-purpose logic circuitry (e.g., field-programmable gate arrays (FPGAs) or application-specific integrated circuits (ASICs)), and the means for performing the method can be implemented as such special-purpose logic circuitry.
[0101] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein can be implemented or performed using a general-purpose processor, a digital signal processor (DSP), an ASIC, an FPGA, or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. The general-purpose processor can be a microprocessor, and optionally, it can also be any conventional processor, controller, microcontroller, or state machine. The processor can also be implemented as a combination of computing devices, such as a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other similar configuration.
[0102] For example, processors suitable for executing computer programs include general-purpose and special-purpose microprocessors, as well as any one or more processors in any type of digital computer. Typically, the processor receives instructions and data from read-only memory or random access memory, or both. Essential components of a computer are a processor for executing instructions and one or more memory devices for storing instructions and data. Typically, a computer also includes one or more mass storage devices (e.g., magnetic disks, magneto-optical disks, or optical disks) for storing data, or is operatively coupled to one or more mass storage devices for storing data to receive data from and / or transfer data to said mass storage device. Information carriers suitable for embodying computer program instructions and data include various forms of non-volatile memory, such as semiconductor memory devices, such as electrically programmable read-only memory or electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory devices, and data storage disks (e.g., magnetic disks, internal hard disks, or removable disks, magneto-optical disks, CD-ROMs, and DVD-ROMs). The processor and memory may be supplemented by or incorporated into dedicated logic circuitry.
[0103] Those skilled in the art will understand that information and signals can be represented using any of a variety of different technologies and technical methods. For example, the data, instructions, commands, information, signals, bits, symbols, and chips that may be referenced in the above description may be represented by voltage, current, electromagnetic waves, magnetic fields or magnetic particles, optical fields or optical particles, or any combination thereof.
[0104] As used herein, "machine-readable medium" means a device capable of temporarily or permanently storing instructions and data, and may include, but is not limited to, random-access memory (RAM), read-only memory (ROM), buffer memory, flash memory, optical media, magnetic media, cache memory, other types of memory (e.g., erasable programmable read-only memory (EEPROM)) and / or any suitable combination thereof. The term "machine-readable medium" should be understood to include a single medium or multiple media capable of storing processor instructions (e.g., a centralized or distributed database, or associated caches and servers). The term "machine-readable medium" should also be understood to include any medium or combination of media capable of storing instructions executable by one or more processors 152, which, when executed, cause one or more processors 152 to perform any or more methods described herein. Accordingly, "machine-readable medium" refers to a single storage device or apparatus, as well as a "cloud-based" storage system or storage network comprising multiple storage devices or apparatuses. The term "machine-readable medium" as used herein does not include the signal itself.
[0105] Furthermore, without departing from the scope of this invention, the technologies, systems, subsystems, and methods described and illustrated as independent or separate in the various embodiments may be combined or integrated with other systems, modules, technologies, or methods. Other items shown or described as coupled to each other, or directly coupled, or communicating with each other, may be indirectly coupled or communicated through some interface, device, or intermediate component in an electrical, mechanical, or other manner. Other examples of variations, substitutions, and modifications can be determined by those skilled in the art and may be exemplified without departing from the spirit and scope of this disclosure.
[0106] Although the invention has been described with reference to specific features and embodiments thereof, it will be apparent that various modifications and combinations thereof can be made without departing from the invention. For example, other components may be added to or removed from the described system. Therefore, the specification and drawings are to be regarded only as a description of the invention as defined by the appended claims, and are intended to cover any and all modifications, variations, combinations, or equivalents falling within the scope of the invention. Other aspects are within the scope of the appended claims.
Claims
1. A computer-implemented method for determining data lineage based on database queries, characterized in that, The method is applied to a business platform, which includes multiple database management systems. The method is executed by the multiple database management systems and includes: Parse the received database query to detect multiple data entities associated with multiple data streams; A query graph is generated based on the received database query. The query graph includes multiple nodes connected by edges, wherein the multiple nodes correspond to the multiple data entities, the edges correspond to the multiple data streams, and one or more nodes in the query graph have annotations. The annotation of a node includes the node's attributes or description. Retrieve a data lineage query from memory, the data lineage query including one or more data entities from the plurality of data entities associated with the plurality of nodes within the generated query graph; Retrieve at least one second query graph, wherein the second query graph includes at least one node shared with the generated query graph; and The generated query graph is output based on the data lineage query. The method further includes: A combined attribute graph is generated based on the query graph and the second query graph, wherein the combined attribute graph starts from the starting node in the query graph, traces the data lineage of the data through at least one shared node, and terminates at the node that outputs the final representation of the data. The query graph and the second query graph are generated by different database management systems.
2. The computer-implemented method according to claim 1, characterized in that, The at least one node shared with the generated query graph includes at least one of the following: a data table, a table column, a data view, a query result set, and a user-defined function.
3. The computer-implemented method according to any one of claims 1 to 2, characterized in that, Also includes: The combined attribute graph is used to output a graph visualization or JavaScript Object Notation (JSON) based on the data lineage query, wherein the graph visualization is based on at least a portion of the combined attribute graph, the at least a portion including nodes corresponding to the plurality of data entities referenced in the query.
4. The computer-implemented method according to any one of claims 1 to 3, characterized in that, Also includes: The data lineage query is converted into one or more graph query languages compatible with the generated query graph.
5. The computer-implemented method according to any one of claims 1 to 4, characterized in that, Also includes: Detect multiple attributes of the multiple data entities; as well as The nodes corresponding to the plurality of data entities are attached with the plurality of attributes.
6. The computer-implemented method according to any one of claims 1 to 5, characterized in that, Also includes: Before the parsing, the received database query is verified; Execute the validated query to generate a query report.
7. The computer-implemented method according to any one of claims 1 to 6, characterized in that, The execution of the validated query and the generation of the query graph are performed simultaneously.
8. The computer-implemented method according to any one of claims 1 to 7, characterized in that, Also includes: Detect one or more of the plurality of data streams associated with data operations that manipulate the data without affecting the query report.
9. The computer-implemented method according to any one of claims 1 to 8, characterized in that, Also includes: Exclude one or more of the multiple data streams from the query graph.
10. The computer-implemented method according to any one of claims 1 to 9, characterized in that, The database query includes nested queries, and one of the plurality of nodes in the query graph is associated with a structured query language (SQL) operation of the nested query.
11. A device, characterized in that, include: A memory, the memory including instructions; the instructions instruct a method applied to a business platform, the business platform including multiple database management systems, the method being executed by the multiple database management systems; One or more processors communicate with the memory, wherein the one or more processors execute the instructions to perform operations including: Parse the received database query to detect multiple data entities associated with multiple data streams; A query graph is generated based on the received database query. The query graph includes multiple nodes connected by edges, wherein the multiple nodes correspond to the multiple data entities, the edges correspond to the multiple data streams, and one or more nodes in the query graph have annotations. The annotation of a node includes the node's attributes or description. Retrieve a data lineage query from memory, the data lineage query including one or more data entities from the plurality of data entities associated with the plurality of nodes within the generated query graph; Retrieve at least one second query graph, wherein the second query graph includes at least one node shared with the generated query graph; and The generated query graph is output based on the data lineage query. The operation also includes: A combined attribute graph is generated based on the query graph and the second query graph, wherein the combined attribute graph starts from the starting node in the query graph, traces the data lineage of the data through at least one shared node, and terminates at the node that outputs the final representation of the data. The query graph and the second query graph are generated by different database management systems.
12. The device according to claim 11, characterized in that, The one or more processors execute the instructions to perform an operation, the operation further comprising: Using the combined property graph and querying the data lineage, output graph visualization or JavaScript Object Notation (JSON).
13. The device according to any one of claims 11 to 12, characterized in that, The one or more processors execute the instructions to perform an operation, the operation further comprising: Detect multiple attributes of the multiple data entities; and The nodes corresponding to the plurality of data entities are attached with the plurality of attributes.
14. The device according to any one of claims 11 to 13, characterized in that, The one or more processors execute the instructions to perform an operation, the operation further comprising: Detect one or more of the plurality of data streams and associate them with data operations that manipulate the data without affecting the query report generated by the execution of the database query; Exclude one or more of the multiple data streams from the query graph.
15. A non-transient machine-readable medium, characterized in that, The system stores instructions for determining data lineage based on database queries. The method for instructing these instructions is applied to a business platform comprising multiple database management systems. The method is executed by the multiple database management systems. When one or more processors execute the instructions, the processors perform operations including the following: Parse the received database query to detect multiple data entities associated with multiple data streams; A query graph is generated based on the received database query. The query graph includes multiple nodes connected by edges, wherein the multiple nodes correspond to the multiple data entities, the edges correspond to the multiple data streams, and one or more nodes in the query graph have annotations. The annotation of a node includes the node's attributes or description. Retrieve a data lineage query from memory, the data lineage query including one or more data entities from the plurality of data entities associated with the plurality of nodes within the generated query graph; Retrieve at least one second query graph, wherein the second query graph includes at least one node shared with the generated query graph; and The generated query graph is output based on the data lineage query. The operation also includes: A combined attribute graph is generated based on the query graph and the second query graph, wherein the combined attribute graph starts from the starting node in the query graph, traces the data lineage of the data through at least one shared node, and terminates at the node that outputs the final representation of the data. The query graph and the second query graph are generated by different database management systems.
16. The non-transient machine-readable medium according to claim 15, characterized in that, When executed, the instructions also cause the one or more processors to perform operations including the following: Detect multiple attributes of the multiple data entities; and The nodes corresponding to the plurality of data entities are attached with the plurality of attributes.
Citation Information
Patent Citations
Data linage analysis method and device
CN104424269A
