Query result determination method and device, storage medium and electronic equipment
By using identity tokens to determine query permissions, replacing keywords with a vector database to generate a standard query format, and combining syntax validation and risk detection, the problems of data overreach and low query accuracy caused by colloquial user query requests are solved, thus achieving both accuracy and security in query results.
Patent Information
- Application Number
- CN202610811279.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-08-25
AI Technical Summary
In existing technologies, the problems of data overreach and inaccurate query results caused by users' conversational query requests have not yet been effectively solved.
Query permissions are determined by identity tokens, keywords are replaced using a vector database and a standard query format is generated, and query results are generated after ensuring that the query operation is risk-free by combining syntax validation and risk detection.
It improves the accuracy of query results and the security of data access, avoids data unauthorization, and ensures the legality and security of query operations.
Smart Images

Figure CN122633859A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for determining query results, a storage medium, and an electronic device. Background Technology
[0002] In existing technologies, query systems typically employ the following architecture: They receive user query requests in conversational language, directly input the enterprise's full data table structure (Data Definition Language, DDL) as context into a Large Language Model (LLM), which then generates a standard Structured Query Language (SQL) statement. The backend database engine executes this SQL, returns the raw query results to the model for summarization, and finally provides feedback to the user in natural language. However, because user query requests are conversational and the full data table structure is completely exposed to the LLM, problems such as data hijacking and inaccurate query results arise.
[0003] In existing technologies, directly querying the database based on user query requests can easily lead to problems such as data privilege escalation and low accuracy of query results, and no effective solution has yet been proposed. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for determining query results, to at least solve the problems in the prior art where directly querying the database based on a user's query request can easily lead to data overreach and low accuracy of query results.
[0005] According to one aspect of the embodiments of this application, a method for determining query results is provided, comprising: determining a first metadata set based on an identity token in a first query request sent by a target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata that conform to the query permissions; replacing multiple keywords in the first query request with multiple standard terms in a vector database to obtain a second query request that conforms to a standard query format; and determining a query result based on the first metadata set and the query statement if it is determined that the query statement generated based on the second query request conforms to preset requirements, wherein the preset requirements include at least one of the following: passing syntax verification, and the query operation indicated by the query statement being risk-free.
[0006] In an exemplary embodiment, determining a first metadata set based on an identity token in a first query request sent by a target object includes: decrypting the identity token using an encryption function to obtain an identity identifier of the target object, wherein the identity identifier is at least used to indicate the job level of the target object; determining a second metadata set from a data dictionary based on the identity identifier, wherein the data dictionary is at least used to store a plurality of second metadata in the second metadata set, the plurality of second metadata including the plurality of first metadata; and determining the plurality of first metadata in the second metadata set based on the query permissions to obtain the first metadata set.
[0007] In an exemplary embodiment, replacing multiple keywords in the first query request with multiple standard terms from a vector database to obtain a second query request conforming to a standard query format includes: extracting the multiple keywords according to multiple keyword types in a keyword extraction template, and encoding the multiple keywords to obtain multiple keyword vectors, wherein the multiple keywords correspond one-to-one with the multiple keyword vectors, and the multiple keywords correspond to at least one keyword type; for any first keyword vector among the multiple keyword vectors, if it is determined that there exists a first vector in the vector database with a similarity greater than or equal to a preset threshold, replacing the first keyword corresponding to the first keyword vector with the target standard term corresponding to the first vector in the first query request, wherein the multiple standard terms include the target standard term; and for any second keyword vector among the multiple keyword vectors, if it is determined that the similarity between multiple second vectors in the vector database and the second keyword vector is less than the preset threshold, retaining the second keyword corresponding to the second keyword vector in the first query request to obtain the second query request, wherein the multiple second vectors include the first vector.
[0008] In an exemplary embodiment, after replacing multiple keywords in the first query request with multiple standard terms from a vector database to obtain a second query request conforming to a standard query format, the method further includes: inputting the first metadata set and the second query request into a prompt word generator to generate prompt words; inputting the prompt words into a large language model to generate the query statement; performing syntax validation on the query statement to obtain a validation result; if the validation result is that the syntax validation is successful, determining whether the query operation has any risks; if the query operation is determined to be risk-free, determining that the query statement conforms to the preset requirements.
[0009] In an exemplary embodiment, determining whether the query operation is risky includes: mapping the query statement into a sequence of text units using a lexical analyzer, and parsing the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determining a danger tree corresponding to a danger pattern library, wherein multiple danger patterns in the danger pattern library correspond one-to-one with multiple second nodes in the danger tree, and all multiple danger patterns indicate that the query operation is risky; and determining that the query operation is risky if a third node among the multiple first nodes is identical to a fourth node among the multiple second nodes, determined by a dynamic programming algorithm.
[0010] In an exemplary embodiment, determining whether the query operation is risky includes: mapping the query statement to a sequence of text units using a lexical analyzer, and parsing the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determining the dependency relationships between multiple data types indicated by the multiple first nodes according to a dependency algorithm, and constructing a directed acyclic graph (DAG) based on the dependency relationships; determining whether a sensitive data type exists in the DAG based on the query permissions, wherein the query permissions do not authorize querying the sensitive data type; and determining that the query operation is risky if the sensitive data type exists in the DAG.
[0011] In an exemplary embodiment, determining the query result based on the first metadata set and the query statement includes: adjusting the query statement according to the query permissions, and executing the adjusted query statement in the first metadata set to obtain the query result; wherein, after the query result indicates that the query result is determined based on the first metadata set and the query statement, the method further includes: generating aggregation code based on the query result using a large language model, and injecting the query result as a data source into a sandbox environment, wherein the aggregation code is used to aggregate and compress the query result; and executing the aggregation code in the sandbox environment to obtain the compressed query result.
[0012] According to another embodiment of this application, a query result determination device is also provided, comprising: a first determination module, configured to determine a first metadata set based on an identity token in a first query request sent by a target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata that conform to the query permissions; and a replacement module, configured to replace multiple keywords in the first query request with multiple standard terms in a vector database to obtain a second query request conforming to a standard query format; and a second determination module, configured to determine a query result based on the first metadata set and the query statement if it is determined that the query statement generated based on the second query request conforms to preset requirements, wherein the preset requirements include at least one of the following: passing syntax verification, and the query operation indicated by the query statement being risk-free.
[0013] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described method for determining query results when running.
[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for determining the query result through the computer program.
[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the methods described in various embodiments of this application.
[0016] In this embodiment, a first metadata set is determined based on the identity token in the first query request sent by the target object. The identity token indicates the target object's query permissions, and the first metadata set includes multiple first metadata entries that conform to the query permissions. A second query request conforming to a standard query format is obtained by replacing multiple keywords in the first query request with multiple standard terms from a vector database. If the query statement generated based on the second query request meets preset requirements, the query result is determined based on the first metadata set and the query statement. The preset requirements include at least one of the following: syntax verification is successful, and the query operation indicated by the query statement is risk-free. This solution addresses the problems in related technologies where directly querying the database based on a user's query request can easily lead to data privilege escalation and inaccurate query results. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a hardware structure block diagram of a method for determining query results according to an embodiment of this application;
[0020] Figure 2 This is a flowchart illustrating a method for determining query results according to an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of a query system architecture for a method of determining query results according to an embodiment of this application;
[0022] Figure 4 This is a flowchart illustrating the determination of the first metadata set in a method for determining query results according to an embodiment of this application.
[0023] Figure 5 This is a flowchart illustrating the determination of a second query request according to an embodiment of the present application for a method of determining query results;
[0024] Figure 6 This is a flowchart of a sandbox calculation method for determining query results according to an embodiment of this application;
[0025] Figure 7 This is a flowchart illustrating the security verification process of a query statement in a method for determining query results according to an embodiment of this application.
[0026] Figure 8 This is a complete flowchart illustrating a method for determining query results according to an embodiment of this application;
[0027] Figure 9 This is a schematic diagram of row-level permission predicate pushdown in a method for determining query results according to an embodiment of this application;
[0028] Figure 10 This is a text unit consumption comparison chart of a method for determining query results according to an embodiment of this application;
[0029] Figure 11 This is an AST isomorphic diagram of a method for determining query results according to an embodiment of this application;
[0030] Figure 12 This is a sensitive data tracking diagram of a method for determining query results according to an embodiment of this application;
[0031] Figure 13 This is a structural block diagram of a query result determination device according to an embodiment of this application. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] The methods and embodiments provided in this application can be executed on a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a method for determining query results according to an embodiment of the present invention. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a central processing unit (CPU), microprocessor (MCU), or field-programmable gate array (FPGA)) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0035] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the query result determination method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0036] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0037] This embodiment provides a method for determining query results, which is applied to the aforementioned computer terminal. Figure 2 This is a flowchart illustrating a method for determining query results according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0038] Step S202: Determine a first metadata set based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and
[0039] Step S204: Replace multiple keywords in the first query request with multiple standard terms from the vector database to obtain a second query request that conforms to the standard query format;
[0040] Step S206: If it is determined that the query statement generated according to the second query request meets the preset requirements, the query result is determined according to the first metadata set and the query statement, wherein the preset requirements include at least one of the following: the syntax check is qualified, and the query operation indicated by the query statement is risk-free.
[0041] In this embodiment, a first metadata set is determined based on the identity token in the first query request sent by the target object. The identity token indicates the target object's query permissions, and the first metadata set includes multiple first metadata entries that conform to the query permissions. A second query request conforming to a standard query format is obtained by replacing multiple keywords in the first query request with multiple standard terms from a vector database. If the query statement generated based on the second query request meets preset requirements, the query result is determined based on the first metadata set and the query statement. The preset requirements include at least one of the following: syntax verification is successful, and the query operation indicated by the query statement is risk-free. This solution addresses the problems in related technologies where directly querying the database based on a user's query request can easily lead to data privilege escalation and inaccurate query results.
[0042] In an exemplary embodiment, determining a first metadata set based on an identity token in a first query request sent by a target object includes: decrypting the identity token using an encryption function to obtain an identity identifier of the target object, wherein the identity identifier is at least used to indicate the job level of the target object; determining a second metadata set from a data dictionary based on the identity identifier, wherein the data dictionary is at least used to store a plurality of second metadata in the second metadata set, the plurality of second metadata including the plurality of first metadata; and determining the plurality of first metadata in the second metadata set based on the query permissions to obtain the first metadata set.
[0043] like Figure 4 As shown, when a user initiates a query request (the first query request) through a natural language interface (such as a chat window or a BI system), the query system extracts the user's identity token from the first query request. The identity token is an encrypted credential issued by the enterprise's unified authentication center, encapsulated using symmetric or asymmetric encryption algorithms (such as AES-256 or RSA) to ensure the confidentiality and integrity of identity information during transmission and storage. The query system calls a pre-set encryption / decryption function to securely decrypt the identity token and extract the target object's identity identifier. : The identity identifier includes at least a unique user identifier, department, geographic region, and job level information. Among them, job level is a core sensitive dimension used to represent the user's access permission level in the enterprise organizational structure. For example, L1 is senior executive, L2 is middle manager, and L3 is ordinary employee. Different job levels correspond to different levels of data visibility, thereby achieving fine-grained control that goes beyond the traditional role-based access control model.
[0044] Based on this identity identifier, the query system queries the enterprise-level data dictionary (equivalent to V_TABLE_INFO). This data dictionary serves as a centralized metadata management center, storing all business tables, columns, field semantic descriptions, sensitivity level labels (e.g., L1~L3), and access rules associated with dimensions such as roles, job levels, departments, and regions. Based on the department and region information in the user's identity identifier, the query system filters all related metadata items from the data dictionary, forming a second metadata set (equivalent to table-level filtering). This second metadata set covers all potentially relevant table structures and column definitions within the user's organization, constituting a candidate range for permission pruning. Subsequently, the query system performs column-level filtering on the second metadata set based on job level, obtaining multiple first metadata items. For example, sensitive columns such as "profit," "cost," and "salary" are only accessible to users with a job level ≥ L2. Semantic anonymization is performed on the business descriptions of some sensitive columns, such as replacing "profit" with "operating efficiency index" and "customer ID number" with "customer unique code." The final output contains only the first metadata set containing the tables and columns that the target object has access to, along with their normalized descriptions. : .
[0045] In an exemplary embodiment, replacing multiple keywords in the first query request according to multiple standard terms in a vector database to obtain a second query request conforming to a standard query format includes: extracting the multiple keywords according to multiple keyword types in a keyword extraction template, and encoding the multiple keywords to obtain multiple keyword vectors, where the multiple keywords and the multiple keyword vectors correspond one-to-one, and the multiple keywords correspond to at least one keyword type; for any first keyword vector among the multiple keyword vectors, when it is determined that there is a first vector in the vector database whose similarity with the first keyword vector is greater than or equal to a preset threshold, replacing the first keyword corresponding to the first keyword vector in the first query request with the target standard term corresponding to the first vector, where the multiple standard terms include the target standard term; and for any second keyword vector among the multiple keyword vectors, when it is determined that the similarities between the multiple second vectors in the vector database and the second keyword vector are all less than the preset threshold, retaining the second keyword corresponding to the second keyword vector in the first query request to obtain the second query request, where the multiple second vectors include the first vector.
[0046] As Figure 5 shown, when a target object submits a first query request (e.g., "Find the sales volume of Dahuasong in Guangzhou last week"), the query system calls a preset keyword extraction template . The keyword extraction template is a structured instruction that defines several keyword types, including but not limited to "product name", "branch name", "time expression", "customer group", etc. Through rule matching and lightweight semantic analysis, all possible semantic entities are extracted from the first query request to form a set of multiple keywords to be corrected (such as "Guangzhou", "Dahuasong", "last week") , where is the first query request.
[0047] Subsequently, the query system separately calls a locally deployed dual-tower encoder for semantic vectorization processing of each keyword, generates multiple keyword vectors that strictly correspond one-to-one with the multiple keywords, and then uses each keyword vector as a query vector and inputs it into an enterprise private vector database (such as an index library built based on FAISS). This database has pre-stored all standardized business terms and their corresponding semantic vectors, such as "Dahuasong" corresponding to "Group's All-in-One Nutritional Product Set Model". The query system performs a nearest neighbor search on each keyword vector .
[0048] If there is a certain first vector in the database whose cosine similarity with the first keyword vector is greater than or equal to the preset threshold If it is (such as 0.85), it is determined that the first keyword is a non-standard expression of the target standard term, and the query system will replace the first keyword with the corresponding target standard term in the first query request. For example, it will replace "big Songhua" with "Group's certain all-round nutrition product set model", forming an intermediate expression with accurate semantics and conforming to the data dictionary specification. For keywords that are not matched, that is, when the similarity between the second vector in the database and the current keyword vector is lower than the preset threshold, the original word remains unchanged, that is
[0049]
[0050] Finally, the query system generates a second query request , for example: "Find the sales volume of Group's certain all-round nutrition product set model in Guangzhou last week."
[0051] It should be clear that in the function , is any first keyword vector or any second keyword vector among multiple keyword vectors, is the second vector in the vector database, is the target standard term and the second keyword that make up the second query request.
[0052] In an exemplary embodiment, after replacing multiple keywords in the first query request according to multiple standard terms in the vector database to obtain a second query request that conforms to the standard query format, the method further includes: inputting the first metadata set and the second query request into a prompt generator to generate a prompt through the prompt generator; inputting the prompt into a large language model to generate the query statement through the large language model; performing syntax verification on the query statement to obtain a verification result; when the verification result is qualified for syntax verification, determining whether there is a risk in the query operation; when it is determined that there is no risk in the query operation, determining that the query statement meets the preset requirements.
[0053] Such as Figure 7 shown, after completing dynamic metadata cropping and entity term correction, the query system inputs the first metadata set (that is , including the tables, columns that the user has the right to access and their desensitized descriptions) and the second query request after standardization processing (such as "Find the sales volume of Group's certain all-round nutrition product set model in Guangzhou last week") into the prompt generator, and constructs a context-aware prompt Prompt that conforms to the understanding paradigm of the large language model through the prompt generator:
[0054]
[0055] Among them, For system commands (e.g., if you are an enterprise data query assistant, you can only answer questions based on the following security schema). For the security schema context (list all allowed tables and columns and their business alias mappings), For dialogue within the historical context, This is the second query request.
[0056] Subsequently, the prompt word is fed into the large language model to generate a preliminary SQL statement. The query system performs syntactic validity checks on the query statement using a standard SQL parser, checking the compliance of basic structures such as keywords, bracket matching, field existence, and table joins. If the syntax check fails (e.g., spelling errors, missing fields, or missing FROM clauses), the query system immediately terminates the process and returns an "SQL statement format error" to prevent invalid requests from entering the execution chain. If the syntax check passes, the query system uses a dual mechanism of Abstract Syntax Tree (AST) isomorphic matching and data lineage tracing to determine if the query operation is risky. If the query operation is risky, the query system intercepts the response and returns an error message; if the query operation is risk-free, the SQL statement is executed.
[0057] Dangerous operations are defined as follows:
[0058]
[0059] The above dangerous operations are used to indicate that there is a risk in the query operation.
[0060] In an exemplary embodiment, determining whether the query operation is risky includes: mapping the query statement into a sequence of text units using a lexical analyzer, and parsing the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determining a danger tree corresponding to a danger pattern library, wherein multiple danger patterns in the danger pattern library correspond one-to-one with multiple second nodes in the danger tree, and all multiple danger patterns indicate that the query operation is risky; and determining that the query operation is risky if a third node among the multiple first nodes is identical to a fourth node among the multiple second nodes, determined by a dynamic programming algorithm.
[0061] like Figure 11As shown, after syntax validation, the query system calls the lexical analyzer to scan the original SQL statement character by character. Based on predefined regular expression patterns (such as SELECT, FROM, WHERE, IDENTIFIER, LITERAL, OPERATOR, etc.), it decomposes the statement into an ordered sequence of text units (Token sequences). Each text unit contains type, lexeme, and position information, forming a structured input stream. The Token sequence is then fed into a recursive descent parser. Based on an enterprise-level SQL context-free grammar, the recursive descent parser uses a top-down recursive call approach to construct an AST tree that is structurally consistent with and semantically equivalent to the SQL statement. The set of node types in the AST is... The node type corresponds one-to-one with each token in the token sequence.
[0062] To identify potentially hazardous operations, the query system maintains a predefined hazard mode library. The hazard pattern library contains several AST structure templates for hazard patterns, such as the DROP table pattern. Subquery injection pattern: Sensitive table access patterns: A hazard tree is constructed based on a hazard mode library, where each node corresponds to a hazard mode.
[0063] A subtree isomorphism detection algorithm based on dynamic programming is defined, using a two-dimensional DP array. This is used to indicate whether a node u in the input AST and a node v in the danger tree can achieve subtree isomorphism, that is, whether there exists a third node among multiple first nodes and a fourth node among multiple second nodes that are the same. .
[0064] In another exemplary alternative embodiment, to efficiently match the input AST with the hazard tree, the query system determines the risk of the query operation through AST isomorphic hashing optimization. Specifically, this includes: optimizing the hazard pattern library... After normalizing each dangerous pattern, the structure hash is calculated:
[0065]
[0066] Simultaneously, the structure hash is also calculated for the input AST tree:
[0067]
[0068] The hash value of the AST is compared with the hash value of the dangerous pattern. If the hash values are the same, a dynamic programming subtree isomorphism detection algorithm is used to further determine whether there is a third node in the multiple first nodes of the AST tree that is the same as the fourth node in the multiple second nodes of the dangerous tree. Otherwise, if the hash value of the AST is different from the hash value of the dangerous pattern, the query operation is determined to be risk-free. Fast pattern pre-screening with O(1) complexity is achieved through hash comparison, which significantly reduces the overall matching time complexity.
[0069] In an exemplary embodiment, determining whether the query operation is risky includes: mapping the query statement to a sequence of text units using a lexical analyzer, and parsing the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determining the dependency relationships between multiple data types indicated by the multiple first nodes according to a dependency algorithm, and constructing a directed acyclic graph (DAG) based on the dependency relationships; determining whether a sensitive data type exists in the DAG based on the query permissions, wherein the query permissions do not authorize querying the sensitive data type; and determining that the query operation is risky if the sensitive data type exists in the DAG.
[0070] like Figure 12 As shown, after constructing the AST tree based on the query statement, the query system calls a dependency algorithm to traverse all nodes in the AST (corresponding to columns in the table, equivalent to column nodes in the following text), extracting the complete source path of each column, including its table name, alias, whether it is an aggregation calculation result, whether it participates in joins or filtering, and other semantic information. Based on this information, the query system constructs a directed acyclic graph (DAG), whose vertex set... Represents all referenced columns, edge set Represents column Through a certain operation Indirect Influence Column .
[0071] After constructing the directed acyclic graph, the query system labels each column node based on the enterprise's column-level sensitivity tagging system (e.g., L1=Public, L2=Internal, L3=Top Secret). For example, employee.salary is labeled as L3 (Top Secret), and customer.phone as L2 (Internal). The query system defines sensitivity propagation rules. In other words, the sensitivity level of an output column is equal to the maximum sensitivity level of all its direct or indirect input columns. For example, if an output column is generated by aggregating salary(L3) using SUM(), then the sensitivity level of that output column is still L3. If a query filters out a list of high-paid employees using WHERE salary>50000, even if the salary column is not directly selected, the output result (equivalent to the query result, such as employee name + department) will still trace back to the salary column due to the lineage path, and the final output column will be judged to have L3 sensitivity.
[0072] The query system then compares all column nodes in the DAG with the current user's query permission matrix. If any column node... The sensitivity level is L3 (or higher than the user's authorization level), and the user has not been granted permission to access this column. Access permissions, i.e. Then determine the column This constitutes an unauthorized sensitive data node. Furthermore, the query system performs sensitive flow propagation detection; if this sensitive column... The arbitrary path affected any column in the final output. ,Right now Even if Even columns that are not inherently sensitive can still pose an indirect risk of privilege escalation and data leakage. For example, a regular employee (authorized only to access column L1) might query `SELECT name FROM orders WHERE region='Beijing' AND customer_id IN (SELECT customer_id FROM employee WHERE salary >10000)`. Although `salary` is not explicitly selected, the subquery in the `WHERE` clause joins with the `employee` table, creating a dependency between the output `name` column and the sensitive column `salary` (L3). The query system identifies this implicit propagation path through DAG tracing, determines that the query poses a high risk of privilege escalation, immediately intercepts it, and triggers a security alert.
[0073] This embodiment, based on AST syntax structure verification, further constructs a dynamic unauthorized access detection mechanism based on data lineage tracing and sensitivity propagation analysis, fundamentally solving the security blind spot of traditional security solutions that only detect explicit access to sensitive tables but ignore indirect derivation of sensitive information.
[0074] In an exemplary embodiment, determining the query result based on the first metadata set and the query statement includes: adjusting the query statement according to the query permissions, and executing the adjusted query statement in the first metadata set to obtain the query result; wherein, after the query result indicates that the query result is determined based on the first metadata set and the query statement, the method further includes: generating aggregation code based on the query result using a large language model, and injecting the query result as a data source into a sandbox environment, wherein the aggregation code is used to aggregate and compress the query result; and executing the aggregation code in the sandbox environment to obtain the compressed query result.
[0075] like Figure 9 As shown, the query system uses the current user's first metadata set as the execution context and executes the adjusted query statement in an isolated database environment within the enterprise intranet. The adjusted query statement has been modified using row-level permission predicate pushdown (e.g., WHERE branch_id = 'BEIJING') and column-level projection (e.g., SELECT name, region instead of SELECT ...). Enhancements have been made to ensure that only data rows and columns that the user has the right to access are returned, avoiding the physical exposure of any sensitive information. Optional, Beijing branch employee query: Display all orders; query system SQL adjusted: SELECT The command `FROM ordersWHERE branch_id = 'BEIJING'` forces a filter even if the user requests to display orders nationwide, allowing the user to view only data from the Beijing branch.
[0076] like Figure 6 As shown, after the SQL statement is executed, the query system obtains the query results. : The query results and the second query request are then input into the large language model, which generates an aggregation code. ,in, Includes a large amount of detailed data (such as complete order records and employee attendance logs), aggregation code It includes basic Pandas aggregation operations and does not involve any file I / O, network calls, system commands, or external library calls. Subsequently, it queries the system to start a sandbox environment, where the sandbox environment is defined as:
[0077]
[0078] in, Used to represent whitelists of functions (such as Pandas safe operations like sum, mean, groupby, merge, etc.). Used to represent module whitelists (such as subsets of pandas and numpy). Used to characterize timeout limits (e.g., on the order of seconds). Used to characterize memory usage limits. The query system displays the query results when the sandbox is launched. The aggregation code is injected into the sandbox environment as a local variable `df` (`locals={'df': DF_raw}`), ensuring that the aggregation code can directly access the dataset but cannot access any external variables or system resources. The aggregation code is then executed securely within the sandbox. The system then performs data compression and indicator calculations. Finally, the query system displays the compressed query results. The data is sent to a large language model, where only a very small number of tokens are needed to refine the natural language and ultimately generate a user response.
[0079] In this embodiment, by performing secondary calculations on the query results in a sandbox environment, the number of tokens can be effectively reduced. In practical applications, the compression ratio is calculated using the following formula. And Token Savings :
[0080] ,
[0081] like Figure 10 As shown in (a). Traditional solutions directly input the query results into the large language model, leading to an exponential increase in token consumption, such as... Figure 10 As shown in (b).
[0082] To better understand the process of determining the above query results, the following describes the implementation flow of the above query results determination method in conjunction with optional embodiments, but it is not intended to limit the technical solution of the embodiments of this application.
[0083] Figure 3 This is a schematic diagram of a query system architecture for a method of determining query results according to an embodiment of this application, such as... Figure 3 As shown, it specifically includes the following:
[0084] The query system architecture includes a first layer of user access and authentication, a second layer of schema pruning gateway, a third layer of entity correction and compensation, a fourth layer of NL2SQL generation, a fifth layer of secure execution and sandbox, and a sixth layer of result aggregation and distribution.
[0085] In the first-layer user access and authentication layer, when a user initiates the first query request, the query system obtains the identity token carried in the first query request, and parses the identity token through the user identity decryption module to extract the user's identity identifier. It then calls the permission center interface to obtain the user's job level, department, and data access permissions in the enterprise organizational structure, thus completing the identity authenticity verification and permission context loading.
[0086] In the second-layer pattern trimming gateway layer, the query system queries the metadata permission view based on the identity identifier. Combining column-level permission filters and table-level permission filters, it dynamically filters out all data tables and fields that the user is authorized to access, removes unauthorized objects, and the business description desensitizer standardizes and rewrites the semantic descriptions of sensitive columns. For example, "profit" is replaced with "operating efficiency index", and "employee salary" is replaced with "salary grade code". This ensures that the large language model can only perceive the secure metadata set (the first metadata set) after permission constraints and semantic purification.
[0087] In the third entity correction and compensation layer, the query system uses a lightweight entity extraction template to extract potential business entities (multiple keywords) from the user's original query (first query request), such as non-standard terms like "big pine flower", "product promotion", and "last week". These entities are then converted into high-dimensional semantic vectors using a dual-tower encoder. Subsequently, an approximate nearest neighbor search is performed using the FAISS vector index library. A cosine similarity calculator evaluates the semantic matching degree between multiple keywords and multiple standard terms. If the similarity reaches a preset threshold, the terminology standardization replacement tool automatically replaces the first keyword with the target standard term, forming a semantically accurate and structurally clear standardized query request (second query request).
[0088] In the fourth layer, the NL2SQL generation layer, the query system receives the second query request. The schema-aware hint builder constructs hint words based on this request and injects them into the large language model to generate a preliminary SQL statement. The generated SQL statement then undergoes dual verification by an SQL syntax validator and a dangerous operation detector. The former ensures the statement conforms to standard SQL syntax, while the latter, based on abstract syntax tree isomorphic matching and a predefined dangerous pattern library, identifies high-risk semantic structures such as DROP, DELETE, UNION SELECT, and cross-database access, ensuring the generated SQL statement is both legal and secure. After passing the verification, the query system enters the fifth layer, the secure execution and sandbox layer.
[0089] In the fifth layer of secure execution and sandboxing, the SQL execution engine executes SQL statements to obtain raw data frames (query results). These raw data frames are not exposed externally but are injected into the isolated Python sandbox environment in read-only mode by the local variable injector. The query system then generates lightweight aggregation code for the raw data frames through the large language model, completes data compression and indicator calculation within the sandbox, and outputs a simplified result set containing aggregated statistics (compressed query results) by the result compressor, thus achieving physical isolation between the raw data and model calculations.
[0090] The sixth layer, the result aggregation and distribution layer, receives the compressed indicator data. The indicator aggregation module standardizes the format, and the LLM polishing and wrapping module converts it into natural language expression. Based on the user terminal type and usage scenario, the multimodal distributor selects an appropriate form such as text, chart, or voice. Finally, the result is securely delivered to the end user through the user response return module.
[0091] Figure 8 This is a complete flowchart illustrating a method for determining query results according to an embodiment of this application, as shown below. Figure 8 As shown, it specifically includes the following:
[0092] Upon receiving a first query request from a user, the query system determines the user's identity based on the identity token carried in the first query request, thus authenticating the user. Further, based on the department and region information in the identity token, table-level and column-level filtering is performed from the data dictionary to obtain a first set of metadata containing the tables, columns, and their normalized descriptions that the target object is authorized to access. .
[0093] At the same time, the query system calls the preset keyword extraction template. The first query request extracts all possible semantic entities to form a set of keywords to be corrected. These keywords are then matched with multiple standard terms in a vector database. If a target standard term matches the keyword's similarity, it replaces the first keyword. If no target standard term matches, the keyword is retained, thus generating the second query request.
[0094] The first metadata set and the second query request are input into the prompt word generator, which generates prompt words. The prompt words are then input into the large language model, which generates a query statement. The query statement is then subjected to syntax validation, and the validation result is obtained. If the validation result is that the syntax is valid, it is determined whether the query operation is risky. If the query operation is risky, an error message is returned; otherwise, the query statement is executed, and the query result is obtained.
[0095] The query results and the second query request are input into the large language model, which then generates an aggregation code. and the query results The dataset is injected into the sandbox environment as a local variable `df` to ensure that the aggregation code can directly access it. The query results are then subjected to secondary calculations within the sandbox environment to obtain compressed query results. The query system then displays the compressed query results. The code is sent to a large language model for polishing, and finally a user response is generated.
[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0097] Figure 13 This is a structural block diagram of a query result determination device according to an embodiment of this application, such as... Figure 13 As shown, the device includes:
[0098] The first determining module 12 is configured to determine a first metadata set based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and
[0099] Replacement module 14 is used to replace multiple keywords in the first query request with multiple standard terms in the vector database to obtain a second query request that conforms to the standard query format.
[0100] The second determining module 16 is used to determine the query result based on the first metadata set and the query statement when it is determined that the query statement generated according to the second query request meets the preset requirements. The preset requirements include at least one of the following: the syntax check is qualified and the query operation indicated by the query statement is risk-free.
[0101] In this embodiment, a first metadata set is determined based on the identity token in the first query request sent by the target object. The identity token indicates the target object's query permissions, and the first metadata set includes multiple first metadata entries that conform to the query permissions. A second query request conforming to a standard query format is obtained by replacing multiple keywords in the first query request with multiple standard terms from a vector database. If the query statement generated based on the second query request meets preset requirements, the query result is determined based on the first metadata set and the query statement. The preset requirements include at least one of the following: syntax verification is successful, and the query operation indicated by the query statement is risk-free. This solution addresses the problems in related technologies where directly querying the database based on a user's query request can easily lead to data privilege escalation and inaccurate query results.
[0102] In an exemplary embodiment, the first determining module 12 is further configured to decrypt the identity token using an encryption function to obtain the identity identifier of the target object, wherein the identity identifier is at least used to indicate the job level of the target object; determine a second metadata set from a data dictionary based on the identity identifier, wherein the data dictionary is at least used to store a plurality of second metadata in the second metadata set, the plurality of second metadata including the plurality of first metadata; and determine the plurality of first metadata in the second metadata set according to the query permission to obtain the first metadata set.
[0103] In an exemplary embodiment, the replacement module 14 is further configured to extract the plurality of keywords according to the plurality of keyword types in the keyword extraction template, and encode the plurality of keywords to obtain a plurality of keyword vectors, wherein the plurality of keywords correspond one-to-one with the plurality of keyword vectors, and the plurality of keywords correspond to at least one keyword type; for any first keyword vector among the plurality of keyword vectors, if it is determined that there exists a first vector in the vector database with a similarity greater than or equal to a preset threshold, the first keyword corresponding to the first keyword vector is replaced with the target standard term corresponding to the first vector in the first query request, wherein the plurality of standard terms includes the target standard term; and for any second keyword vector among the plurality of keyword vectors, if it is determined that the similarity between the plurality of second vectors in the vector database and the second keyword vector is less than the preset threshold, the second keyword corresponding to the second keyword vector is retained in the first query request to obtain the second query request, wherein the plurality of second vectors includes the first vector.
[0104] In an exemplary embodiment, the replacement module 14 is further configured to input the first metadata set and the second query request into a prompt word generator, and generate prompt words through the prompt word generator; input the prompt words into a large language model, and generate the query statement through the large language model; perform syntax validation on the query statement to obtain a validation result; if the validation result is that the syntax validation is qualified, determine whether the query operation has a risk; if the query operation is determined to be risk-free, determine that the query statement meets the preset requirements.
[0105] In an exemplary embodiment, the replacement module 14 is further configured to map the query statement into a sequence of text units using a lexical analyzer, and parse the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determine a danger tree corresponding to a danger pattern library, wherein multiple danger patterns in the danger pattern library correspond one-to-one with multiple second nodes in the danger tree, and all multiple danger patterns indicate that the query operation is risky; and determine that the query operation is risky if a third node among the multiple first nodes is found to be the same as a fourth node among the multiple second nodes using a dynamic programming algorithm.
[0106] In an exemplary embodiment, the replacement module 14 is further configured to map the query statement into a sequence of text units using a lexical analyzer, and parse the sequence of text units using a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; determine the dependency relationships between multiple data types indicated by the multiple first nodes according to a dependency algorithm, and construct a directed acyclic graph based on the dependency relationships; determine whether a sensitive data type exists in the directed acyclic graph based on the query permission, wherein the query permission does not authorize the query of the sensitive data type; and determine that the query operation is risky if the sensitive data type is determined to exist in the directed acyclic graph.
[0107] In an exemplary embodiment, the second determining module 16 is further configured to adjust the query statement according to the query permissions, and execute the adjusted query statement in the first metadata set to obtain the query result; wherein, after the query result indicates that the query result is determined according to the first metadata set and the query statement, the method further includes: generating aggregation code based on the query result through a large language model, and injecting the query result as a data source into a sandbox environment, wherein the aggregation code is used to aggregate and compress the query result; and executing the aggregation code in the sandbox environment to obtain the compressed query result.
[0108] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0109] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0110] S1, determine a first metadata set based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and
[0111] S2, replace multiple keywords in the first query request with multiple standard terms from the vector database to obtain a second query request that conforms to the standard query format;
[0112] S3, if it is determined that the query statement generated according to the second query request meets the preset requirements, the query result is determined according to the first metadata set and the query statement, wherein the preset requirements include at least one of the following: the syntax check is qualified, and the query operation indicated by the query statement is risk-free.
[0113] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0114] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0115] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0116] S1, determine a first metadata set based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and
[0117] S2, replace multiple keywords in the first query request with multiple standard terms from the vector database to obtain a second query request that conforms to the standard query format;
[0118] S3, if it is determined that the query statement generated according to the second query request meets the preset requirements, the query result is determined according to the first metadata set and the query statement, wherein the preset requirements include at least one of the following: the syntax check is qualified, and the query operation indicated by the query statement is risk-free.
[0119] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0120] Embodiments of this application also provide a computer program product, including a non-volatile computer-readable storage medium storing the computer program product, wherein the computer program, when executed by a processor, implements the steps of the methods described in various embodiments of this application.
[0121] Optionally, in this embodiment, the computer program described above can be configured to perform the following steps when executed by a processor:
[0122] S1, determine a first metadata set based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and
[0123] S2, replace multiple keywords in the first query request with multiple standard terms from the vector database to obtain a second query request that conforms to the standard query format;
[0124] S3, if it is determined that the query statement generated according to the second query request meets the preset requirements, the query result is determined according to the first metadata set and the query statement, wherein the preset requirements include at least one of the following: the syntax check is qualified, and the query operation indicated by the query statement is risk-free.
[0125] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0126] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining query results, characterized in that, include: A first metadata set is determined based on the identity token in the first query request sent by the target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and The first query request is obtained by replacing multiple keywords in the first query request with multiple standard terms from the vector database, thus obtaining a second query request that conforms to the standard query format. If it is determined that the query statement generated based on the second query request meets the preset requirements, the query result is determined based on the first metadata set and the query statement, wherein the preset requirements include at least one of the following: the syntax check is qualified, and the query operation indicated by the query statement is risk-free.
2. The method for determining query results according to claim 1, characterized in that, The first metadata set is determined based on the identity token in the first query request sent by the target object, including: The identity token is decrypted using an encryption function to obtain the identity identifier of the target object, wherein the identity identifier is used to indicate at least the job level of the target object; A second metadata set is determined from a data dictionary based on the identity identifier, wherein the data dictionary is used to store at least a plurality of second metadata in the second metadata set, and the plurality of second metadata includes the plurality of first metadata; Based on the query permissions, the plurality of first metadata are determined in the second metadata set to obtain the first metadata set.
3. The method for determining the query result according to claim 1, characterized in that, By replacing multiple keywords in the first query request with multiple standard terms from the vector database, a second query request conforming to the standard query format is obtained, including: Extract the multiple keywords based on the multiple keyword types in the keyword extraction template, and encode the multiple keywords to obtain multiple keyword vectors, wherein the multiple keywords correspond one-to-one with the multiple keyword vectors, and the multiple keywords correspond to at least one keyword type; For any first keyword vector among the plurality of keyword vectors, if it is determined that there exists a first vector in the vector database with a similarity greater than or equal to a preset threshold with the first keyword vector, the first keyword corresponding to the first keyword vector is replaced with the target standard term corresponding to the first vector in the first query request, wherein the plurality of standard terms includes the target standard term; and For any second keyword vector among the plurality of keyword vectors, if it is determined that the similarity between the plurality of second vectors in the vector database and the second keyword vector is less than the preset threshold, the second keyword corresponding to the second keyword vector is retained in the first query request to obtain the second query request, wherein the plurality of second vectors includes the first vector.
4. The method for determining query results according to claim 1, characterized in that, After replacing multiple keywords in the first query request with multiple standard terms from the vector database to obtain a second query request conforming to the standard query format, the method further includes: The first metadata set and the second query request are input into the prompt word generator, and prompt words are generated by the prompt word generator; The prompt words are input into a large language model, and the query statement is generated through the large language model. Perform syntax validation on the query statement and obtain the validation result; If the verification result is that the syntax verification is successful, determine whether the query operation is risky; If it is determined that the query operation is risk-free, then the query statement is determined to meet the preset requirements.
5. The method for determining the query result according to claim 4, characterized in that, Determining whether the query operation poses a risk includes: The query statement is mapped to a sequence of text units by a lexical analyzer, and the sequence of text units is parsed by a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; Determine the danger tree corresponding to the danger pattern library, wherein multiple danger patterns in the danger pattern library correspond one-to-one with multiple second nodes in the danger tree, and all multiple danger patterns indicate that the query operation is risky; If, through a dynamic programming algorithm, it is determined that a third node among the plurality of first nodes is identical to a fourth node among the plurality of second nodes, then the query operation is deemed to be risky.
6. The method for determining query results according to claim 4, characterized in that, Determining whether the query operation poses a risk includes: The query statement is mapped to a sequence of text units by a lexical analyzer, and the sequence of text units is parsed by a recursive descent parser to obtain an abstract syntax tree, wherein multiple first nodes in the abstract syntax tree correspond one-to-one with multiple text units in the sequence of text units; The dependency relationships between the multiple data types indicated by the multiple first nodes are determined according to the dependency algorithm, and a directed acyclic graph is constructed based on the dependency relationships; The presence of sensitive data types in the directed acyclic graph is determined based on the query permissions, wherein the query permissions do not authorize the query of the sensitive data types. If the sensitive data type is determined to exist in the directed acyclic graph, then the query operation is deemed to be risky.
7. The method for determining query results according to claim 1, characterized in that, Determining the query result based on the first metadata set and the query statement includes: The query statement is adjusted according to the query permissions, and the adjusted query statement is executed in the first metadata set to obtain the query result; Wherein, after the query result indicates that the query result is determined based on the first metadata set and the query statement, the method further includes: The system generates aggregation code based on the query results using a large language model, and injects the query results as a data source into a sandbox environment. The aggregation code is used to aggregate and compress the query results. Execute the aggregation code in the sandbox environment to obtain the compressed query results.
8. A device for determining query results, characterized in that, include: A first determining module is configured to determine a first metadata set based on an identity token in a first query request sent by a target object, wherein the identity token is used to indicate the query permissions of the target object, and the first metadata set includes multiple first metadata items that conform to the query permissions; and The replacement module is used to replace multiple keywords in the first query request with multiple standard terms in the vector database to obtain a second query request that conforms to the standard query format. The second determining module is used to determine the query result based on the first metadata set and the query statement when it is determined that the query statement generated according to the second query request meets the preset requirements. The preset requirements include at least one of the following: the syntax check is qualified and the query operation indicated by the query statement is risk-free.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.