Multi-source heterogeneous database SQL statement sensitivity calculation method
By performing sensitivity calculation and noise addition to SQL statements in a multi-source heterogeneous database environment, the challenge of data privacy protection by complex SQL statements is solved, and the balance between data privacy protection and analysis value is achieved.
Patent Information
- Application Number
- CN202411687174.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-11-25
AI Technical Summary
In a multi-source heterogeneous database environment, the execution of complex SQL statements poses a challenge to data privacy protection. How to accurately calculate and add appropriate amount of noise to achieve the optimal The effect of privacy protection has become a technical difficulty.
Provide a multi-source heterogeneous database SQL statement sensitivity calculation method, which identifies and processs the syntax features in complex SQL statements through four stages: SQL reception and parsing, abstract syntax tree rewriting, serialization and sensitivity calculation. Abstract syntax tree, conducts semantic analysis and logical analysis, combines the metadata information of the target database, calls a preset sensitivity evaluation algorithm, calculates the sensitivity of the statement and guides the addition of noise.
It realizes accurate sensitivity calculations for complex SQL query statements, reduces usage costs, guarantees user query experience, ensures privacy protection effect, and retains the analysis value of data to the greatest extent, solving the privacy leakage problem.
Smart Images

Figure CN119166671A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of SQL query technology, and in particular to a method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database. Background Art
[0002] With the prevalence of big data and cloud computing, multi-source heterogeneous database environments have become the norm for data collection, storage, and analysis, which include data sets from different sources, formats, and structures, such as relational databases, NoSQL databases, file systems, etc. Data queries in this environment, especially the execution of complex SQL statements, pose severe challenges to data privacy protection. Complex SQL statements, which usually involve multi-table joins, subqueries, aggregate functions, etc., not only increase the semantic complexity of queries, but also make it extremely difficult to accurately assess the impact of queries on sensitive data, thereby amplifying the potential risk of privacy leakage. For example, a query containing multiple JOIN and GROUP BY operations may inadvertently leak a large amount of private information. How to effectively protect data privacy while maintaining the practicality of data and the accuracy of analysis results when executing such statements has become a key issue that needs to be solved urgently.
[0003] As an effective privacy protection technology, differential privacy protects individual privacy by adding an appropriate amount of random noise to the query results to ensure that the query results do not change much when including or excluding a certain individual's data. However, how to accurately calculate and add the appropriate amount of noise in complex SQL statements to achieve the best privacy protection effect while minimizing the impact on data utility is a technical difficulty. Especially in a multi-source heterogeneous database environment, because it is necessary to consider the distribution characteristics of the data, the complexity of the query, and the heterogeneity between data sources, measuring the sensitivity of the query results to changes in a single data record, that is, sensitivity calculation, becomes more complicated. Therefore, developing a calculation method that can accurately evaluate the sensitivity of complex SQL statements and guide the addition of noise accordingly is crucial to achieve a balance between data utility and privacy protection. This requires the technical solution to not only have a deep understanding of the structure and semantics of SQL statements, but also to be able to effectively integrate data fusion, query optimization, and privacy protection technologies to meet the data processing needs in a multi-source heterogeneous environment. Summary of the invention
[0004] In response to the needs and shortcomings of current technological development, the present invention provides a method for calculating the sensitivity of SQL statements in multi-source heterogeneous databases. The method is compatible with query dialects of different types of databases, accurately calculates the sensitivity of complex SQL query statements, reduces usage costs and ensures user query experience, while guiding the reasonable addition of differential privacy noise, and retains the analytical value of the data to the greatest extent while ensuring the privacy protection effect.
[0005] The present invention provides a method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database. The technical solution adopted to solve the above technical problems is as follows: A method for calculating the sensitivity of SQL statements in multi-source heterogeneous databases includes the following four stages: S1, SQL receiving and parsing stage: receiving the user's SQL query request, checking and preprocessing the SQL query request, then breaking it into a group of lexical units, and then combining them to generate an abstract syntax tree, and verifying the abstract syntax tree; S2, abstract syntax tree rewriting phase: traverse the abstract syntax tree and identify the syntax features that need to be processed; define a set of rewriting rules for the syntax features that need to be processed; modify and optimize the corresponding nodes in the abstract syntax tree according to the defined rewriting rules; S3, serialization stage: select the serialization format of the abstract syntax tree and convert the optimized abstract syntax tree into corresponding serialized data; S4, sensitivity calculation stage: perform semantic analysis and logical analysis on the serialized data, bind the semantic information contained in the SQL query request with the metadata information of the target database, call the preset sensitivity assessment algorithm, perform sensitivity calculation on the SQL query request, and the calculated sensitivity is used to guide the addition of data noise in the SQL query results.
[0006] Optionally, the step S1 involved specifically includes: S1.1. Receive a SQL query request from a user, where the SQL query request supports multiple SQL dialects, including standard SQL and dialects of databases such as MySQL, Oracle, SQL Server, and PostgreSQL; S1.2. Verify the SQL query request. The verification process includes verifying whether the SQL query request is a valid SQL statement, whether it contains potential malicious code or SQL injection attempts through regular expression matching, blacklist / whitelist filtering or preset SQL injection protection mechanism; S1.3. After the verification is passed, the SQL query request is preprocessed by removing comments, normalizing spaces, and unifying upper and lower case characters; S1.4, decomposing the preprocessed SQL query request into a group of lexical units, and combining the group of lexical units into an abstract syntax tree according to the grammatical rules corresponding to the SQL query request; S1.5. Verify the abstract syntax tree, including: verifying whether the table name and column name involved in the abstract syntax tree node exist in the target database; checking whether the user has the required permissions to execute the query.
[0007] Further optionally, the step S1.3 involves preprocessing the SQL query request by removing comments, normalizing spaces, and unifying upper and lower case, wherein: The removing of comments comprises: traversing the SQL query string, removing single-line comments and multi-line comments; The space normalization includes: normalizing the blank characters in the SQL query request to ensure consistency and accuracy during parsing; The case unification includes: performing case unification processing on keywords and identifiers in the SQL query request according to the type of the SQL query request.
[0008] Optionally, the specific operation of executing step S1.4 to obtain the abstract syntax tree is as follows: S1.4.1. Build a lexical analyzer that splits the preprocessed SQL query string into a set of lexical units according to five categories: keywords, identifiers, operators, numbers, and string constants. During the splitting process, if the lexical analyzer finds unrecognizable characters, it generates an error message and indicates the error location. S1.4.2. According to the syntax rules corresponding to the SQL query request, a syntax analyzer is constructed. The syntax analyzer recognizes and parses subqueries, JOIN operations, and GROUP BY statements, thereby identifying the relationship between lexical units, generating corresponding abstract syntax tree nodes, and generating meta-information including query type, table names involved, and column names; S1.4.3. During the generation of the abstract syntax tree, a syntax check is performed and when a syntax error is found, a detailed error message is generated, indicating the specific location and cause of the error.
[0009] Further optionally, the step S2 involved specifically includes: S2.1, traverse the abstract syntax tree and identify the syntax features that need to be processed in a specified manner, wherein the syntax features that need to be processed in a specified manner include aggregate functions, multi-layer subqueries, complex JOIN operations, GROUP BY and ORDER BY clauses; S2.2, define a set of rewriting rules for the grammatical features that need to be processed; S2.3. Modify the corresponding nodes in the abstract syntax tree according to the defined rewriting rules. The specific modification operations include: ① Replace the nodes, replace the old function nodes with new function expressions; ② Add nodes, add additional nodes required for noise generation logic; ③ Delete nodes, delete redundant nodes that do not affect the query results but may leak privacy; S2.4. After applying all necessary rewrite rules to modify the abstract syntax tree, further optimize the abstract syntax tree to improve the execution efficiency of the query, wherein the optimization measures include: identifying and removing repeated or unnecessary calculation logic, selecting relatively efficient indexes, adjusting the order of connection operations, and simplifying expressions.
[0010] Further optionally, the step S3 involved specifically includes: S3.1. Select the serialization format of the abstract syntax tree based on the specific requirements and performance considerations of the system. The serialization formats of the abstract syntax tree include JSON, XML, Protocol Buffers, YAML, Avro, MessagePack, and CBOR. S3.2. Use the selected serialization format to convert the optimized abstract syntax tree into corresponding serialized data to ensure the integrity and consistency of the query request during transmission across systems or components.
[0011] Further optionally, when executing step S3.2, it is necessary to ensure that all information in the abstract syntax tree can be accurately encoded into the serialized data, including node types, node attributes and child node relationships.
[0012] Further optionally, after executing step S3 and converting the optimized abstract syntax tree into corresponding serialized data: Adding necessary meta information to the serialized data to assist in subsequent parsing and processing, the necessary meta information includes SQL dialect information and a list of rules applied during the rewriting process; Verify the generated serialized data to ensure that it fully contains all the information of the abstract syntax tree and does not introduce any unexpected errors or inconsistencies.
[0013] Further optionally, the step S4 involved specifically includes: S4.1. Performing semantic analysis and logical analysis on the serialized data to obtain semantic information and logical structure contained in the SQL query request, wherein the semantic analysis on the serialized data includes extracting identifiers, operators, functions, and table names and field names involved contained in the SQL query request; the logical analysis on the serialized data includes extracting node types, node attributes, and sub-node relationships contained in the SQL query request; S4.2. Obtain metadata information of the target database, bind the semantic information contained in the SQL query request with the metadata of the target database, and ensure that the objects involved in the query exist in the target database and meet expectations; S4.3. Call a preset sensitivity evaluation algorithm, perform sensitivity calculation based on the logical structure of the SQL query request and the bound metadata information, and obtain the sensitivity of the SQL query request. The obtained sensitivity is used to add data noise to the SQL query result.
[0014] Preferably, the preset sensitivity assessment algorithm is at least one of a rule-based assessment, a statistics-based assessment, a machine learning-based assessment, a graph structure-based assessment, a risk matrix-based assessment, and a context-based assessment.
[0015] Compared with the prior art, the method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database of the present invention has the following beneficial effects: 1. The present invention is compatible with query dialects of different types of databases, accurately calculates the sensitivity of complex SQL query statements, reduces usage costs, and ensures user query experience, thereby facilitating subsequent guidance on the reasonable addition of differential privacy noise, while ensuring the privacy protection effect and retaining the analytical value of the data to the greatest extent; 2. The present invention calculates the sensitivity of complex SQL query statements, which facilitates the subsequent reasonable addition of differential privacy noise, can solve the problem of privacy leakage in query statistics and user data collection scenarios, and achieves the goal of high data availability on the basis of protecting user privacy in the query and collection process; 3. By introducing an abstract syntax tree rewriting and serialization mechanism, the present invention can rewrite complex feature structures into a form that is convenient for calculating sensitivity, ensure the integrity and consistency of query requests during transmission across systems or components, and improve the accuracy of sensitivity calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Attached Figure 1 is a flow chart of a method according to Embodiment 1 of the present invention; Attached Figure 2 is a flowchart of step S1 in embodiment 1 of the present invention; Attached Figure 3 is a flowchart of step S2 in embodiment 1 of the present invention; Attached Figure 4 is a flowchart of step S3 in embodiment 1 of the present invention; Attached Figure 5 This is a flowchart of step S4 in the first embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to make the technical solution, the technical problem solved and the technical effect of the present invention more clearly understood, the technical solution of the present invention is clearly and completely described below in conjunction with specific embodiments.
[0018] Embodiment 1: Combining with the attached Figure 1-5This embodiment proposes a method for calculating the sensitivity of SQL statements in multi-source heterogeneous databases, and its implementation includes the following four stages: S1, SQL reception and parsing stage: S1.1. Receive a SQL query request from a user, where the SQL query request supports multiple SQL dialects, including standard SQL (such as ANSI SQL) and dialects of databases such as MySQL, Oracle, SQL Server, and PostgreSQL; S1.2. Verify the SQL query request. The verification process includes verifying whether the SQL query request is a valid SQL statement, whether it contains potential malicious code or SQL injection attempts through regular expression matching, blacklist / whitelist filtering or preset SQL injection protection mechanism; S1.3. After the inspection is passed, the SQL query request is preprocessed by removing comments, normalizing spaces, and unifying upper and lower case characters, wherein: removing comments includes traversing the SQL query string, removing single-line comments (such as lines starting with -- or lines starting with #, depending on the SQL dialect) and multi-line comments (such as / * ... * / ); normalizing spaces includes standardizing the blank characters in the SQL query request to ensure consistency and accuracy during parsing; unifying upper and lower case characters includes unifying the upper and lower case characters of keywords and identifiers in the SQL query request according to the type of the SQL query request; S1.4. Decompose the preprocessed SQL query request into a group of lexical units, and combine the group of lexical units into an abstract syntax tree according to the grammatical rules corresponding to the SQL query request. The specific operations include: S1.4.1. Build a lexical analyzer that splits the preprocessed SQL query string into a set of lexical units according to five categories: keywords (such as SELECT, FROM, WHERE), identifiers (such as table names, field names), operators (such as =, <>, AND, OR), numbers, and string constants. During the splitting process, if the lexical analyzer finds unrecognizable characters, it generates an error message and indicates the error location; S1.4.2. According to the syntax rules corresponding to the SQL query request, a syntax analyzer is constructed. The syntax analyzer recognizes and parses subqueries, JOIN operations, and GROUP BY statements, thereby identifying the relationship between lexical units, generating corresponding abstract syntax tree nodes, and generating meta-information including query type, table names involved, and column names; S1.4.3. During the process of generating the abstract syntax tree, perform syntax checking and generate detailed error information when syntax errors are found, indicating the specific location and cause of the error; S1.5. Verify the abstract syntax tree, including: verifying whether the table name and column name involved in the abstract syntax tree node exist in the target database; checking whether the user has the required permissions to execute the query.
[0019] S2, abstract syntax tree rewriting phase: S2.1, traverse the abstract syntax tree and identify the syntax features that need to be processed, including aggregate functions (such as SUM, AVG, COUNT, etc.), multi-layer subqueries, complex JOIN operations, GROUP BY and ORDER BY clauses; S2.2. Define a set of rewriting rules for the grammatical features that need to be processed; for example, for the AVG function, define a rule to rewrite it into a division expression of the SUM function and the COUNT function, so that the metadata information and sensitivity algorithm involved in the SUM function and the COUNT function can be used in subsequent processing to calculate the overall sensitivity; S2.3. Modify the corresponding nodes in the abstract syntax tree according to the defined rewriting rules. The specific modification operations include: ① Replace the nodes, replace the old function nodes with new function expressions; ② Add nodes, add additional nodes required for noise generation logic; ③ Delete nodes, delete redundant nodes that do not affect the query results but may leak privacy; S2.4. After applying all necessary rewrite rules to modify the abstract syntax tree, further optimize the abstract syntax tree to improve the execution efficiency of the query, wherein the optimization measures include: identifying and removing repeated or unnecessary calculation logic, selecting relatively efficient indexes, adjusting the order of connection operations, and simplifying expressions.
[0020] S3, serialization phase: S3.1. Select the serialization format of the abstract syntax tree based on the specific requirements and performance considerations of the system. The serialization formats of the abstract syntax tree include JSON, XML, Protocol Buffers, YAML, Avro, MessagePack, and CBOR. S3.2. Use the selected serialization format to convert the optimized abstract syntax tree into corresponding serialized data to ensure the integrity and consistency of the query request during the transmission across systems or components. At the same time, ensure that all information in the abstract syntax tree can be accurately encoded into the serialized data, including node types, node attributes, and child node relationships; S3.3, adding necessary meta information to the serialized data to assist in subsequent parsing and processing, wherein the necessary meta information includes SQL dialect information and a list of rules applied during the rewriting process; S3.4. Verify the generated serialized data to ensure that the serialized data completely contains all the information of the abstract syntax tree and does not introduce any unexpected errors or inconsistencies.
[0021] S4, sensitivity calculation stage: S4.1. Performing semantic analysis and logical analysis on the serialized data to obtain semantic information and logical structure contained in the SQL query request, wherein the semantic analysis on the serialized data includes extracting identifiers, operators, functions, and table names and field names involved contained in the SQL query request; the logical analysis on the serialized data includes extracting node types, node attributes, and sub-node relationships contained in the SQL query request; S4.2. Obtain metadata information of the target database, bind the semantic information contained in the SQL query request with the metadata of the target database, and ensure that the objects involved in the query exist in the target database and meet expectations; S4.3. Call a preset sensitivity evaluation algorithm, perform sensitivity calculation based on the logical structure of the SQL query request and the bound metadata information, and obtain the sensitivity of the SQL query request. The obtained sensitivity is used to add data noise to the SQL query result.
[0022] The preset sensitivity assessment algorithm is at least one of rule-based assessment, weight-based assessment, historical data-based assessment and graph structure-based assessment. Among them: ① The rule-based assessment algorithm defines a set of rules to match and score according to the operation type, table name, field name and other features contained in the SQL query request. For example, some operations (such as DELETE, UPDATE) may be more sensitive than SELECT; ② The statistical-based assessment algorithm uses historical data or metadata information to perform statistical analysis on SQL query requests, for example, to count the access frequency and update frequency of a table, so as to assess its sensitivity; ③ The machine learning-based assessment algorithm uses a machine learning model to classify and score SQL query requests. Through the training data set, the machine learning model can learn which The feature combination corresponds to a SQL query with high sensitivity or low sensitivity; ④ The evaluation algorithm based on the graph structure represents the SQL query request as a graph structure, where nodes represent tables and fields, and edges represent relationships. Its sensitivity is evaluated by analyzing the structural characteristics of the graph (such as path length, connection complexity, etc.); ⑤ The evaluation algorithm based on the risk matrix defines a risk matrix, finds the corresponding risk value according to the tables, fields and operation types involved in the SQL query request, and calculates the total risk score; ⑥ The context-based evaluation algorithm considers the context information of the SQL query request, such as user role, current time, business logic, etc., and dynamically adjusts the sensitivity evaluation results.
[0023] In summary, the method for calculating the sensitivity of SQL statements in multi-source heterogeneous databases of the present invention can efficiently be compatible with query dialects of different types of databases, accurately calculate the sensitivity of complex SQL query statements, solve the problem of privacy leakage in query statistics and user data collection scenarios, and achieve the goal of high data availability on the basis of protecting user privacy during the query and collection process.
[0024] The above specific examples are used to explain the principles and implementation methods of the present invention in detail. These examples are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, any improvements and modifications made by technicians in this technical field without departing from the principles of the present invention should fall within the scope of patent protection of the present invention.
Claims
1. A method for calculating the sensitivity of SQL statements in multi-source heterogeneous databases, characterized in that: Its implementation includes the following four stages: S1, SQL receiving and parsing stage: receiving the user's SQL query request, checking and preprocessing the SQL query request, then breaking it into a group of lexical units, and then combining them to generate an abstract syntax tree, and verifying the abstract syntax tree; S2, abstract syntax tree rewriting phase: traverse the abstract syntax tree and identify the grammatical features that need to be processed; Define a set of rewriting rules for the grammatical features that need to be processed; modify and optimize the corresponding nodes in the abstract syntax tree according to the defined rewriting rules; S3, serialization stage: select the serialization format of the abstract syntax tree and convert the optimized abstract syntax tree into corresponding serialized data; S4, sensitivity calculation stage: perform semantic analysis and logical analysis on the serialized data, bind the semantic information contained in the SQL query request with the metadata information of the target database, call the preset sensitivity assessment algorithm, perform sensitivity calculation on the SQL query request, and the calculated sensitivity is used to guide the addition of data noise in the SQL query results.
2. A method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 1, characterized in that: The step S1 specifically includes: S1.
1. Receive a SQL query request from a user, where the SQL query request supports multiple SQL dialects, including standard SQL and dialects of databases such as MySQL, Oracle, SQL Server, and PostgreSQL; S1.
2. Verify the SQL query request. The verification process includes verifying whether the SQL query request is a valid SQL statement, whether it contains potential malicious code or SQL injection attempts through regular expression matching, blacklist / whitelist filtering or preset SQL injection protection mechanism; S1.
3. After the verification is passed, the SQL query request is preprocessed by removing comments, normalizing spaces, and unifying upper and lower case characters; S1.4, decomposing the preprocessed SQL query request into a group of lexical units, and combining the group of lexical units into an abstract syntax tree according to the grammatical rules corresponding to the SQL query request; S1.
5. Verify the abstract syntax tree, including: verifying whether the table name and column name involved in the abstract syntax tree node exist in the target database; checking whether the user has the required permissions to execute the query.
3. A method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 2, characterized in that: The step S1.3 performs preprocessing operations on the SQL query request by removing comments, normalizing spaces, and unifying upper and lower case, wherein: The removing of comments comprises: traversing the SQL query string, removing single-line comments and multi-line comments; The space normalization includes: normalizing the blank characters in the SQL query request to ensure consistency and accuracy during parsing; The case unification includes: performing case unification processing on keywords and identifiers in the SQL query request according to the type of the SQL query request.
4. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 2, characterized in that: Execute step S1.4 to obtain the abstract syntax tree as follows: S1.4.
1. Build a lexical analyzer that splits the preprocessed SQL query string into a set of lexical units according to five categories: keywords, identifiers, operators, numbers, and string constants. During the splitting process, if the lexical analyzer finds unrecognizable characters, it generates an error message and indicates the error location. S1.4.
2. According to the syntax rules corresponding to the SQL query request, a syntax analyzer is constructed. The syntax analyzer recognizes and parses subqueries, JOIN operations, and GROUP BY statements, thereby identifying the relationship between lexical units, generating corresponding abstract syntax tree nodes, and generating meta-information including query type, table names involved, and column names; S1.4.
3. During the generation of the abstract syntax tree, a syntax check is performed and when a syntax error is found, a detailed error message is generated, indicating the specific location and cause of the error.
5. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 1, characterized in that: The step S2 specifically includes: S2.1, traverse the abstract syntax tree and identify the syntax features that need to be processed in a specified manner, wherein the syntax features that need to be processed in a specified manner include aggregate functions, multi-layer subqueries, complex JOIN operations, GROUP BY and ORDER BY clauses; S2.2, define a set of rewriting rules for the grammatical features that need to be processed; S2.
3. Modify the corresponding nodes in the abstract syntax tree according to the defined rewriting rules. The specific modification operations include: ① Replace the nodes, replace the old function nodes with new function expressions; ② Add nodes, add additional nodes required for noise generation logic; ③ Delete nodes, delete redundant nodes that do not affect the query results but may leak privacy; S2.
4. After applying all necessary rewrite rules to modify the abstract syntax tree, further optimize the abstract syntax tree to improve the execution efficiency of the query, wherein the optimization measures include: identifying and removing repeated or unnecessary calculation logic, selecting relatively efficient indexes, adjusting the order of connection operations, and simplifying expressions.
6. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 1, characterized in that: The step S3 specifically includes: S3.
1. Select the serialization format of the abstract syntax tree based on the specific requirements and performance considerations of the system. The serialization formats of the abstract syntax tree include JSON, XML, Protocol Buffers, YAML, Avro, MessagePack, and CBOR. S3.
2. Use the selected serialization format to convert the optimized abstract syntax tree into corresponding serialized data to ensure the integrity and consistency of the query request during transmission across systems or components.
7. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 6, characterized in that: When executing step S3.2, it is necessary to ensure that all information in the abstract syntax tree can be accurately encoded into the serialized data, including node types, node attributes, and child node relationships.
8. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 6, characterized in that: After executing step S3 and converting the optimized abstract syntax tree into corresponding serialized data: Adding necessary meta information to the serialized data to assist in subsequent parsing and processing, the necessary meta information includes SQL dialect information and a list of rules applied during the rewriting process; Verify the generated serialized data to ensure that it fully contains all the information of the abstract syntax tree and does not introduce any unexpected errors or inconsistencies.
9. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 1, characterized in that: The step S4 specifically includes: S4.
1. Performing semantic analysis and logical analysis on the serialized data to obtain semantic information and logical structure contained in the SQL query request, wherein the semantic analysis on the serialized data includes extracting identifiers, operators, functions, and table names and field names involved contained in the SQL query request; the logical analysis on the serialized data includes extracting node types, node attributes, and sub-node relationships contained in the SQL query request; S4.
2. Obtain metadata information of the target database, bind the semantic information contained in the SQL query request with the metadata of the target database, and ensure that the objects involved in the query exist in the target database and meet expectations; S4.
3. Call a preset sensitivity evaluation algorithm, perform sensitivity calculation based on the logical structure of the SQL query request and the bound metadata information, and obtain the sensitivity of the SQL query request. The obtained sensitivity is used to add data noise to the SQL query result.
10. The method for calculating the sensitivity of SQL statements in a multi-source heterogeneous database according to claim 9, characterized in that: The preset sensitivity assessment algorithm is at least one of rule-based assessment, statistics-based assessment, machine learning-based assessment, graph structure-based assessment, risk matrix-based assessment, and context-based assessment.
Citation Information
Patent Citations
Data desensitization method and device, computer readable storage medium and electronic equipment
CN112560100A
Statement rewriting method, system and device
CN117033418A
Cross-data-source hybrid engine query method, system and equipment and medium
CN117668050A
Data query method and device
CN118094614A
Differential privacy noise adding method and device, medium and electronic equipment
CN118246055A
Cited By
Generative data analysis security permission protection method
CN119358030A
Data query method, related device, equipment and storage medium
CN119848935A
Automatic sensitivity modeling method and system for full life cycle of equipment
CN121051793A
SQL statement generation method and device and electronic equipment
CN121070970A
Anti-confusion method and system for LDAP query statement
CN122533874A
