Data query method, device, equipment, readable storage medium and program product

By obtaining data access permissions to generate target query statements, the problem of non-technical personnel having difficulty operating SQL independently is solved, thus improving data query efficiency and security.

CN122132428APending Publication Date: 2026-06-02XIAMEN TUBETECH INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAMEN TUBETECH INC
Filing Date
2026-03-24
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Traditional data query methods require business personnel to master SQL syntax, making it difficult for non-technical personnel to operate independently. This results in long response cycles, poor report flexibility, and an inability to meet the diverse and personalized data analysis needs of enterprises.

Method used

By obtaining the data access permissions corresponding to the data query request, the target query statement is generated based on the request description data and permissions, and the target data is queried from the database. Permission constraints are introduced to avoid unauthorized queries.

Benefits of technology

It improves data query efficiency, reduces syntax errors and semantic ambiguity, ensures queries are performed within authorized scope, and enhances data query security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132428A_ABST
    Figure CN122132428A_ABST
Patent Text Reader

Abstract

This application relates to a data query method, apparatus, device, readable storage medium, and program product. The method includes: in response to a data query request, obtaining data access permissions for the requesting account corresponding to the data query request; the data query request carrying request description data; generating a target query statement corresponding to the data query request based on the request description data and the data access permissions; and querying target data from a database based on the target query statement. This method can improve data query efficiency while ensuring data security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a data query method, apparatus, device, readable storage medium, and program product. Background Technology

[0002] With the development of enterprise digitalization and artificial intelligence technologies, enterprises have increasingly higher requirements for the efficiency of data extraction and report generation in the management decision-making process. Business personnel need to frequently query data from the database and generate business reports in their daily work.

[0003] Traditional data query methods require business personnel to master the professional syntax of Structured Query Language (SQL), which is difficult for non-technical personnel to operate independently. If the technical department is relied upon to develop fixed reports, there are problems such as long demand response cycles and poor report content flexibility, making it difficult to adapt to the diverse and personalized data analysis needs of enterprises. There is an urgent need to solve this problem. Summary of the Invention

[0004] Therefore, it is necessary to provide a data query method, apparatus, device, readable storage medium, and program product to address the aforementioned technical problems, which can improve data query efficiency while ensuring data security.

[0005] Firstly, this application provides a data query method, including:

[0006] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0007] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0008] Based on the target query statement, retrieve the target data from the database.

[0009] In one embodiment, based on the requested description data and data access permissions, a target query statement corresponding to the data query request is generated, including:

[0010] Based on the request description data, determine the database to be accessed corresponding to the data query request; and,

[0011] Based on data access permissions, determine the set of databases authorized for access corresponding to the requesting account;

[0012] Based on the existence of the database to be accessed in the authorized access database set, generate the target query statement corresponding to the data query request.

[0013] In one embodiment, based on the existence of the database to be accessed in the authorized access database set, a target query statement corresponding to the data query request is generated, including:

[0014] If the database to be accessed exists in the set of authorized access databases, determine the authorized access fields in the database to be accessed based on the data access permissions;

[0015] Based on the request description data and authorized access fields, generate the target query statement corresponding to the data query request.

[0016] In one embodiment, based on the existence of the database to be accessed in the authorized access database set, a target query statement corresponding to the data query request is generated, including:

[0017] If the database to be accessed exists in the authorized access database set, generate the target query statement corresponding to the data query request based on the request description data.

[0018] In one embodiment, based on the existence of the database to be accessed in the authorized access database set, a target query statement corresponding to the data query request is generated, including:

[0019] If the database to be accessed exists in the authorized access database set, generate the initial query statement corresponding to the data query request based on the request description data;

[0020] Based on the initial query statement, retrieve candidate data from the database to be accessed;

[0021] Based on the availability of candidate data, the initial query statement is updated to generate the target query statement corresponding to the data query request.

[0022] In one embodiment, the request description data carries a data display requirement; where the data display requirement indicates that the target data needs to be displayed in the target system, the method further includes:

[0023] Based on the requested description data and / or target data, determine the information to which the target data belongs in the target system;

[0024] According to the coding rules of the target system, the relevant information is encoded to generate coded information that matches the target system;

[0025] Based on the encoded information, a jump link is generated; the jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0026] Secondly, this application also provides a data query device, comprising:

[0027] The permission acquisition module is used to respond to data query requests and obtain the data access permissions of the requesting account corresponding to the data query request; the data query request carries request description data;

[0028] The language generation module is used to generate the target query statement corresponding to the data query request based on the request description data and data access permissions;

[0029] The data query module is used to retrieve target data from the database based on the target query statement.

[0030] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0031] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0032] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0033] Based on the target query statement, retrieve the target data from the database.

[0034] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0035] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0036] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0037] Based on the target query statement, retrieve the target data from the database.

[0038] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0039] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0040] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0041] Based on the target query statement, retrieve the target data from the database.

[0042] The aforementioned data query method, apparatus, device, readable storage medium, and program product, in response to a data query request, obtains the data access permissions of the requesting account corresponding to the data query request, and generates a target query statement corresponding to the data query request based on the request description data and the data access permissions. Then, based on the target query statement, the target data is retrieved from the database. In this process, on the one hand, automatically generating the target query statement directly based on the user-input request description data avoids syntax errors and semantic ambiguities that occur when business personnel manually write query language, reducing query retries and correction time, thereby improving data query efficiency. On the other hand, introducing the requesting account's data access permissions as a constraint when generating the target query statement limits the target query statement to the scope of access permissions, preventing unauthorized queries and invalid data access, thus improving data query security while improving efficiency. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a flowchart illustrating a data query method in one embodiment;

[0045] Figure 2 This is a flowchart illustrating the steps for generating a target query statement in one embodiment;

[0046] Figure 3 This is a flowchart illustrating the target data display step in one embodiment;

[0047] Figure 4 This is a flowchart illustrating the data query method in another embodiment;

[0048] Figure 5 This is a structural block diagram of a data query device in one embodiment;

[0049] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0052] In one exemplary embodiment, such as Figure 1 As shown, a data query method is provided. Taking the application of this method in a data query system as an example, the method includes the following steps:

[0053] S110, in response to a data query request, obtains data access permissions for the requesting account corresponding to the data query request.

[0054] A data query request is used to request data, for example, to request data from a database. The data query request carries a request description, which describes the specific data query requirement.

[0055] Typically, data query requests are in natural language, such as "what is the turnover in the past year", or "the frequency of different users accessing the target system in the past month", etc.

[0056] The data access permissions may record the databases that the requesting account can access. For example, the data access permissions may include the database identifiers of each database that the requesting account can access.

[0057] Optionally, users can log in to the data query system using their account and password to perform data query operations. Alternatively, the data query system can display a data query entry point, where users can input a request description and submit it to generate a data query request.

[0058] In one optional implementation, in response to a data query request, the account information of the requesting account corresponding to the data query request can be obtained, and the access permission data of the requesting account can be queried from the account information. Then, based on the access permission data, the data access permission of the requesting account corresponding to the data query request can be determined.

[0059] In one optional implementation, the correspondence between different account roles and corresponding reference data access permissions can be predetermined. Accordingly, in response to a data query request, the account information of the requesting account corresponding to the data query request can be obtained, and the account role of the requesting account can be queried from the account information. The reference data access permissions corresponding to the account role in the correspondence can be used as the data access permissions of the requesting account corresponding to the data query request.

[0060] It is understood that the correspondence between account roles and corresponding access permissions to reference data can be dynamically adjusted according to system access rules, and this application does not impose any restrictions on this.

[0061] S120: Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request.

[0062] The target query statement can be a structured query language, such as SQL.

[0063] In one alternative implementation, the request description data can be parsed to determine the request intent of the data access request. Based on the request intent, the database to be accessed can be determined from different databases. Then, based on the request intent, the database to be accessed, and the data access permissions, the target query statement corresponding to the data query request can be generated.

[0064] For example, when the data access permission indicates that the requesting account corresponding to the data query request can perform data query operations on the database to be accessed, the request intent is structurally adjusted according to the database schema of the database to be accessed, and then the target query statement corresponding to the data query request is generated according to the structurally adjusted request intent.

[0065] In another alternative implementation, the request description data and data access permissions can be input into the target query statement generation model to generate the target query statement corresponding to the data query request. For example, the target query statement generation model can combine the databases allowed in the data access permissions to directly generate a target query statement that corresponds to the request description data and is constrained within the permission scope.

[0066] The target query generation model can be built based on common neural networks, which will not be elaborated here. Furthermore, during the training of the target query generation model, sample description data and sample permission data can be input into the model to obtain the predicted query language. Based on the predicted query language and the query language labels corresponding to the sample description data, the model is trained to improve its accuracy.

[0067] S130, based on the target query statement, retrieve target data from the database.

[0068] For example, a database connection session can be created based on the target query statement, and corresponding data can be retrieved from the database according to the filtering conditions such as the database table identifier specified in the target query statement, and the retrieved data can be used as the target data.

[0069] In some embodiments, to further enhance data security, a range check can be performed on the queried data, and the target data can be determined based on the range check result. For example, it can be determined whether the data access range of the queried data matches the data access permissions of the requesting account, and the data in the queried data that matches the data access permissions can be output as the target data.

[0070] In some embodiments, to improve user experience, after generating the target data, a supplementary description request example associated with the request description data can be generated based on the request description data and the target data, and the supplementary description request example can be output for user selection. In response to a triggering operation for any supplementary description request example, a data query request corresponding to the request is generated, and the corresponding target data is queried based on the data query request. Furthermore, to facilitate user access to the target data corresponding to each data query request, the target data corresponding to all data query requests can be comprehensively analyzed and integrated to generate a data query report.

[0071] In the aforementioned data query method, in response to a data query request, the system obtains the data access permissions of the requesting account corresponding to the data query request. Based on the request description data and the data access permissions, it generates a target query statement corresponding to the data query request, and then queries the target data from the database based on the target query statement. In this process, on the one hand, automatically generating the target query statement directly from the user-input request description data avoids syntax errors and semantic ambiguities that occur when business personnel manually write query language, reducing query retries and correction time, thereby improving data query efficiency. On the other hand, introducing the requesting account's data access permissions as a constraint when generating the target query statement limits the target query statement to the scope of access permissions, preventing unauthorized queries and invalid data access, thus improving data query efficiency while further enhancing data query security.

[0072] Based on the technical solutions of the above embodiments, this application also provides an optional embodiment. In this optional embodiment, the process of generating the target query statement corresponding to the data query request based on the requested description data and data access permissions is refined.

[0073] See Figure 2The steps for generating the target query statement shown include:

[0074] S210, Based on the request description data, determine the database to be accessed corresponding to the data query request.

[0075] In one optional implementation, semantic parsing and keyword extraction can be performed on the request description data to identify the query business type. Then, based on a pre-determined mapping relationship between the business type and the database, the database corresponding to the query business type corresponding to the request description data can be used as the database to be accessed for the data query request.

[0076] In another alternative implementation, the request description data can be input into a database classification model to determine the database to be accessed corresponding to the data query request. The database classification model can determine the database that best matches the request characteristics, for example, the database with the most matching request characteristics, and output this database as the database to be accessed.

[0077] S220, Based on data access permissions, determine the set of authorized databases for the requesting account.

[0078] For example, a permission configuration library can be pre-built, which includes data access permissions corresponding to different account roles. Since the data access permissions can include database identifiers of each database that the requesting account can access, the databases corresponding to each database identifier recorded in the data access permissions can be used as the set of authorized access databases.

[0079] S230, Based on the existence of the database to be accessed in the authorized access database set, generate the target query statement corresponding to the data query request.

[0080] In one alternative implementation, if the database to be accessed exists in the set of authorized access databases, the authorized access fields in the database to be accessed can be determined based on data access permissions; and the target query statement corresponding to the data query request can be generated based on the request description data and the authorized access fields.

[0081] The data access permissions include not only the database identifiers of the databases that the requesting account can access, but also the authorized access fields in each database.

[0082] For example, the request description data and the authorized access fields in each database to be accessed can be input into the target query statement generation model to generate the target query statement corresponding to the data query request. The target query statement can query only the authorized access fields in the database to be accessed.

[0083] In this embodiment, the target query statement corresponding to the data query request is generated based on the request description data and authorized access fields. This can constrain the target query statement at the field level, thereby maximizing the security of data query.

[0084] In another alternative implementation, if the database to be accessed exists in the authorized access database set, a target query statement corresponding to the data query request can be generated based on the request description data. For example, the request description data can be directly input into the target query statement generation model to generate the target query statement corresponding to the data query request.

[0085] In another alternative implementation, if the database to be accessed exists in the authorized access database set, an initial query statement corresponding to the data query request can be generated based on the request description data; candidate data can be queried from the database to be accessed based on the initial query statement; and the initial query statement can be updated based on the acquisition of candidate data to generate the target query statement corresponding to the data query request.

[0086] The acquisition of candidate data can characterize the accuracy of the initial query statement.

[0087] Optionally, if the candidate data is empty or the system prompts that the query cannot be performed, the initial query statement is determined to be inaccurate, and then the update operation of the initial query statement is executed.

[0088] For example, the acquisition status of candidate data (such as error messages or empty results), request description data, and initial query statement can be input into the LLM, and the LLM can be asked to analyze the error cause of the initial query statement and update the initial query statement until the target query statement is output.

[0089] In one embodiment, the generation process of the target query statement can be completed entirely using a Large Language Model (LLM). For example, a permission configuration library can be pre-built, which includes data access permissions corresponding to different account roles and business description data corresponding to each database. The database to be accessed is determined based on the request description data, and the set of authorized access databases corresponding to the requesting account is determined from the permission configuration library. If the database to be accessed exists in the set of authorized access databases, the business description data of the database to be accessed is obtained.

[0090] Furthermore, the request description data and the business description data of the database to be accessed are input into the LLM, and the LLM is required to determine whether the request description data indicates that the database to be accessed should be queried. If the LLM outputs an affirmative conclusion, the field-level permission rules, the identifier of the database to be accessed, the account role of the requesting account, and the request description data are input into the LLM, and the LLM is required to determine whether the requesting account has the right to access the fields to be accessed in the database to be accessed. If the LLM outputs an affirmative conclusion, the request description data and the identifiers of the fields to be accessed in each database to be accessed are input into the LLM, and the LLM is required to generate an initial query statement. If the target data is obtained based on the initial query statement, the initial query statement is directly used as the target query statement; if the candidate data obtained based on the initial query statement is abnormal, the acquisition status of the candidate data (e.g., the error message or empty result), the request description data, and the initial query statement are input into the LLM, and the LLM is required to analyze the error cause of the initial query statement and update the initial query statement until the target query statement is output.

[0091] In the above embodiments, the target query statement is generated based on the database with access permissions and the request description data. This ensures that the generation of the target query statement is completely free from the involvement of the database without access permissions, fundamentally avoiding the possibility of generating query language involving unauthorized access and improving the security of data query.

[0092] Based on the technical solutions of the above embodiments, this application also provides an optional embodiment. In this optional embodiment, the request description data carries a data display requirement, and this optional embodiment provides the steps after the target data is retrieved when the data display requirement indicates that the target data needs to be displayed in the target system.

[0093] See Figure 3 The target data display steps shown include:

[0094] S310, based on the requested description data and / or target data, determine the information to which the target data belongs in the target system.

[0095] The target system can typically be a business intelligence system (BIS) ).

[0096] The information belonging to the target data in the target system can be the business dimension information corresponding to the target data within the target system. The business dimension information can include at least one of business unit, group, and date.

[0097] In an alternative implementation, request description data can be input into the LLM, and the LLM can be asked to extract the information about the target data's ownership in the target system from the request description data.

[0098] In another alternative implementation, reference information corresponding to different data can be predetermined, and the reference information corresponding to the target data can be used as the ownership information of the target data in the target system.

[0099] In another alternative implementation, an LLM can be used to determine the belonging information of the target data in the target system based on the request description data; and to determine the belonging information of the target data in the target system based on the target data; and if the two are consistent, the latter can be used as the belonging information of the target data in the target system.

[0100] S320: Encodes the information according to the encoding rules of the target system to generate encoded information that matches the target system.

[0101] The coding rules can be understood as a static mapping table between the business dimensions of the target system and the internal coding of BI. It can be understood that different systems may have different coding rules.

[0102] For example, the information belonging to the target data in the target system can be encoded according to the corresponding encoded data in the aforementioned static mapping table to generate encoded information that matches the target system. For example, different data have different basic codes, and the basic codes corresponding to different data in the target data are structurally integrated to generate encoded information that matches the target system.

[0103] S330 generates jump links based on encoded information.

[0104] The jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0105] For example, the basic template and parameter rules of the BI system's pre-set Uniform Resource Locator (URL) can be obtained, and the encoded information can be URL encoded according to the BI rules to generate a URL redirection link.

[0106] Optionally, to improve the accuracy of the redirect links, the generated redirect links can be validated for parameter integrity, and the redirect links can be generated only if the integrity validation passes.

[0107] In the above embodiments, the target data can be output in different forms. If there is a requirement for the target system to display the target data, a jump link can also be generated, and the target data can be displayed on the target system through the jump link.

[0108] In some embodiments, where the data display requirement representation necessitates the presentation of target data in natural language, the target data can be integrated to generate a natural text description. For example, the target data can be input into an LLM (Local Language Management System), and the LLM can be instructed to summarize the target data into a fluent natural text description.

[0109] When data needs to be displayed in chart form to represent demand, chart headers can be generated based on the data attributes of the target data, and data values ​​can be added to the chart to create a visual chart.

[0110] When data needs to be displayed in detail to represent demand, the target data can be saved as a chart document, and a download link for the details can be provided.

[0111] Based on the technical solutions of the above embodiments, this application also provides an optional embodiment. In this optional embodiment, the data query method provided by this application is described in detail.

[0112] See Figure 4 The data query methods shown include:

[0113] S401, in response to the data query request, obtain the data access permissions of the requesting account corresponding to the data query request;

[0114] The data query request includes a request description.

[0115] S402, Based on the request description data, determine the database to be accessed corresponding to the data query request, and based on the data access permissions, determine the set of authorized databases for the requesting account;

[0116] S403, Determine if the database to be accessed exists in the authorized access database set. If it does, proceed to S405; otherwise, proceed to S404.

[0117] S404, generates an access denied message;

[0118] S405, Based on data access permissions, determine the authorized access fields in the database to be accessed;

[0119] S406, Based on the request description data and authorized access fields, generate the initial query statement corresponding to the data query request;

[0120] S407, Based on the initial query statement, retrieve candidate data from the database to be accessed;

[0121] S408, based on the acquisition of candidate data, update the initial query statement to generate the target query statement corresponding to the data query request;

[0122] S409, Based on the target query statement, query the target data from the database;

[0123] S410, where the data display requirement representation requires the target data to be displayed in the target system, determine the information to which the target data belongs in the target system based on the request description data and / or the target data;

[0124] S411, Encode the information according to the coding rules of the target system to generate coded information that matches the target system;

[0125] S412, generates a jump link based on the encoded information;

[0126] The jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0127] In one embodiment, assuming the data query system includes an intent recognition node (analyze_intent), a permission verification node (check_permission), an SQL generation node (generate_sql), an SQL execution node (execute_sql), an SQL repair node (fix_sql), a direct answer node (direct_answer), a result explanation node (explain_result), a chart configuration generation node (generate_echarts_config), a chart rendering and storage node (save_image_data), a BI parameter extraction node (generate_bi_param), a BI parameter conversion node (parse_bi_param), a BI jump generation node (bi_answer), a download-specific SQL generation node (generate_sql_download), a download SQL execution node (execute_sql_download), a related query recommendation node (suggest_queries), a parallel subprocess execution node (run_text2sql), a deep report generation node (generate_report), a report storage node (save_html), and a report output node (html_answer), the data query method provided in this application will be described in detail:

[0128] After the user inputs a request description on the front end, the system retrieves the request description and enters the intent recognition node. The backend calls the LLM (Limited Language Management) to perform intent recognition on the request description, determining whether the user's request is a data query request. If not, the LLM generates a regular natural language response and the process ends. If it is, the system responds to the data query request and identifies the database to be accessed. Then, the process enters the permission verification node. The backend retrieves the data access permissions corresponding to the requesting account's role and, combined with the user's department, business unit information, and field-level permission rules, calls the LLM to verify the access permissions of the database and fields to be accessed. If the verification passes, subsequent steps are executed.

[0129] After successful verification, the process enters the SQL generation node. Based on the table structure information and request description data within the authorized scope, the system calls the LLM to generate an initial SQL statement with a limited number of rows. Subsequently, the SQL execution node calls the database connector to execute the initial SQL statement. If an error occurs or an empty result is returned, the SQL repair node is triggered. The error information, the original problem, and the initial SQL are sent to the LLM for SQL statement correction. The corrected SQL statement re-enters the execution phase to form a closed loop until a valid result is obtained or the maximum number of retries is reached, the target SQL statement is generated, and subsequent steps are executed.

[0130] The process enters the result interpretation node, where the LLM converts the target data queried based on the target SQL language into a natural language description. Simultaneously, multiple output processing methods are initiated in parallel: In the chart visualization direction, the chart configuration generation node generates the visualization configuration, and the chart rendering and storage node completes image rendering and storage; in the BI system redirection direction, the BI parameter extraction node first extracts key dimensions such as date and department from the user request, then the BI parameter conversion node converts the business name into the BI system's internal code, and finally the BI redirection generation node concatenates and generates a directly accessible BI report link; in the detailed data download direction, the download-specific SQL generation node and the download SQL execution node generate and execute the full query SQL, export an Excel file, and provide a download link.

[0131] For complex analysis requests, after completing the basic result interpretation, the system enters the related query recommendation node, where LLM recommends several in-depth analysis questions. Subsequently, the parallel sub-process execution node independently starts a complete data query process for each supplementary description request example and executes it in parallel. It also integrates the target data corresponding to each data query request to generate a data query report for easy review and organization by users.

[0132] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0133] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.

[0134] In one exemplary embodiment, such as Figure 5 As shown, a data query device is provided, including: an access control module 510, a language generation module 520, and a data query module 530, wherein:

[0135] The permission acquisition module 510 is used to respond to a data query request and obtain the data access permissions of the requesting account corresponding to the data query request; the data query request carries request description data;

[0136] The language generation module 520 is used to generate the target query statement corresponding to the data query request based on the request description data and data access permissions;

[0137] The data query module 530 is used to query target data from the database based on the target query statement.

[0138] In one embodiment, the language generation module 520 includes a first determining unit, configured to determine the database to be accessed corresponding to the data query request based on the request description data; and a second determining unit, configured to determine the authorized access database set corresponding to the requesting account based on data access permissions; and a first generating unit, configured to generate the target query statement corresponding to the data query request based on the existence of the database to be accessed in the authorized access database set.

[0139] In one embodiment, the first generation unit includes a first determining subunit, configured to determine the authorized access field in the database to be accessed based on data access permissions, provided that the database to be accessed exists in the authorized access database set; and the first generation subunit is configured to generate a target query statement corresponding to the data query request based on the request description data and the authorized access field.

[0140] In one embodiment, the first generation unit is specifically used to generate a target query statement corresponding to the data query request based on the request description data, when the database to be accessed exists in the authorized access database set.

[0141] In one embodiment, the first generation unit includes a second generation subunit, configured to generate an initial query statement corresponding to the data query request based on the request description data, provided that the database to be accessed exists in the authorized access database set; a query subunit, configured to query candidate data from the database to be accessed based on the initial query statement; and a third generation subunit, configured to update the initial query statement based on the acquisition of candidate data, so as to generate a target query statement corresponding to the data query request.

[0142] In one embodiment, the request description data carries a data display requirement. When the data display requirement indicates that the target data needs to be displayed in the target system, the data query device further includes a link generation module, comprising a third determining unit for determining the information belonging to the target data in the target system based on the request description data and / or the target data; a second generating unit for encoding the information according to the encoding rules of the target system to generate encoded information matching the target system; and a third generating unit for generating a jump link based on the encoded information. The jump link is used to jump to a target page in the target system; the target page is used to display the target data.

[0143] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0144] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a data query method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0145] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0146] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0147] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0148] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0149] Based on the target query statement, retrieve the target data from the database.

[0150] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0151] Based on the request description data, determine the database to be accessed corresponding to the data query request; and,

[0152] Based on data access permissions, determine the set of databases authorized for access corresponding to the requesting account;

[0153] Based on the existence of the database to be accessed in the authorized access database set, generate the target query statement corresponding to the data query request.

[0154] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0155] If the database to be accessed exists in the set of authorized access databases, determine the authorized access fields in the database to be accessed based on the data access permissions;

[0156] Based on the request description data and authorized access fields, generate the target query statement corresponding to the data query request.

[0157] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0158] If the database to be accessed exists in the authorized access database set, generate the target query statement corresponding to the data query request based on the request description data.

[0159] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0160] If the database to be accessed exists in the authorized access database set, generate the initial query statement corresponding to the data query request based on the request description data;

[0161] Based on the initial query statement, retrieve candidate data from the database to be accessed;

[0162] Based on the availability of candidate data, the initial query statement is updated to generate the target query statement corresponding to the data query request.

[0163] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0164] Based on the requested description data and / or target data, determine the information to which the target data belongs in the target system;

[0165] According to the coding rules of the target system, the relevant information is encoded to generate coded information that matches the target system;

[0166] Based on the encoded information, a jump link is generated; the jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0167] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0168] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0169] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0170] Based on the target query statement, retrieve the target data from the database.

[0171] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0172] Based on the request description data, determine the database to be accessed corresponding to the data query request; and,

[0173] Based on data access permissions, determine the set of databases authorized for access corresponding to the requesting account;

[0174] Based on the existence of the database to be accessed in the authorized access database set, generate the target query statement corresponding to the data query request.

[0175] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0176] If the database to be accessed exists in the set of authorized access databases, determine the authorized access fields in the database to be accessed based on the data access permissions;

[0177] Based on the request description data and authorized access fields, generate the target query statement corresponding to the data query request.

[0178] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0179] If the database to be accessed exists in the authorized access database set, generate the target query statement corresponding to the data query request based on the request description data.

[0180] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0181] If the database to be accessed exists in the authorized access database set, generate the initial query statement corresponding to the data query request based on the request description data;

[0182] Based on the initial query statement, retrieve candidate data from the database to be accessed;

[0183] Based on the availability of candidate data, the initial query statement is updated to generate the target query statement corresponding to the data query request.

[0184] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0185] Based on the requested description data and / or target data, determine the information to which the target data belongs in the target system;

[0186] According to the coding rules of the target system, the relevant information is encoded to generate coded information that matches the target system;

[0187] Based on the encoded information, a jump link is generated; the jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0188] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0189] In response to a data query request, obtain the data access permissions for the account corresponding to the data query request; the data query request carries a request description.

[0190] Based on the requested data description and data access permissions, generate the target query statement corresponding to the data query request;

[0191] Based on the target query statement, retrieve the target data from the database.

[0192] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0193] Based on the request description data, determine the database to be accessed corresponding to the data query request; and,

[0194] Based on data access permissions, determine the set of databases authorized for access corresponding to the requesting account;

[0195] Based on the existence of the database to be accessed in the authorized access database set, generate the target query statement corresponding to the data query request.

[0196] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0197] If the database to be accessed exists in the set of authorized access databases, determine the authorized access fields in the database to be accessed based on the data access permissions;

[0198] Based on the request description data and authorized access fields, generate the target query statement corresponding to the data query request.

[0199] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0200] If the database to be accessed exists in the authorized access database set, generate the target query statement corresponding to the data query request based on the request description data.

[0201] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0202] If the database to be accessed exists in the authorized access database set, generate the initial query statement corresponding to the data query request based on the request description data;

[0203] Based on the initial query statement, retrieve candidate data from the database to be accessed;

[0204] Based on the availability of candidate data, the initial query statement is updated to generate the target query statement corresponding to the data query request.

[0205] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0206] Based on the requested description data and / or target data, determine the information to which the target data belongs in the target system;

[0207] According to the coding rules of the target system, the relevant information is encoded to generate coded information that matches the target system;

[0208] Based on the encoded information, a jump link is generated; the jump link is used to jump to the target page in the target system; the target page is used to display the target data.

[0209] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0210] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0211] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0212] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data query method, characterized in that, The method includes: In response to a data query request, obtain the data access permissions of the requesting account corresponding to the data query request; the data query request carries request description data; Based on the request description data and the data access permissions, generate the target query statement corresponding to the data query request; Based on the target query statement, retrieve the target data from the database.

2. The method according to claim 1, characterized in that, The step of generating the target query statement corresponding to the data query request based on the request description data and the data access permissions includes: Based on the request description data, determine the database to be accessed corresponding to the data query request; and, Based on the data access permissions, determine the set of authorized databases corresponding to the requesting account; Based on the existence of the database to be accessed in the authorized access database set, a target query statement corresponding to the data query request is generated.

3. The method according to claim 2, characterized in that, The step of generating the target query statement corresponding to the data query request based on the existence of the database to be accessed in the authorized access database set includes: If the database to be accessed exists in the set of authorized access databases, the authorized access fields in the database to be accessed are determined according to the data access permissions. Based on the request description data and the authorized access field, generate the target query statement corresponding to the data query request.

4. The method according to claim 2, characterized in that, The step of generating the target query statement corresponding to the data query request based on the existence of the database to be accessed in the authorized access database set includes: If the database to be accessed exists in the authorized access database set, the target query statement corresponding to the data query request is generated based on the request description data.

5. The method according to claim 2, characterized in that, The step of generating the target query statement corresponding to the data query request based on the existence of the database to be accessed in the authorized access database set includes: If the database to be accessed exists in the authorized access database set, an initial query statement corresponding to the data query request is generated based on the request description data. Based on the initial query statement, candidate data is queried from the database to be accessed; Based on the acquisition of the candidate data, the initial query statement is updated to generate the target query statement corresponding to the data query request.

6. The method according to any one of claims 1-5, characterized in that, The request description data carries a data display requirement; where the data display requirement indicates that the target data needs to be displayed in the target system, the method further includes: Based on the requested description data and / or the target data, determine the information to which the target data belongs in the target system; According to the encoding rules of the target system, the relevant information is encoded to generate encoded information that matches the target system; Based on the encoded information, a jump link is generated; the jump link is used to jump to the target page in the target system; the target page is used to display the target data.

7. A data query device, characterized in that, The device includes: The permission acquisition module is used to respond to a data query request and acquire the data access permissions of the requesting account corresponding to the data query request; the data query request carries request description data; The language generation module is used to generate the target query statement corresponding to the data query request based on the request description data and the data access permissions. The data query module is used to query target data from the database based on the target query statement.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.