# US 2024/0256537 A1 · Techniques for building data lineages for queries

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0256537 A1
- Document ID: US20240256537A1
- Status: Published application
- Kind: A1
- Application number: 18/632,458
- Filed: 2024-04-11
- Published: 2024-08-01
- Earliest claimed: 2021-04-27
- Assignees: Capital One Services, LLC
- Applicants: Capital One Services, LLC
- Inventors: Srinivas KUMAR; Aravind BIRUDU; Rajeev TIWARI; Puneet GOYAL
- Web page: https://patentgrep.com/patent/US20240256537A1

## CPC

- G06F 16/24535: {of sub-queries or views}
- G06F 16/9024: {Graphs; Linked lists (G06F16/9027 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Various embodiments are generally directed to techniques for building data lineages for queries, such as SQL queries. Some embodiments are particularly directed to a lineage tool that is able to construct data lineages in a recursive manner that uses the text of a query to identify dependent tables. In several embodiments, the data lineage tool may parse SQL queries to identify columns and dependent tables, including analyzing interdependent queries used to populate dependent tables and proceeding until the true source of data is identified. In several embodiments, the data lineage tool may utilize the relationships and dependencies to build element and table level lineages.

## Claims

### Claim 1

An apparatus comprising:
a processor; and
memory comprising instructions that, when executed by the processor, cause the processor to:
determine whether a first query is dependent on a second query;
responsive to the first query being dependent on the second query, determine whether a lineage for the second query has been built;
responsive to the lineage for the second query being built, fetch the lineage for the second query from a database;
build a lineage for the first query by adding to the lineage for the second query;
add metadata to the lineage for the first query, the metadata comprising transformation logic associated with the first query; and
generate a data report using the lineage for the first query to automatically identify any data issues.

### Claim 2 (depends on 1)

The processor of claim 1 wherein the first query is a search query language (SQL) query.

### Claim 3 (depends on 2)

The processor of claim 2 wherein the instructions, when executed by the processor, further cause the processor to:
use text of the SQL query to identify the second query.

### Claim 4 (depends on 2)

The processor of claim 2 wherein the instructions, when executed by the processor, further cause the processor to:
parse the SQL query to identify dependent tables and analyze interdependent queries used to populate the dependent tables.

### Claim 5 (depends on 1)

The processor of claim 1 wherein the instructions, when executed by the processor, further cause the processor to:
build the lineage for the first query in a recursive manner until a true source of the data is identified.

### Claim 6 (depends on 5)

The processor of claim 5 wherein the instructions, when executed by the processor, further cause the processor to:
build the lineage for the first query without an entire collection of queries on which the first query depends.

### Claim 7 (depends on 1)

The processor of claim 1 wherein the instructions, when executed by the processor, further cause the processor to:
build the lineage for the second query responsive to the lineage for the second query being unbuilt.

### Claim 8

A non-transitory computer-readable medium comprising a set of instructions that, in response to execution by a processor circuit, cause the processor circuit to:
determine whether a first query is dependent on a second query;
responsive to the first query being dependent on the second query, determine whether a lineage for the second query has been built;
responsive to the lineage for the second query being built, fetch the lineage for the second query from a database;
build a lineage for the first query by adding to the lineage for the second query;
add metadata for the lineage for the first query, the metadata comprising transformation logic associated with the first query; and
generate a data report using the lineage for the first query to automatically identify any data issues.

### Claim 9 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the first query is a search query language (SQL) query.

### Claim 10 (depends on 9)

The non-transitory computer-readable medium of claim 9 wherein the set of instructions, in response to execution by the processor circuit, further cause the processor circuit to:
use text of the SQL query to identify the second query.

### Claim 11 (depends on 9)

The non-transitory computer-readable medium of claim 9 wherein the set of instructions, in response to execution by the processor circuit, further cause the processor circuit to:
parse the SQL query to identify dependent tables and analyze interdependent queries used to populate the dependent tables.

### Claim 12 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the set of instructions, in response to execution by the processor circuit, further cause the processor circuit to:
build the lineage for the first query in a recursive manner until a true source of the data is identified.

### Claim 13 (depends on 12)

The non-transitory computer-readable medium of claim 12 wherein the set of instructions, in response to execution by the processor circuit, further cause the processor circuit to:
build the lineage for the first query without an entire collection of queries on which the first query depends.

### Claim 14 (depends on 8)

The non-transitory computer-readable medium of claim 8 wherein the set of instructions, in response to execution by the processor circuit, further cause the processor circuit to:
build the lineage for the second query responsive to the lineage for the second query being unbuilt.

### Claim 15

A computer-implemented method comprising:
determining whether a first query is dependent on a second query;
responsive to the first query being dependent on the second query, determining whether a lineage for the second query has been built;
responsive to the lineage for the second query being built, fetching the lineage for the second query from a database;
building a lineage for the first query by adding to the lineage for the second query;
adding metadata to the lineage for the first query, the metadata comprising transformation logic associated with the first query; and
generating a data report using the lineage for the first query to automatically identify any data issues.

### Claim 16 (depends on 15)

The computer-implemented method of claim 15 wherein the first query is a search query language (SQL) query.

### Claim 17 (depends on 16)

The computer-implemented method of claim 16 further comprising:
using text of the SQL query to identify the second query.

### Claim 18 (depends on 16)

The computer-implemented method of claim 16 further comprising:
parsing the SQL query to identify dependent tables and analyze interdependent queries used to populate the dependent tables.

### Claim 19 (depends on 15)

The computer-implemented method of claim 15 further comprising:
building the lineage for the first query in a recursive manner until a true source of the data is identified.

### Claim 20 (depends on 19)

The computer-implemented method of claim 19 further comprising:
building the lineage for the first query without an entire collection of queries on which the first query depends.
