Field blood relationship determination method, device and electronic device

By converting SQL statements into abstract syntax trees and replacing target characters, the problem that Druid cannot parse SQL statements containing target characters is solved, and field-level blood relationship determination is achieved, improving the comprehensiveness of SQL parsing.

CN119739727APending Publication Date: 2025-04-01新奥新智科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411318668.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

In the prior art, Druid's SQL parser cannot parse SQL statements containing target characters (eg, "*"), resulting in the inability to obtain field-level blood relationships.

Method used

By converting the SQL statement to the first abstract syntax tree and replacing the target characters in the order from the bottom to the top layer to obtain the specific data table field, the second abstract syntax tree is obtained, thereby determining the blood relationship of the target field.

Benefits of technology

The parsing of the target field is realized when the SQL statement is included, and a more complete second abstract syntax tree and field-level blood relationship is obtained, which makes up for the shortcomings of the existing technology and improves the comprehensiveness of SQL statement parsing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739727A_ABST
    Figure CN119739727A_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a method, device and electronic device for determining the blood relationship of fields. The embodiments of the method include: converting a structured query language SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; in order from the bottom to the top, each layer in the first abstract syntax tree is used as the target layer, querying the target node containing the target character in the target layer, determining the data table corresponding to the target character in the target node, replacing the target character in the target node with each field in the data table, and obtaining a second abstract syntax tree; based on the second abstract syntax tree, determining the blood relationship of the target field. This implementation improves the comprehensiveness of the SQL statement parsing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a method, device and electronic device for determining field blood relationship. Background Art

[0002] Enniu.com is a smart production and operation platform formed by the group based on multi-scenario and cross-industry practical experience, combined with continuously enhanced IoT basic capabilities and digital infrastructure. The Enniu.com data warehouse carries the data storage, calculation and processing capabilities of each system of each research and development company of the group. For example, the user report of Shuneng, the user behavior data of Haoqi.com, etc. Different research and development companies open their own data for other systems to access and analyze. Some fields of some tables contain user personal information, such as addresses. In order to allow other systems to share their own research and development company data and comply with data security specifications, it is necessary to desensitize some sensitive fields in the table and allow other project teams or systems to browse them to prevent sensitive data leakage, etc., and SQL field-level parsing is needed to perform desensitization control.

[0003] Among them, SQL field-level parsing for desensitization can be applied to three modules. They are data security, data query, and offline development. The research and development company defines the desensitization of its own database table fields in the data security module, and defines which project groups, research and development companies, and individuals are desensitized for the fields. For example, the Haoqi team needs to access the user behavior data of Echeng Ejia. Echeng Ejia can perform field-level desensitization on the sensitive fields in its own data for Haoqi.com users in the data security module, and Haoqi.com users can access and query the desensitized user behavior data of Echeng Ejia in data query and offline development.

[0004] The production and research companies under the group need to define security policies for accessing each other's data based on the sensitive security level of their own data, enhance the group's data sharing needs, explore the value of related data while safely managing their own sensitive data.

[0005] Druid is an open source database connection pool component that can provide powerful database connection pool functions and has powerful SQL (Structured Query Language) parsing functions.

[0006] In the prior art, the SQL parser in Druid can parse regular SQL statements, but cannot parse SQL statements containing target characters (e.g., "*"). Therefore, when the SQL statement contains the target character (e.g., "*"), the field-level blood relationship cannot be obtained. Summary of the invention

[0007] The embodiments of the present application propose a method, device and electronic device for determining field lineage relationships to solve the technical problem that field-level lineage relationships cannot be obtained in the prior art.

[0008] In a first aspect, an embodiment of the present application provides a method for determining field lineage relationships, the method comprising: converting a structured query language SQL statement into a first abstract syntax tree, the SQL statement being used to query data corresponding to a target field, the SQL statement containing at least one target character, the target character being used to indicate all columns; in order from bottom to top, taking each layer in the first abstract syntax tree as a target layer, querying a target node containing the target character in the target layer, determining a data table corresponding to the target character in the target node, replacing the target character in the target node with each field in the data table, and obtaining a second abstract syntax tree; based on the second abstract syntax tree, determining the lineage relationship of the target field.

[0009] In a second aspect, an embodiment of the present application provides a field lineage determination device, the device comprising: a conversion unit, used to convert a structured query language SQL statement into a first abstract syntax tree, the SQL statement being used to query data corresponding to a target field, the SQL statement containing at least one target character, the target character being used to indicate all columns; a replacement unit, used to take each layer in the first abstract syntax tree as a target layer in order from bottom to top, query the target node containing the target character in the target layer, determine the data table corresponding to the target character in the target node, replace the target character in the target node with each field in the data table, and obtain a second abstract syntax tree; a determination unit, used to determine the lineage of the target field based on the second abstract syntax tree.

[0010] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the first aspect.

[0011] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the first aspect.

[0012] The method, device and electronic device for determining the blood relationship of a field provided by the embodiment of the present application first converts an SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; then, in order from the bottom to the top, each layer in the first abstract syntax tree is used as the target layer, the target node containing the target character in the target layer is queried, the data table corresponding to the target character in the target node is determined, the target character in the target node is replaced with each field in the data table, and a second abstract syntax tree is obtained; finally, based on the second abstract syntax tree, the blood relationship of the target field is determined. Thus, when the target field is contained in the SQL statement, it can be successfully parsed to obtain a more complete second abstract syntax tree, thereby obtaining the blood relationship at the field level, making up for the deficiency that the blood relationship cannot be parsed when the target character is contained in the SQL statement, and improving the comprehensiveness of the SQL statement parsing. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0014] Figure 1 is a flow chart of an embodiment of a method for determining a field blood relationship according to the present application;

[0015] Figure 2 is a schematic diagram of the processing process of the field kinship determination method according to the present application;

[0016] Figure 3 It is a schematic diagram of an application scenario of the method for determining field blood relationship according to the present application;

[0017] Figure 4 It is a schematic diagram of an application scenario of the method for determining field blood relationship according to the present application;

[0018] Figure 5 is a schematic structural diagram of an embodiment of a field blood relationship determination device according to the present application;

[0019] Figure 6 It is a schematic diagram of the structure of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION

[0020] All actions to obtain signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.

[0021] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0023] Enniu.com is a smart production and operation platform formed by the group based on multi-scenario and cross-industry practical experience, combined with continuously enhanced IoT basic capabilities and digital infrastructure. The Enniu.com data warehouse carries the data storage, calculation and processing capabilities of each system of each research and development company of the group. For example, the user report of Shueneng, the user behavior data of Haoqi.com, etc. Different research and development companies open their own data for other systems to access and analyze. Some fields of some tables contain user personal information, such as addresses. In order to allow other systems to share their own research and development company data and comply with data security specifications, it is necessary to desensitize some sensitive fields in the table and allow other project teams or systems to browse them to prevent sensitive data leakage, etc., so we developed the desensitization control using field-level SQL parsing.

[0024] Among them, SQL field-level parsing for desensitization is used in three modules. They are data security, data query, and offline development. The research and development company defines the desensitization of its own database table fields in the data security module, and defines which project groups, research and development companies, and individuals are desensitized for the fields. For example, the Haoqi team needs to access the user behavior data of Echeng Ejia. Echeng Ejia can perform field-level desensitization on the sensitive fields in its own data for Haoqi.com users in the data security module, and Haoqi.com users can access and query the desensitized user behavior data of Echeng Ejia in data query and offline development.

[0025] Druid is an open source database connection pool component that provides powerful database connection pool functions and has powerful SQL parsing capabilities. Druid's SQL parsing function supports syntax parsing of multiple common database engines. The SQL parser in Druid itself is an independent parsing component that can parse complex SQL syntax.

[0026] However, since Druid's SQL parser is independent of various database engines and cannot associate metadata in the database, when encountering an SQL statement containing the target character (for example, "*"), it is unable to parse the specific field in the data table corresponding to the "*". Therefore, the SQL parser in Druid cannot parse SQL statements with "*", and cannot obtain the blood relationship of the queried fields. The embodiment of the present application can solve this technical problem. It allows the production and research companies under the group to define security policies for accessing each other's data according to the sensitive security level of their own data, enhance the group's data sharing needs, and explore the value of related data while safely managing their own sensitive data.

[0027] Please refer to Figure 1 , which shows a process 100 of an embodiment of a method for determining a field kinship relationship according to the present application. The method for determining a field kinship relationship can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to: servers, smart phones, tablet computers, laptop computers, PDAs, desktop computers, etc. The execution subject of the method for determining a field kinship relationship can be a processor in the above electronic devices.

[0028] The method for determining the field blood relationship includes the following steps:

[0029] Step 101: convert an SQL statement into a first abstract syntax tree.

[0030] In this embodiment, the execution subject of the field kinship determination method can receive an SQL statement. The SQL statement can be used to query the data corresponding to the target field. The SQL statement can be directly input by the user or extracted from the query request of the client, which is not specifically limited here. The target field can be one or more, which is not limited here.

[0031] In this embodiment, the above SQL statement may include at least one target character, and the target character may be used to indicate all columns, for example, “*”.

[0032] As an example, the SQL statement may be a simple statement, such as “SELECT * FROM xxx”, which is used to query all columns in table xxx.

[0033] As another example, the SQL statement may be a more complex nested statement containing "*", such as "SELECT id,name FROM(SELECT b.*FROM a LEFT JOIN b ON a.id=b.id)tmp". Among them, "LEFT JOIN" means a left join, with the left as the main part, and associates the data in the upper and right tables that meet the conditions. "ON" is a method used to connect two or more tables, and can associate data in different tables. "a", "b", and "tmp" are all table names. "id" and "name" are field names. "Table name.*" represents all columns in the table. The above statement is used to indicate that the records in table b that meet the condition of "a.id=b.id" (that is, the id in table a and table b are the same) are first connected to table a, and all columns in table b are queried therefrom to obtain the temporary table tmp; then the data of the field "id" and field "name" columns are queried from the temporary table tmp. The embodiment of the present application does not limit the specific form of the SQL statement.

[0034] In this embodiment, the above-mentioned execution entity can convert the SQL statement into a first abstract syntax tree. The Abstract Syntax Tree (AST) is an abstract representation of the grammatical structure of the source code. The grammatical structure of the programming language is expressed in a tree form, and each node represents a structure in the source code. As an important intermediate representation of the program, the basic formation process of the abstract syntax tree can be roughly divided into three steps, namely, first performing lexical analysis on the source program code, then performing grammatical analysis on the word stream generated by the lexical analysis, and finally performing semantic analysis to form an abstract syntax tree. As a good intermediate representation, the abstract syntax tree contains complete SQL statement information.

[0035] In this embodiment, the first abstract syntax tree may be converted in a variety of ways. For example, the first abstract syntax tree may be converted by using an existing syntax tree conversion tool or a pre-written conversion rule, which is not specifically limited here.

[0036] In some optional implementations of this embodiment, see Figure 2 The execution subject may perform lexical analysis (e.g., word segmentation, etc.) on the SQL statement through the lexical analyzer (Lexer) in the SQL parser in the target database connection pool component (e.g., Druid) to obtain a lexical analysis result. The lexical decomposition result may include but is not limited to at least one of the following: keywords, punctuation marks, user-related information, etc. in the SQL statement. Then, the lexical analysis result may be parsed through the syntax analyzer (Parser) in the SQL parser to obtain a first abstract syntax tree.

[0037] It is understandable that, since Druid's SQL parser cannot parse SQL statements containing "*", the lineage relationship of the target field cannot be obtained through the first abstract syntax tree. For example, the SQL statement is "SELECT id, name FROM (SELECT a.*, b.* FROM a LEFT JOIN b ON a.id=b.id) tmp", because the SQL statement has nested inner queries with a.* and b.*, the id and name fields in the outer query cannot be determined to be from table a or table b, resulting in the loss of field-level lineage relationship.

[0038] Step 102, in order from bottom to top, take each layer in the first abstract syntax tree as the target layer, query the target node containing the target character in the target layer, determine the data table corresponding to the target character in the target node, replace the target character in the target node with each field in the data table, and obtain the second abstract syntax tree.

[0039] In this embodiment, the execution subject may sequentially use each layer in the first abstract syntax tree as a target layer in order from the bottom layer to the top layer, and perform the following steps:

[0040] The first step is to search for target nodes in the target layer that contain the target character. Here, the target layer can be searched for the target character (eg, "*") by keyword search.

[0041] The second step is to determine the data table corresponding to the target character in the target node.

[0042] Optionally, since "table name.*" represents all columns in the table, the prefix of the target character in the target node may be queried first; then, the prefix is ​​used as the table name to query and determine the data table corresponding to the target character in the target node.

[0043] For example, the target node contains "b.*". The prefix of "*" is "b", so the data table named "b" can be queried. Figure 2 , all fields of this data table can be obtained by querying the database metadata. In practice, the execution subject can map the target character in the target node with the table information and record it. The table information may include the table name of the data table, the information of the stored database, etc. Thus, all columns in the data table can be queried by accessing the database.

[0044] The third step is to replace the target characters in the target node with the fields in the data table.

[0045] Optionally, the execution subject may first obtain each field in the data table; then, summarize the obtained fields and separate them with target symbols to obtain a target sentence; finally, replace the target characters in the target node with the target sentence.

[0046] Continuing with the above example, the fields in the data table named "b" include id, name, and sal. The target symbol can be a comma "," . The above execution entity can aggregate the fields id, name, and sal and separate them with a comma "," to obtain the target statement "b.id, b.name, b.sal", thereby replacing "b.*" with "b.id, b.name, b.sal".

[0047] In this embodiment, after performing the above operations on each layer in the first abstract syntax tree, a second abstract syntax tree can be obtained. It is understandable that when the node of a certain layer does not contain the target character, the operation may not be performed. The second abstract syntax tree does not contain the target character. Through the second abstract syntax tree, the blood relationship at the field level can be obtained, that is, the source data table where the data of the queried target field is located can be determined through the second abstract syntax tree.

[0048] The following is an example of a specific application scenario. First, the execution subject receives the following SQL statement:

[0049] SELECT

[0050] id,

[0051] name

[0052] FROM (

[0054] SELECT

[0055] b.*

[0056] FROM tba a

[0057] LEFT JOIN tbb b

[0058] ON a.id=b.id

[0059] )tmp”

[0060] It means that the records in table b that meet the condition of "a.id=b.id" (that is, the id in table a and table b are the same) are first connected to table a (that is, tba, aliased as a), and all columns in table b (that is, tbb, aliased as b) are queried from it to obtain the temporary table tmp; then the data corresponding to the fields "id" and "name" are queried from the temporary table tmp.

[0061] The first abstract syntax tree of this SQL statement conversion is divided into two layers. The first layer is the associated query in the brackets, and the second layer is the result output outside the brackets. Figure 3 , the first layer's table sources are tba and tbb, the output columns are b.*, and the first layer's output columns come from tbb. The second layer takes the first layer's output as input, and the output id and name corresponding data come from the first layer's tbb.

[0062] When processing the first abstract syntax tree, see Figure 4 For the first layer, when the target character "*" is encountered during the traversal, the data table corresponding to the target character can be determined based on the prefix. By querying the database metadata, all fields of this data table can be obtained: id, name, and sal. Then, these fields can be used to replace the target character "*". For the second layer, the corresponding data can be queried from the output column of the first layer.

[0063] By replacing the target fields in the first abstract syntax tree layer by layer, a second abstract syntax tree with more complete information can be obtained. Since the second abstract syntax tree has complete information, the source data table of the data corresponding to the queried target field can be known through the second abstract syntax tree, thereby obtaining the field-level lineage relationship.

[0064] In some optional implementations of this embodiment, before taking each layer in the first abstract syntax tree as the target layer in order from the bottom layer to the top layer, see Figure 2 The execution subject can obtain the first abstract syntax tree through the syntax tree visitor (eg, visitor) in the target database connection pool component. The syntax tree visitor is a tool for traversing the abstract syntax tree and is the most convenient tool for processing the abstract syntax tree.

[0065] Step 103: Determine the blood relationship of the target field based on the second abstract syntax tree.

[0066] In this embodiment, since the target characters in the second abstract syntax tree are all replaced with specific fields, the source table of the target field can be determined based on the second abstract syntax tree to obtain the blood relationship of the target field.

[0067] In some optional implementations of this embodiment, the execution subject may first determine the source data table of the target field based on the second abstract syntax tree. The source data table is the source data table of the target field. Then, the correspondence information between the target field and the source data table may be generated. Finally, the correspondence information may be output. The correspondence information may characterize the blood relationship of the target field. Thus, the user may know the data table to which the data corresponding to the target field queried by the SQL statement belongs.

[0068] In some optional implementations of this embodiment, after determining the blood relationship of the target field, the above-mentioned execution subject can also determine whether the data corresponding to the target field needs to be encrypted based on the blood relationship. For example, if the data in the target field in the source data table needs to be encrypted, the data corresponding to the queried target field also needs to be encrypted. If encryption is required, the data corresponding to the target field can be encrypted to obtain encrypted data, and then the encrypted data is output. In this way, the desensitization requirements of some field-level data can be met.

[0069] The method provided by the above embodiment of the present application first converts the SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; then, in order from the bottom to the top, each layer in the first abstract syntax tree is taken as the target layer, the target node containing the target character in the target layer is queried, the data table corresponding to the target character in the target node is determined, and the target character in the target node is replaced with each field in the data table to obtain a second abstract syntax tree; finally, based on the second abstract syntax tree, the blood relationship of the target field is determined. Thus, when the target field is contained in the SQL statement, it can be successfully parsed to obtain a more complete second abstract syntax tree, thereby obtaining the blood relationship at the field level, making up for the deficiency that the blood relationship cannot be parsed when the target character is contained in the SQL statement, and improving the comprehensiveness of the SQL statement parsing.

[0070] Further references Figure 5 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a field blood relationship determination device, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0071] like Figure 5 As shown, the field lineage determination device 500 of this embodiment includes: a conversion unit 501, which is used to convert a structured query language SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; a replacement unit 502, which is used to take each layer in the first abstract syntax tree as the target layer in order from the bottom layer to the top layer, query the target node containing the target character in the target layer, determine the data table corresponding to the target character in the target node, replace the target character in the target node with each field in the data table, and obtain a second abstract syntax tree; a determination unit 503, which is used to determine the lineage of the target field based on the second abstract syntax tree.

[0072] In some optional implementations of this embodiment, the replacement unit 502 is further used to: query the prefix of the target character in the target node; use the prefix as the table name to query the data table corresponding to the target character in the target node.

[0073] In some optional implementations of the present embodiment, the replacement unit 502 is further used to: obtain each field in the data table; summarize the obtained fields and separate them with target symbols to obtain a target sentence; replace the target characters in the target node with the target sentence.

[0074] In some optional implementations of this embodiment, the above-mentioned determination unit 503 is further used to: determine the source data table of the above-mentioned target field and the source field in the above-mentioned source data table based on the above-mentioned second abstract syntax tree; generate the correspondence information between the above-mentioned target field, the above-mentioned source data table and the above-mentioned source field; and output the above-mentioned correspondence information.

[0075] In some optional implementations of this embodiment, the above-mentioned device also includes: an encryption unit, used to determine whether the data corresponding to the above-mentioned target field needs to be encrypted based on the above-mentioned blood relationship; if encryption is required, encrypting the data corresponding to the above-mentioned target field to obtain encrypted data; and outputting the above-mentioned encrypted data.

[0076] In some optional implementations of this embodiment, the above-mentioned conversion unit 501 is further used to: perform lexical analysis on the SQL statement through the lexical analyzer in the SQL parser in the target database connection pool component to obtain a lexical analysis result; and assemble the above-mentioned lexical analysis results through the syntax analyzer in the above-mentioned SQL parser to obtain a first abstract syntax tree.

[0077] In some optional implementations of this embodiment, the apparatus further includes: an acquisition unit, configured to acquire the first abstract syntax tree through a syntax tree accessor in the target database connection pool component.

[0078] The device provided by the above embodiment of the present application first converts the SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; then, in order from the bottom to the top, each layer in the first abstract syntax tree is taken as the target layer, the target node containing the target character in the target layer is queried, the data table corresponding to the target character in the target node is determined, and the target character in the target node is replaced with each field in the data table to obtain a second abstract syntax tree; finally, based on the second abstract syntax tree, the blood relationship of the target field is determined. Therefore, when the target field is contained in the SQL statement, it can be successfully parsed to obtain a more complete second abstract syntax tree, thereby obtaining the blood relationship at the field level, making up for the deficiency that the blood relationship cannot be parsed when the target character is contained in the SQL statement, and improving the comprehensiveness of the SQL statement parsing.

[0079] Reference below Figure 6 , which shows a schematic structural diagram of an electronic device for implementing some embodiments of the present application. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0080] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0081] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a disk, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0082] In particular, according to some embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of some embodiments of the present application are executed.

[0083] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0084] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0085] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: converts a structured query language SQL statement into a first abstract syntax tree, the SQL statement is used to query the data corresponding to the target field, the SQL statement contains at least one target character, and the target character is used to indicate all columns; in order from the bottom to the top, each layer in the first abstract syntax tree is used as the target layer, the target node containing the target character in the target layer is queried, the data table corresponding to the target character in the target node is determined, and the target character in the target node is replaced with each field in the data table to obtain a second abstract syntax tree; based on the second abstract syntax tree, the blood relationship of the target field is determined.

[0086] Computer program code for performing the operations of some embodiments of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++; and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, or may be connected to an external computer (e.g., through the Internet using an Internet service provider), including a local area network (LAN) or a wide area network (WAN).

[0087] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0088] The units described in some embodiments of the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a first determination unit, a second determination unit, a selection unit, and a third determination unit. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0089] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0090] The above description is only some preferred embodiments of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with (but not limited to) the technical features with similar functions disclosed in the embodiments of the present application to form a technical solution.

Claims

1. A method for determining field blood relationship, characterized in that: The method comprises: Converting a structured query language SQL statement into a first abstract syntax tree, wherein the SQL statement is used to query data corresponding to a target field, and the SQL statement contains at least one target character, and the target character is used to indicate all columns; In order from the bottom layer to the top layer, each layer in the first abstract syntax tree is taken as a target layer, a target node in the target layer containing the target character is queried, a data table corresponding to the target character in the target node is determined, and the target character in the target node is replaced with each field in the data table to obtain a second abstract syntax tree; Based on the second abstract syntax tree, a lineage relationship of the target field is determined.

2. The method according to claim 1, characterized in that The step of determining a data table corresponding to the target character in the target node includes: Query the prefix of the target character in the target node; The prefix is ​​used as a table name to query a data table corresponding to the target character in the target node.

3. The method according to claim 1, characterized in that The step of replacing the target character in the target node with each field in the data table includes: Obtain each field in the data table; Summarize the acquired fields and separate them with target symbols to obtain the target sentence; The target character in the target node is replaced by the target sentence.

4. The method according to claim 1, characterized in that: The determining, based on the second abstract syntax tree, the blood relationship of the target field includes: Determine a source data table of the target field based on the second abstract syntax tree; Generate corresponding relationship information between the target field and the source data table; The corresponding relationship information is output.

5. The method according to claim 1, characterized in that After determining the blood relationship of the target field, the method further includes: Based on the blood relationship, determining whether the data corresponding to the target field needs to be encrypted; If encryption is required, encrypt the data corresponding to the target field to obtain encrypted data; The encrypted data is output.

6. The method according to claim 1, characterized in that The method of converting the structured query language SQL statement into a first abstract syntax tree further comprises: The SQL statement is lexically parsed by the lexical analyzer in the SQL parser in the target database connection pool component to obtain the lexical parsing result; The lexical analysis result is subjected to grammatical analysis by a grammatical analyzer in the SQL parser to obtain a first abstract syntax tree.

7. The method according to claim 6, characterized in that Before taking each layer in the first abstract syntax tree as a target layer in order from the bottom layer to the top layer, the method further includes: The first abstract syntax tree is obtained through a syntax tree accessor in the target database connection pool component.

8. A device for determining field blood relationship, characterized in that: The device comprises: a conversion unit, configured to convert a structured query language SQL statement into a first abstract syntax tree, wherein the SQL statement is used to query data corresponding to a target field, and the SQL statement contains at least one target character, and the target character is used to indicate all columns; a replacement unit, configured to sequentially use each layer in the first abstract syntax tree as a target layer in order from the bottom layer to the top layer, query a target node in the target layer that contains the target character, determine a data table corresponding to the target character in the target node, and replace the target character in the target node with each field in the data table to obtain a second abstract syntax tree; A determining unit is used to determine the blood relationship of the target field based on the second abstract syntax tree.

9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.