Data query method and apparatus, and related device
By semantically parsing the natural language input by users to generate SQL queries, the problem of low efficiency in generating traditional profit and loss analysis reports is solved, and the effect of quickly generating personalized data reports is achieved.
Patent Information
- Application Number
- PCT/CN2025/087874
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-07
- Filing Date
- 2025-04-08
- Publication Date
- 2025-12-11
AI Technical Summary
Traditional profit and loss analysis reports are time-consuming and inefficient, failing to meet the needs of enterprises to quickly generate personalized reports based on different dimensions.
By semantically parsing the natural language input by the user, a structured query language (SQL) is generated, and a matching data report is retrieved from a data report repository or database using an SQL query engine.
It enables the rapid generation of data reports through natural language input, improving the efficiency and flexibility of data querying and meeting enterprises' needs for personalized reports.
Smart Images

Figure CN2025087874_11122025_PF_FP_ABST
Abstract
Description
A data query method, device and related equipment
[0001] The present application claims priority to the Chinese patent application No. 202410743205.2, filed on June 7, 2024, and entitled "A data query method, device and related equipment", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the field of data analysis, and in particular to a data query method, device and related equipment. BACKGROUND
[0003] In the process of business management of an enterprise, various types of business analysis reports are usually needed, for example, a profit and loss analysis report presenting the profit and loss results in the process of enterprise operation based on the difference between the net profit and loss in the accounting period specified according to the income and expenditure of the enterprise. In the traditional technology, the analysis process of the profit and loss analysis report often relies on expert experience, and the final profit and loss analysis report is determined by manually screening data and formulating measurement rules. However, for products with various types, complex sales forms and sales regions, the enterprise often needs to present different profit and loss analysis reports according to different dimensions. Using the profit and loss report analysis method in the traditional technology requires manually screening data and formulating differentiated measurement rules based on the requirements of different dimensions, which results in a long time-consuming process and low efficiency, and cannot meet the requirements of the enterprise. Therefore, how to provide a more efficient business report analysis method has become a technical problem to be solved. SUMMARY
[0004] The present application provides a data query method, which combs the relationship between the measurement calculation rules and data in various types of data, quickly understands the natural language and generates SQL query language by inputting natural language, and obtains the data report required by the user. The problem of difficult and efficient generation of data caused by frequent data update and the requirement of individualized customization of data display form is solved, and the efficiency of data query is improved.
[0005] In a first aspect, a data query method is provided. The method includes: performing semantic analysis on natural language input by a user; converting the natural language after semantic analysis into structured query language (SQL); sending a request to execute the SQL language to a data report library or a database according to the generated structured query language (SQL query language); wherein the database includes any one or more of source data, summary data, and acceleration data; the data report library includes one or more data reports, and the data reports are obtained according to a business logic relationship of data; displaying a data report returned from the data report library and matched with the natural language; or displaying a data report formed by data in the database, and the data is returned from the database and matched with the natural language input by the user.
[0006] The method described in the first aspect is implemented by converting the natural language after semantic analysis into structured query language (SQL); sending a request to execute the SQL language to a data report library or a database according to the generated structured query language; wherein the database includes any one or more of source data, summary data, and acceleration data; the data report library includes one or more data reports, and the data reports are obtained according to a business logic relationship of data; finally, displaying a data report returned from the data report library and matched with the natural language; or displaying a data report formed by data in the database, and the data is returned from the database and matched with the natural language input by the user. The process of obtaining a data report in a SQL relationship library through natural language input is implemented, and the efficiency of data query is improved.
[0007] In a possible implementation, the source data includes IT fields, dimension fields, and measure fields; the summary data includes IT fields, dimension fields, and measure fields; and the fields in the summary data are obtained from the fields in the source data.
[0008] In the above implementation, a field is a basic unit of stored data, and is used to describe a certain feature or attribute of a document. Managing the source data through fields is conducive to quickly retrieving corresponding fields and values corresponding to the fields, and improves the efficiency of data management and query. Dividing data into source data and summary data is conducive to hierarchical management of data according to business relationships, storing logically calculated data in a summary database, and improving the efficiency of data management.
[0009] In a possible implementation, the summary data is obtained by performing a metric calculation on the source data; wherein the metric calculation is obtained according to a metric calculation rule, the metric calculation rule is stored in a metric calculation library in a semantic library, and the metric calculation rule is used to indicate a logical relationship between data; and the acceleration data is determined according to an access frequency of a dimension field in the summary data and / or an access frequency of a metric field in the summary data.
[0010] In the implementation, the acceleration data is data that is frequently clicked and accessed, and by setting the cache of the acceleration data, a user can quickly obtain commonly used data or commonly used reports.
[0011] In a possible implementation, the converting the semantic analysis result of the natural language into a structured query language (SQL) includes: performing semantic analysis on the natural language input by the user to obtain a user intention; generating an SQL query statement according to the user intention; and the SQL query statement is constructed according to a metric calculation rule and a data relationship, the metric calculation rule is stored in a metric calculation library in a semantic library, and the data relationship is stored in a relationship configuration library in the semantic library.
[0012] In the implementation, because there is a metric calculation rule and a data relationship between data, the data or reports are obtained in combination with the metric calculation rule in an SQL query statement, and the efficiency of data query is improved.
[0013] In a possible implementation, the sending, according to the generated structured query language, a request for executing an SQL language to a data report library or a database includes:
[0014] The SQL language execution request includes a query operation corresponding to the SQL query statement; the query operation includes that an SQL query engine sends a data acquisition request to the database, the data acquisition request includes a data type and a field type; the data type includes any one or more of source data, summary data, and acceleration data, and the field type includes any one or more of an IT field, a dimension field, and a metric field.
[0015] In the implementation, the data type and the field type that need to be obtained are accurately determined through the data acquisition request, and data values are quickly obtained.
[0016] In a possible implementation, different types of users have different access permissions to the data and / or the data reports; wherein the different types of users include any one or more of different regions, different departments, different products, and different customer types.
[0017] The above implementation manner protects the security and privacy of data by setting different access permissions.
[0018] In a possible implementation manner, the accelerated data is determined according to the access frequency of the dimension field in the summary data and the access frequency of the metric field in the summary data, including: determining whether the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than a threshold value, and in a case where the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than a first threshold value, creating the dimension field in the summary data or the metric field in the summary data into the accelerated data, the accelerated data including an accelerated report, the accelerated report having a quick access interface.
[0019] The above implementation manner helps users to quickly query, obtain commonly used fields, data and reports by creating accelerated data or creating an accelerated report.
[0020] In a possible implementation manner, in a case where the access frequency of the dimension field in the accelerated data or the access frequency of the metric field in the accelerated data is less than a second threshold value, the accelerated data corresponding to the dimension field in the accelerated data or the metric field in the accelerated data is deleted, the accelerated data including an accelerated report.
[0021] The above implementation manner helps to update and dynamically adjust the accelerated data in real time by deleting the accelerated data with an access frequency lower than a threshold value according to the change of the access frequency of the user.
[0022] In a second aspect, a data query apparatus is provided, including: a semantic analysis module, configured to perform semantic analysis on natural language input by a user; a semantic conversion module, configured to convert the natural language after semantic analysis into structured query language (SQL); an SQL query engine, configured to send a request for executing the SQL language to a data report library or a database according to the generated structured query language; wherein the database includes any one or more of source data, summary data and accelerated data; the data report library includes one or more data reports, the data reports being obtained according to a business logic relationship of data; and a display module, configured to display a data report matched with the natural language returned from the data report library, or configured to display a data report formed by data in the database, the data being returned from the database and matched with the natural language input by the user. The data query apparatus is configured to perform the operation steps of the method described in the first aspect.
[0023] In a third aspect, a chip system is provided, which includes a processor and a power supply circuit, the power supply circuit is configured to supply power to the processor, and the processor is configured to perform the operation steps of the method according to the first aspect.
[0024] In a fourth aspect, a computing device is provided, which includes a processor and a memory, the memory is configured to store instructions, and the processor is configured to execute the instructions to enable the computing device to implement the method according to the first aspect.
[0025] In a fifth aspect, a computer readable storage medium is provided, which stores instructions, and the instructions are configured to be executed by a computing device or a computing device cluster to implement the method according to the first aspect.
[0026] In a sixth aspect, a computing device cluster is provided, which includes at least one computing device, each of the at least one computing device includes a processor and a memory, and the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to enable the computing device cluster to implement the method according to the first aspect.
[0027] In a seventh aspect, a computer program product is provided, which includes instructions, the instructions are configured to be executed on a computing device or stored in any available medium, and when the computer program product is executed on a computing device or a computing device cluster, the computing device or the computing device cluster is enabled to perform the method according to the first aspect.
[0028] In an eighth aspect, a computer readable storage medium is provided, which includes computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster is enabled to perform the method according to the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0029] FIG. 1 is an architecture diagram of a data query device provided by the present application;
[0030] FIG. 2 is a flowchart of a data query method provided by the present application;
[0031] FIG. 3 is a structural schematic diagram of a computing device provided by the present application;
[0032] FIG. 4 is an example diagram of a computing device cluster provided by the present application;
[0033] FIG. 5 is another example diagram of a computing device cluster provided by the present application. DETAILED DESCRIPTION
[0034] In order to provide a more efficient data query method, the application provides a method for automatically querying and obtaining a data report matched with a natural language input by a user by converting the natural language into an SQL language, executing an SQL statement through an SQL query engine, calling data from a database, and generating a data report, wherein the database includes any one or more of source data, summary data, and acceleration data. As can be seen, by storing different data separately, it is beneficial to quickly obtain the data required by the user through the SQL query statement, and at the same time, the user only needs to input the natural language, for example, "generate a 2023 annual report", to automatically obtain the data corresponding to the fields required by the annual report from the database, generate a data report corresponding to the natural language, and improve the efficiency of data query.
[0035] In order to facilitate understanding, the terms involved in the application are first explained.
[0036] Structured Query Language (SQL): The earliest is a query language developed by IBM's St. Joseph Research Laboratory for its relational database management system SYSTEM R. SQL is a programming language used to manage a relational database management system (RDBMS) or perform stream processing in a relational database stream management system (RDSMS). It is based on relational algebra and tuple relational calculus, including a data definition language and a data manipulation language. The scope of SQL includes data insertion, query, update and deletion, database schema creation and modification, and data access control. Although SQL is often described as, and to a large extent is, a declarative programming (DP), it also contains procedural programming elements.
[0037] Dimension: In business, dimension is a perspective for observing and analyzing data, supporting data aggregation, drilling, and slicing analysis. It is usually used to describe the attributes of different characteristics of data. In a data warehouse, different dimension fields are used to identify each dimension, and then the classification and storage method of data are distinguished according to different dimension fields, and data query function can be realized based on dimension field. For example, in a data warehouse, data can be classified and stored according to different dimension fields such as time, region, product, etc. Dimension can have attributes such as hierarchy, level, member, and attribute. (1) Hierarchy: Dimension can have hierarchy, for example, time dimension can be divided into year, quarter, month, day, etc. (2) Level: Dimension can have level, for example, region dimension can be divided into country, province, city, etc. (3) Member: Each level or level of dimension is called a member of the dimension. For example, the member of time dimension can be a specific date. (4) Attribute: Dimension can have attributes, for example, product dimension can have color, size, etc. Through dimension, we can analyze and display data differently. For example, in sales data analysis, we can analyze sales trend through time dimension, analyze sales difference in different regions through region dimension, and analyze sales amount and sales volume of different products through product dimension.
[0038] Dimension field: In database, field is the basic unit of storing data, used to describe the characteristics or attributes of literature. Dimension field is a field used to describe different characteristics of data.
[0039] Measure: Measure is a quantifiable numerical representation of business conditions, usually a number such as amount, quantity, period, etc. The relationship between indicator and measure: measure is a numerical data, which does not have business meaning itself. Only when measure is placed in the business context, it can reflect the business meaning and become an indicator.
[0040] Measure field is a field used to record measure. For example, measure field includes RMN actual exchange rate and current amount.
[0041] IT field: is the field marked by IT personnel in the process of deploying, storing and transmitting data. It is used to represent the characteristics of data. For example, the last update date in the IT field represents the last update date of the data.
[0042] Secondly, the application scenarios involved in the present application are explained.
[0043] For businesses or enterprises, the demand for data reports is widely distributed in various fields. For example, in the financial field, financial reports and operational analysis involve updating and querying various data reports. However, since the above data table often involves multiple different fields, different fields need to be reflected in the data table according to different data analysis needs, therefore, how to efficiently generate data reports corresponding to the fields according to the needs of users is a problem to be solved. In addition, usually, the user needs to manually select the fields in the filter box, which makes the process of generating data tables inefficient in the case of a large number of fields.
[0044] In order to solve the problem of complicated data query process caused by low efficiency of manual selection and high degree of user demand customization in the data query process, the present application provides a data query method, which converts the natural language into structured query language (SQL) according to the semantic analysis of the natural language input by the user; according to the natural language after semantic analysis, the natural language after semantic analysis is converted to generate a structured query language (SQL); according to the generated structured query language, the data report returned from the data report library is displayed after executing the SQL language; or, the data report formed by the data in the database is displayed. Through the above method, the user can directly obtain the customized data report according to the input of natural language, without manually selecting the data required by the user, thereby improving the efficiency of data query.
[0045] The technical solutions provided by the present application will be explained and described below in conjunction with the accompanying drawings.
[0046] Figure 1 is a structural diagram of a data query device provided by the present application, as shown in Figure 1, the architecture includes a data storage module 100, a semantic library 200, a SQL query engine 300, a semantic analysis module 400, a display module 500, a user 600; wherein the data storage module 100 includes a database and a data report library, the database includes source data, summary data, and acceleration data; the data report library includes report data; the semantic library 200 includes a relationship configuration library, a metric calculation library, a data authority library, and a logical model library; the SQL query engine 300 includes a SQL language execution unit and a report receiving unit; the semantic analysis module 400 includes a semantic analysis unit and a semantic conversion unit; the display module 500 includes an input unit, a filtering unit, and a report display unit.
[0047] The number of data storage module 100 and semantic library 200 can be one or more, the semantic library 200 can be independently deployed in a module outside the data storage module 100, and exist separately, or can be deployed in the data storage module, that is, the data storage module can also include a semantic library. Figure 1 is only an example of one of the embodiments, and the present application is not limited herein.
[0048] The data storage module 100 is deployed in a physical server, such as an ARM server or an X86 server, which is not limited in the present application. It can be deployed in a storage device or a storage array, where the storage device can be a hard disk drive (HDD), a solid state disk (SSD), a mechanical hard disk (HDD), a USB, a flash, an SD card, a memory stick, etc., which is not limited in the present application. The storage array can be a redundant array of independent disks (RAID), a network attached storage (NAS), a storage area network (SAN), etc., which is not limited in the present application. The storage device can also be a virtual storage device provided by a cloud storage service.
[0049] The data storage module 100, the semantic library 200, the SQL query engine 300, the semantic parsing module 400, and the display module 500 can be implemented by software or by hardware. For example, the implementation of the data storage module 100 is introduced as follows. Similarly, the implementation of the semantic library 200, the SQL query engine 300, the semantic parsing module 400, and the display module 500 can refer to the implementation of the data storage module 100.
[0050] As an example of a software functional unit, a module can include code running on a computing instance. The computing instance can include at least one of a physical host (computing device), a virtual machine, and a container. Further, the computing instance can be one or more. For example, the data storage module 100 can include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers running the code can be distributed in the same region, or in different regions. Further, the multiple hosts / virtual machines / containers running the code can be distributed in the same availability zone (AZ), or in different AZs, where each AZ includes one data center or multiple data centers with close geographical locations. Generally, one region can include multiple AZs.
[0051] Likewise, the multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, usually one VPC is set in one region, and communication between two VPCs in the same region and between VPCs in different regions needs to set a communication gateway in each VPC to realize the interconnection between VPCs through the communication gateway.
[0052] As an example of a hardware functional unit, the data storage module 100 can include at least one computing device, such as a server, etc. Alternatively, the module can also be implemented by a central processing unit (CPU), or by an application-specific integrated circuit (ASIC), or by a programmable logic device (PLD) device, etc. Among them, the above-mentioned PLD can be implemented by a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a neural network processing unit (NPU), a system on chip (SoC), an offload card, an acceleration card, or any combination thereof.
[0053] Taking the data storage module 100 as an example, the multiple computing devices included in the data storage module 100 can be distributed in the same region or in different regions. The multiple computing devices included in the data storage module 100 can be distributed in the same AZ or in different AZs. Likewise, the multiple computing devices included in the data storage module 100 can be distributed in the same VPC or in multiple VPCs. Among them, the multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offload cards, acceleration cards, etc.
[0054] It should be noted that in other embodiments, the data storage module 100, the semantic library 200, the SQL query engine 300, the semantic analysis module 400, and the display module 500 are responsible for implementing the steps as needed, and by the data storage module 100, the semantic library 200, the SQL query engine 300, the semantic analysis module 400, and the display module 500 respectively implementing different steps in the data query method provided by the present application to achieve all the functions of the data query device.
[0055] The data storage module 100 includes a database, which is used to store and / or transmit source data, summary data, and acceleration data. The source data, summary data, and acceleration data are used to generate a data report, and the source data, summary data, and acceleration data can also be in the form of a data report. The source data can be data from one or more clients or sources, for example, the source data includes: a revenue table of sales channel A, a revenue table of sales channel B, and a revenue table of sales channel C. The summary data is a total revenue table of all sales channels, which is presented to the user in the form of a data report. The summary data is obtained by measuring and calculating the source data. The above process is only an example of one embodiment, and the present application does not make specific limitations on the measurement calculation rules in the measurement calculation library. The acceleration data refers to any one or more of the summary data whose access frequency is higher than a threshold value, and its function is to allow the user to quickly access the data that needs to be accessed frequently.
[0056] The data storage module 100 further includes a data report library, which is used to store and / or transmit one or more report data. Each report data has fixed fields and data corresponding to the fields. The function of the report data is to allow the user to directly obtain the report file without the need for measurement and calculation of the data in the database, which is convenient and fast. The report data has a refresh frequency. As an example, the report data can have a refresh frequency of daily / once or monthly / once. The refresh frequency of the report data is determined according to the needs of the business described by the report.
[0057] The semantic library 200 includes a relationship configuration library, a metric calculation library, a data authority library, and a logic model library. The relationship configuration library includes data relationships, such as mapping relationships between data and Chinese-English conversion relationships between data. The mapping relationship between data is data with the same meaning in different reports, for example, the sales in the profit table and the sales in the sales table have a mapping relationship, both of which represent the same meaning and appear in different reports. The Chinese-English conversion relationship is the conversion relationship between a data field represented in Chinese and a data field represented in English in report data. In one application scenario, the subject name used to represent the report data is represented in English in the ID field. Through the Chinese-English conversion in the relationship configuration library, the field represented in English can be converted into a Chinese name, which is convenient for users to view. The metric calculation library includes various operation rules and calculation logic. For example, profit = revenue - cost. The data authority library includes a user data access authority table. The user access authority data is carried in the data acquisition request sent by the query engine to the database or data report, and is used to determine the authorization of the user having the authority. The logic model library is used to store SQL language. Common fixed SQL language templates are stored here, which facilitates the semantic conversion unit to generate corresponding SQL language by searching the logic model library.
[0058] The SQL query engine 300 executes the generated SQL language through the SQL language execution unit to perform corresponding data retrieval, selection, and query. The actions that can be performed by the SQL language execution unit are related to the functions that can be implemented by the SQL language. The present application does not make specific limitations here. For example, the SQL language execution unit can perform the following processes: the following are some examples of commonly used SQL statements for obtaining data from a database or data report library:
[0059] (1) Select the required data
[0060] Example 1: SELECT * FROM table name;
[0061] Example 2: SELECT column 1, column 2 FROM table name;
[0062] (2) Select records that meet the conditions:
[0063] Example: SELECT * FROM table name WHERE column name = 'a certain value';
[0064] (3) Sort records by conditions:
[0065] SELECT * FROM table name ORDER BY column name [ASC | DESC];
[0066] (4) Use wildcard for fuzzy query:
[0067] SELECT * FROM table_name WHERE column_name LIKE '%keyword%';
[0068] (5) Calculate the total number of records:
[0069] SELECT COUNT(*) AS total_records FROM table_name;
[0070] (6) Sum, average, maximum, and minimum:
[0071] SELECT SUM(column_name) AS total, AVG(column_name) AS average, MAX(column_name) AS maximum, MIN(column_name) AS minimum FROM table_name;
[0072] (7) Use subqueries:
[0073] SELECT column1 FROM table_name WHERE column2 IN (SELECT column2 FROM another_table);
[0074] (8) Join multiple tables:
[0075] SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column;
[0076] (9) Paginated query:
[0077] SELECT * FROM table_name LIMIT start_row, records_per_page;
[0078] In one application scenario, the report generated by the SQL language execution unit from the data report library is sent to the display module 500 for display.
[0079] In another application scenario, the SQL language execution unit obtains data from the database, which may involve data relationships in the relationship configuration library, metric calculations in the metric calculation library, and data permissions in the data permission library. Common SQL languages are stored in the logical model library. After the data is obtained through the SQL language, a report is generated. The generated report is a report corresponding to the natural language input by the user. The generated report is sent to the display module 500 for display.
[0080] The semantic analysis module 400 includes a semantic analysis unit for performing semantic analysis on the natural language input by the user, and a semantic conversion unit for converting the natural language input by the user into SQL language.
[0081] The display module includes an input unit, a screening unit, and a report display unit. The input unit is configured to receive a natural language input by a user. For example, the input unit receives a user input of "please generate a sales table of A product of A customer in 2023". The screening unit is configured to provide a screening box that can be manually selected by the user. For example, the screening box can screen objects including time, product, and data type, which are not limited herein. The generated report is displayed by the report display unit.
[0082] The data storage module 100, the semantic library 200, the SQL query engine 300, and the semantic analysis module 400 can be integrated in one system, and the display module 500 can be deployed on a terminal to realize human-computer interaction. The terminal device includes a personal computer, a smart phone, a wearable device, a palm processing device, a tablet computer, a mobile notebook, an augmented reality (AR) device, a virtual reality (VR) device, an integrated handheld game console, a wearable device, a vehicle-mounted device, a smart conference device, a smart advertising device, a smart home appliance, and the like. The smart home appliance can be a sweeping robot, a mopping robot, and the like, which are not limited herein.
[0083] The data query device provided in the application includes a semantic analysis module configured to perform semantic analysis on a natural language input by a user, a semantic conversion module configured to convert the natural language after semantic analysis into a structured query language (Structured Query Language, SQL), an SQL query engine configured to send a request for executing the SQL language to a data report library or a database according to the generated structured query language (SQL language), wherein the data report library includes one or more data reports, and the data reports are obtained according to a business logic relationship of data, a data storage module including the data report library and the database, and configured to return a query result, and a display module configured to display a data report matched with the natural language from the data report library or a data report formed by data in the database, wherein the data is returned from the database and matched with the natural language input by the user.
[0084] As a possible implementation manner, the database includes a source database, an aggregated database and an acceleration database, which are respectively used for storing and / or transmitting source data, aggregated data and acceleration data; the source data is original data, the source data includes IT fields, dimension fields and metric fields; the aggregated data includes IT fields, dimension fields and metric fields; the fields in the aggregated data are obtained from the fields in the source data; the aggregated data is obtained by performing metric calculation on the source data; wherein the metric calculation is a logical calculation according to a business logic relationship existing between data; the acceleration data is one or more of the aggregated data determined according to a click frequency of a user.
[0085] As a possible implementation manner, the semantic analysis module performs semantic analysis on the natural language input by the user to obtain a user intention.
[0086] The SQL query engine is configured to generate a corresponding SQL statement according to the user intention; the SQL query engine is configured to send the generated SQL query statement to a database system, execute a query operation corresponding to the SQL query statement, and obtain a query result; the query operation includes that the SQL query engine sends a data acquisition request to the database, and returns the query result by the database.
[0087] As a possible implementation manner, the permission module is configured to set different access permissions for the data and / or the data report according to different types of users; wherein the different users include different regions, different departments, different products and different customer types.
[0088] As a possible implementation manner, the acceleration data updating module is configured to update the acceleration data according to an access frequency of the dimension field and an access frequency of the metric field, including: judging whether the access frequency is greater than a threshold value; in a case where the access frequency of the dimension field or the metric field is greater than the threshold value, increasing an aggregated table corresponding to the dimension field or the metric field to be an acceleration table, the acceleration table having a quick access interface; in a case where the access frequency of the dimension field or the metric field is less than the threshold value, deleting the acceleration table having the dimension field or the metric field corresponding to the original acceleration table.
[0089] As a possible implementation manner, the semantic library includes a logical model library, a metric calculation library, a relationship configuration library and a data permission library.
[0090] The metric calculation library is configured to store and / or transmit a metric calculation rule, and to arrange source data into summary data according to the metric calculation rule; the relationship configuration library is configured to store data relationships; the logic model library is configured to store SQL query language; the data authority library is configured to store user authority information; the semantic conversion module is configured to generate SQL query language according to the metric calculation rule and / or the data relationships; and the SQL query engine is configured to execute a query operation corresponding to the SQL query language to obtain a query result.
[0091] In summary, the data query device provided in the present application converts natural language into SQL language to retrieve data and form a report, thereby improving the efficiency of data query.
[0092] The architecture of the data query system provided in the present application is described in detail above, and the flow steps of the data query method provided in the present application are described in detail below in combination with FIG. 2.
[0093] S210: Obtain a query request in natural language input by a user.
[0094] In a specific implementation, the user can input data to be queried in natural language in a query bar of a display interface, for example, "please generate an annual profit table of an enterprise".
[0095] Optionally, the query request carries user information, and different data query authorities are set according to the user information. For example, the query request carries ID information of the user, and the authority of data query is determined according to the ID information of the user. If the natural language input by the user is understood by semantic understanding and belongs to the authority range of the user query, subsequent steps are executed; if the natural language input by the user is understood by semantic understanding and does not belong to the authority range of the user ID corresponding to the query, the process is stopped.
[0096] Optionally, the access authorities of the user to the data and / or the data report are different according to different types of the user. Different users include different regions, different departments, different products, and different customer types. According to the access authority of the user, data or a data report accessible by the user is determined. For example, when the user belongs to a specific region, the access authority of the user belongs to the authority of the region where the user is located, and the user can access relevant data of the region.
[0097] When the user belongs to a specific department, the access authority of the user belongs to the authority of the department where the user is located, and the user can access relevant data of the department.
[0098] When the user manages a specific product, the access authority of the user belongs to the authority of the specific product, and the user can access relevant data of the specific product.
[0099] S220: According to the natural language input by the user, the natural language is semantically parsed.
[0100] S220 is performed by a semantic parsing module.
[0101] In a specific implementation, the natural language query of the user is converted into a structured representation. This can be a semantic parsing tree, a logical expression, a query graph, or other forms. NLU uses technologies such as morphological analysis, syntactic analysis, and semantic analysis to understand the user's intent and query requirements.
[0102] S230: According to the semantically parsed natural language, the semantically parsed natural language is converted to generate a structured query language (Structured Query Language).
[0103] In a specific implementation, the user's intent is understood according to the semantically parsed natural language, and a corresponding SQL statement is generated according to the user's intent. Generally, after the user is semantically parsed, the natural language is structured, converted into a structured representation, and then converted into a SQL query statement. In one application scenario, if the user inputs: "Display the names and addresses of all customers", the natural language query is converted into a SQL query similar to the following: SELECT name, address FROM customer table. In another application scenario, if the user inputs: "Sales in the past year", the rule engine can generate a SQL query similar to the following: SELECT SUM(sales) FROM sales table WHERE date >= DATEADD(YEAR, -1, GETDATE()). In some other application scenarios, the user's input can also be in the form of voice instead of text input. After the content of the voice input is semantically understood, a SQL statement is generated.
[0104] Optionally, when generating the corresponding SQL statement according to the user's intention, any one or more of template matching, rule engine, machine learning method can be used. Among them, template matching is a method based on predefined templates: create a set of SQL query templates, each template corresponds to a common query intention. For example, if the user asks "show all customer names and addresses", we can use the following template: SQL statement: SELECT name, address FROM customer table. Rule engine is to use a set of rules to match the user's query and generate the corresponding SQL statement. These rules can be based on syntax, vocabulary, context, etc. For example, if the user mentions "sales in the past year", the rule engine can generate a SQL query similar to the following: SQL SELECT SUM (sales) FROM sales table WHERE date >= DATEADD (YEAR, -1, GETDATE ()). Machine learning method is to use machine learning model to understand the user's query intention and generate the corresponding SQL statement.
[0105] It should be understood that generating SQL statements according to user's intention can realize natural language to SQL language conversion, so that users can directly obtain customized data reports according to natural language input, without the need for manual selection to generate the data required by the user, improving the efficiency of data query.
[0106] S240: According to the generated structured query language (SQL language), send a request to execute the data acquisition corresponding to the SQL language to the data report library or database; wherein the data report library includes one or more data reports, and the data report is obtained according to the business logic relationship of the data.
[0107] S240 is executed by the SQL query engine.
[0108] In a specific implementation, the SQL query statement is generated and sent to the database system, the query operation corresponding to the SQL query statement is executed, and the query result is obtained; the query operation includes that the SQL query engine sends a data acquisition request to the database, and returns the query result from the database.
[0109] Since the data acquisition request is sent to the database or the data report library, in some embodiments, the data acquisition request carries the user's permission information in the process of sending the data acquisition request to the database through the SQL statement (or SQL language), and the user's permission is judged by the database management system (DBMS) according to the user's ID stored in the data permission library in the semantic library, combined with the authorization rule. For example, the permission information of mysql.user is stored in the data permission library, and the permission information of user_1 is carried in the data acquisition request. It is judged by the authorization rule whether the user has the permission to acquire data. If yes, the data acquisition request is executed, and the database returns the result. If not, no result is returned.
[0110] In some other embodiments, the data acquisition request carries the user's permission information in the process of sending the data acquisition request to the data report library through the SQL statement (or SQL language), and the user's permission is judged by the database management system (DBMS) according to the user's ID stored in the data permission library in the semantic library, combined with the authorization rule. For example, the permission information of mysql. is stored in the data permission library, and the permission information of user_1 is carried in the data acquisition request. It is judged by the authorization rule whether the user has the permission to acquire data. If yes, the data acquisition request is executed, and the data report library returns the result. If not, no result is returned.
[0111] Optionally, the data report library includes one or more existing data reports, for example, the data report library stores a profit table, a cost table, and a 2023 operating data table.
[0112] Optionally, the data report is obtained according to a data metric calculation rule and / or data relationship. The metric calculation rule and / or data relationship are stored in the semantic library.
[0113] Optionally, the semantic library includes a logic model library, a metric calculation library, a relationship configuration library, and a data authority library. The metric calculation library is configured to store and / or transmit metric calculation rules. According to the metric calculation rules, source data is processed into summary data. For example, gross profit margin = revenue - cost is a metric calculation rule. The relationship configuration module is configured to store data relationships. A data relationship refers to the relationship between sales in a profit table and sales in a revenue table, which is a mapping relationship and can be understood as an equivalence relationship. The logic model library is configured to store SQL query languages. For example, a 2023 sales revenue table is known, and a 2023 sales profit table is to be generated. The process includes: first, according to the data relationship in the relationship configuration module, the sales data in the 2023 sales revenue table is mapped to the 2023 sales profit table according to the data relationship to form the sales revenue column in the sales profit table. At this time, sales cost data is also needed, so the 2023 sales cost table is obtained from the database, and the sales cost data is extracted from the 2023 sales cost table according to the data relationship. Finally, according to the metric calculation rule: gross profit margin = revenue - cost, the sales revenue is subtracted by the sales cost to obtain the profit, and finally the 2023 profit table is formed. The above process can be executed through SQL language, and the SQL language used to execute the above process can be fixed as a kind of SQL logic model structure and stored in the logic model library. The above process is only an example, which is not limited in the present application.
[0114] It should be understood that the above process utilizes the logic model library, the metric calculation library, the relationship configuration library, and the data authority library in the semantic library, and calls the data in the semantic library and the data in the database and the data report library through the SQL language, thereby realizing effective data query and management.
[0115] As a possible implementation, the natural language after semantic analysis is converted into SQL language, and when sending a request to execute the SQL language to a data reporting library or a database, in some embodiments, the data in the database needs to complete the metric calculation and relationship configuration of the data in the semantic library. Among them, the metric calculation refers to obtaining the summary data by performing metric calculation on the source data in the database; the metric calculation includes data conversion, logical operation according to business relationships, for example, the source data includes income data and cost data, and the profit data (or profit table) is obtained by performing metric calculation, that is, the summary data. That is, according to the source data in the database and the metric calculation in the semantic library, the source data in the database is determined. The above process can be realized by SQL language. For example, by selecting the source data "income table" and "cost table" in the database through the SQL language, calling the metric calculation in the semantic library, and obtaining the "profit table". The relationship configuration refers to the data relationship, which includes Chinese-English contrast relationship and mapping relationship, which is not limited in the present application. The Chinese-English contrast relationship can realize the Chinese-English conversion of the data in the database, for example, the ID of the profit table in the database is the ID expressed in English defined by IT, and the English ID can be converted into Chinese name through relationship configuration, which is convenient for business personnel to understand and view.
[0116] Optionally, the database includes any one or more of source data, summary data and acceleration data; the source data is original data, the source data includes IT field, dimension field and metric field; the summary data includes IT field, dimension field and metric field; the fields in the summary data are obtained from the fields in the source data;
[0117] Optionally, the IT field in the summary data includes one or more of last update date, version, scene, theme and scheduling type.
[0118] Optionally, the dimension field in the summary data includes basic field and extended field; the basic field in the dimension field includes one or more of accounting period, report item, report source, regional responsibility center and expense responsibility center; the basic field is a fixed field in the data, and the extended field is an additional field added according to specific business needs.
[0119] Optionally, the metric field in the summary data includes basic field and extended field, wherein the basic field of the metric field in the summary data includes current year actual RMB exchange rate, this year cumulative RMB actual exchange rate, last year same period year cumulative RMB actual exchange rate, and the like, which are not listed here, and the present application is not limited.
[0120] Optionally, the metric field of the summary data includes 18 basic fields and 20 extended fields.
[0121] Optionally, the IT field of the source data includes one or more of last update date, version, scenario, theme, and scheduling type.
[0122] Optionally, the dimension field of the source data includes a basic field and an extended field, wherein the basic field includes accounting period, report item, report measure, regional responsibility center, customer, main product, auxiliary product, group account code, sub-account code, department, expense responsibility center, and sales mode.
[0123] Optionally, the measure field of the source data includes six basic fields and twenty extended fields, for example, the measure field of the source data includes basic fields and extended fields, the basic fields include dollar actual exchange rate current period occurrence, dollar budget exchange rate current period occurrence, RMB actual exchange rate current period occurrence, RMB budget exchange rate current period occurrence, transaction currency current period occurrence, and base currency current period occurrence.
[0124] Optionally, the accelerated data refers to data whose access frequency of the dimension field and / or the measure field of the aggregated data or the source data is greater than or equal to a threshold value. The accelerated data has a separate data repository, for example, in a cache.
[0125] It should be understood that the accelerated data is data frequently accessed by users, and setting the accelerated data is meaningful to improve the viewing efficiency of data frequently accessed or queried by users.
[0126] Optionally, the accelerated data is updated according to the access frequency of the dimension field and the access frequency of the measure field, and the process includes: judging whether the access frequency is greater than a threshold value, in the case that the access frequency of the dimension field or the measure field is greater than the threshold value, adding the aggregated table corresponding to the dimension field or the measure field to an accelerated table, the accelerated table has a quick access interface; in the case that the access frequency of the dimension field or the measure field is less than the threshold value, deleting the accelerated table having the dimension field or the measure field corresponding to the original accelerated table. In another application scenario, the accelerated data is also determined according to the access frequency of the data report in the data report library. For example, the data report with an access frequency higher than a threshold value is set as an accelerated data table. The setting method of the threshold value includes: first, calculating the mean value of the access frequency of various data tables, and setting the threshold value according to the mean value of the access frequency. For example, the mean value of the access frequency of various data tables is 10 times / day, and the threshold value of the threshold value can be set to 15 times / day. The present application is not limited herein.
[0127] It should be understood that updating the accelerated data helps to follow up the frequently accessed data needs of users in real time.
[0128] S250: display the data report returned from the data report library that matches the natural language; or, display the data report formed by the data in the database that matches the natural language input by the user.
[0129] S250 includes two cases, the first case is that according to the parsed natural language, the data report that the user needs to query already exists in the data report library, then the data report that matches the natural language is directly called from the data report library. This process includes: sending a data report acquisition request, the judgment module judges whether the data report exists in the data report library, if it exists, the data report library returns the data report that matches the natural language, and the display module is displayed.
[0130] The second case is that according to the parsed natural language, the data report that the user needs to query does not exist in the data report library, then the data report that the user wants to acquire involves the data in the field, after the data report is generated, it is displayed to the user. For example, the user inputs "query 2023 profit table", there is no 2023 profit table in the data report library, the fields needed to generate the profit table include 2023 income data and 2023 cost data, therefore, the acquisition request of "2023 income data" and "2023 cost data" is sent to the database, the database returns the above data, which is filled into the profit table, the generation and query of the profit table are completed, and the user is displayed.
[0131] The data query method and device provided by the application are described in detail above, and the computing device provided by the application is explained and described below in combination with FIGS. 3, 4 and 5.
[0132] FIG. 3 is a structural schematic diagram of a computing device provided by the application, as shown in FIG. 3, the application further provides a chip system, which includes a processor and a power supply circuit, the power supply circuit is used for performing power supply to the processor, and the processor is used for executing the corresponding process of realizing each method in FIG. 2. For the sake of brevity, it will not be repeated here. Among them, the processor can be realized by GPU, and can also be realized by DPU, NPU, XPU, SoC, offload card, acceleration card and other computing devices.
[0133] The application further provides a computing device 10. As shown in FIG. 3, the computing device 10 includes a bus 102, a processor 104, a memory 106 and a communication interface 108. The processor 104, the memory 106 and the communication interface 108 communicate through the bus 102. The computing device 10 can be a server or a terminal device. It should be understood that the number of processors and memories in the computing device 10 is not limited by the application.
[0134] Bus 102 can be a peripheral component interconnect Express (PCIe) bus or an extended industry standard architecture (EISA) bus, a unified bus (UBus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), or the like. The unified bus can also be referred to as a coherent bus. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one line is shown in FIG. 3, but it does not mean that there is only one bus or only one type of bus. Bus 104 can include a path for transmitting information between various components of computing device 10 (e.g., memory 106, processor 104, communication interface 108). The unified bus can also be referred to as a coherent bus.
[0135] Processor 104 can include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP), an ASIC, a FPGA, a CPLD, an NPU, a SoC, an offload card, an acceleration card, or the like computing device.
[0136] Memory 106 can include volatile memory, such as random access memory (RAM). Processor 104 can also include non-volatile memory, such as read-only memory (ROM), a floppy disk, a compact disk, an optical disk, a hard disk, or the like. Additionally, memory 106 can be implemented using a storage class memory (SCM), a phase change memory (PCM), or other types of storage media.
[0137] It is worth mentioning that the same type of storage medium can be configured in the same computing device to implement the memory 106 function, and two or more types of storage media can also be configured to implement the memory 106 function, and the present application does not limit this.
[0138] The memory 106 stores executable program code, and the processor 104 executes the executable program code to respectively implement the functions of the aforementioned various modules, thereby implementing the corresponding flows of the various methods in FIG. 2. That is, the memory 106 has instructions for executing the corresponding flow methods of the various methods in FIG. 2.
[0139] The communication interface 103 uses a transceiving module such as but not limited to a network interface card and a transceiver to implement communication between the computing device 10 and other devices or communication networks.
[0140] As a possible implementation manner, the computing device 10 can also include a chip system including a processor and a power supply circuit for performing power supply to the processor, and the processor is used to perform the operation steps corresponding to the corresponding flow methods of the various methods in FIG. 2. For the sake of brevity, it will not be repeated here. Among them, the processor can be implemented by GPU, and can also be implemented by DPU, NPU, XPU, SoC, offload card, acceleration card and other computing devices or AI chips.
[0141] As a possible implementation manner, the computing device 10 can include multiple types of processors 104, that is, the computing device 10 is a heterogeneous device, for example, the computing device 10 includes CPU and GPU, and at least one of the processors 104 in the computing device 10 can perform the operation steps corresponding to the corresponding flow methods of the various methods in FIG. 2. For the sake of brevity, it will not be repeated here.
[0142] FIG. 4 is an example diagram of a computing device cluster provided by the present application, as shown in FIG. 4, the present application also provides a computing device cluster. The computing device cluster includes at least one computing device 10 as shown in FIG. 3. The computing device can be a server, for example, a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a notebook computer, or a smart phone.
[0143] The computing device cluster includes at least one computing device 10. The memory 106 in one or more computing devices 10 in the computing device cluster can store the same instructions for implementing the corresponding flows of the methods as shown in FIG. 2.
[0144] In some possible implementation, the memory 106 of one or more of the computing devices 10 in the computing device cluster can also respectively store partial instructions for implementing the respective procedures of the method shown in FIG. 2. In other words, the combination of the one or more computing devices 10 can collectively execute the instructions for implementing the respective procedures of the method shown in FIG. 2.
[0145] FIG. 5 is another example diagram of a computing device cluster provided by the present application. As shown in FIG. 5, in some possible implementation, one or more of the computing devices in the computing device cluster can be connected through a network. The network can be a wide area network, a local area network, or the like.
[0146] It should be noted that the memory 106 in different computing devices 10 in the computing device cluster can store different instructions, respectively for implementing partial functions of the apparatus shown in FIG. 2. That is, the instructions stored in the memory 106 in different computing devices 10 can implement the functions of one or more modules in the apparatus shown in FIG. 2.
[0147] The present application also provides a computer readable storage medium. The computer readable storage medium can be any available medium or data storage device that can be accessed by a computing device, or a data center containing one or more available media, or the like. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk), or the like. The computer readable storage medium includes instructions that instruct a computing device to execute a data processing method, or instruct a computing device to execute a data processing method.
[0148] The present application also provides a computer program product containing instructions. The computer program product can be a software or a program product containing instructions, which can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device is caused to execute a data processing method.
[0149] The above-described embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, the above-described embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are wholly or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. containing one or more available medium sets. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid state disk (SSD).
[0150] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. A data query method applied to a presentation layer, the method comprising: performing semantic analysis on natural language input by a user; converting the natural language after semantic analysis into a structured query language (SQL) ; sending a request for execution of the SQL to a data report library or a database according to the generated SQL, wherein the database comprises any one or more of source data, summary data, and accelerated data, and the data report library comprises one or more data reports obtained according to a business logic relationship of the data. 2.The data query method of claim 1, wherein: the source data comprises IT fields, dimension fields, and metric fields; and the summary data comprises IT fields, dimension fields, and metric fields, and the fields in the summary data are obtained from the fields in the source data. 3.The data query method of claim 2, wherein: the summary data is obtained by performing metric calculation on the source data, wherein the metric calculation is performed according to a metric calculation rule stored in a metric calculation library in a semantic library, and the metric calculation rule is used to indicate a logical relationship between the data; and the accelerated data is determined according to an access frequency of the dimension fields in the summary data and / or an access frequency of the metric fields in the summary data. 4.The data query method of claim 1, wherein: the conversion of the natural language after semantic analysis into the SQL comprises: performing semantic analysis on the natural language input by the user to obtain a user intent; and generating an SQL query statement according to the user intent, wherein the SQL query statement is constructed according to a metric calculation rule stored in a metric calculation library in a semantic library and a data relationship stored in a relationship configuration library in the semantic library. 5.The data query method of claim 1, wherein: the sending of the request for execution of the SQL to the data report library or the database comprises: sending an SQL execution request to the data report library or the database according to the generated SQL query statement, wherein the SQL execution request comprises a query operation corresponding to the SQL query statement, and the query operation comprises sending a data acquisition request to the database by an SQL query engine, wherein the data acquisition request comprises a data type and a field type, and the data type comprises any one or more of the source data, the summary data, and the accelerated data, and the field type comprises any one or more of the IT fields, the dimension fields, and the metric fields. 5. The data query method of claim 1, wherein: 6. The data query method of claim 1, wherein: different types of users have different access permissions to the data and / or the data reports; and wherein the different types of users include any one or more of different regions, different departments, different products, and different customer types.
7. The data query method of claim 1, wherein: the accelerated data is determined according to an access frequency of a dimension field in the summary data and an access frequency of a metric field in the summary data, including: determining whether the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than a threshold value, in a case where the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than a first threshold value, creating the dimension field in the summary data or the metric field in the summary data into the accelerated data, the accelerated data including accelerated reports that are obtained through a quick access interface.
8. The data query method of claim 7, wherein: in a case where the access frequency of the dimension field in the accelerated data or the access frequency of the metric field in the accelerated data is less than a second threshold value, deleting the accelerated data corresponding to the dimension field in the accelerated data or the metric field in the accelerated data, the accelerated data including the accelerated reports.
9. A data query apparatus, comprising: a semantic analysis module configured to perform semantic analysis on natural language input by a user; a semantic conversion module configured to convert the natural language after semantic analysis into a structured query language (SQL); an SQL query engine configured to send a request to execute the SQL language to a data report library or a database according to the generated structured query language; wherein the database includes any one or more of source data, summary data, and accelerated data; and wherein the data report library includes one or more data reports, the data reports being obtained according to a business logic relationship of the data; a display module configured to display data reports matching the natural language input by the user returned from the data report library; or the display module is configured to display data reports formed by data from the database, the data being returned from the database and matching the natural language input by the user.
10. The data query apparatus of claim 9, wherein: the database includes a source database, a summary database, and an accelerated database, and is configured to store and / or transmit source data, summary data, and accelerated data, respectively; the source data includes IT fields, dimension fields, and metric fields; the summary data includes IT fields, dimension fields, and metric fields; and the fields in the summary data are obtained from the fields in the source data.
11. The data query apparatus of claim 9, wherein: the semantic analysis module is configured to perform semantic analysis on the natural language input by the user to obtain a user intent. The SQL query engine is configured to generate an SQL query statement according to the intention of the user, wherein the SQL query statement is constructed according to a metric calculation rule and a data relationship, the metric calculation rule is stored in a metric calculation library of a semantic library, and the data relationship is stored in a relationship configuration library in the semantic library. The SQL query engine is configured to execute a query operation corresponding to the generated SQL query statement, wherein the query operation includes that the SQL query engine sends a data acquisition request to a database, and the data acquisition request includes a data type and a field type; the data type includes any one or more of source data, summary data, and acceleration data, and the field type includes any one or more of an IT field, a dimension field, and a metric field. The SQL query engine is configured to obtain a query result, wherein the query result is returned by the database.
12. The data query apparatus of claim 9, wherein: The permission module is configured to provide different access permissions for different types of users to the data and / or the data report, wherein the different types of users include any one or more of different regions, different departments, different products, and different customer types.
13. The data query apparatus of claim 9, wherein: The acceleration data updating module is configured to determine acceleration data according to an access frequency of a dimension field in summary data and an access frequency of a metric field in the summary data, including: determining whether the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than a threshold value, and in a case where the access frequency of the dimension field in the summary data or the access frequency of the metric field in the summary data is greater than the threshold value, creating the dimension field in the summary data or the metric field in the summary data into the acceleration data, wherein the acceleration data includes an acceleration report, and the acceleration report is obtained through a quick access interface.
14. The data query apparatus of claim 9, wherein: The acceleration data updating module is configured to delete acceleration data corresponding to a dimension field in the acceleration data or a metric field in the acceleration data in a case where an access frequency of the dimension field in the acceleration data or an access frequency of the metric field in the acceleration data is less than a threshold value, wherein the acceleration data includes an acceleration report.
15. The data query apparatus of claim 9, wherein: The generated SQL query statement is sent to a database system, a query operation corresponding to the SQL query statement is executed, and a query result is obtained, including: The semantic library includes a logical model library, a metric calculation library, a relationship configuration library, and a data permission library; The metric calculation library is configured to store and / or transmit a metric calculation rule, and the metric calculation rule is used to arrange source data into summary data; the relationship configuration library is configured to store a data relationship; the logical model library is configured to store an SQL query language; and the data permission library is configured to store permission information of a user. The semantic conversion module is configured to generate an SQL query language according to the metric calculation rule and / or the data relationship. The semantic conversion module is configured to generate an SQL query language according to the metric calculation rule and / or the data relationship. The SQL query engine is configured to execute a query operation corresponding to an SQL query statement and obtain a query result.
16. A chip system, characterized by The chip system comprises a processor and a power supply circuit, the power supply circuit is used for supplying power to the processor, and the processor is used for executing the operation steps of the method in any one of claims 1 to 8.
17. A computing device, other features being that the computing device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the computing device to execute the operation steps of the method in any one of claims 1 to 8.
18. A cluster of computing devices, characterized in that, The one or more computing devices comprise a processor and a memory; The processor of the one or more computing devices is configured to execute instructions stored in the memory of the one or more computing devices to cause the computing device cluster to execute the operation steps of the method in any one of claims 1 to 8.
19. A computer program product comprising instructions, characterized in that, When the instructions are executed by the computing device cluster, the computing device cluster executes the operation steps of the method in any one of claims 1 to 8.
20. A computer-readable storage medium, characterized in that, The computer program instructions comprise a computer program product, when the computer program instructions are executed by the computing device cluster, the computing device cluster executes the operation steps of the method in any one of claims 1 to 8.
Citation Information
Patent Citations
Data processing method and device, equipment and storage medium
CN114328603A
Adaptive rule-guided large language model generation SQL (Structured Query Language) system
CN117131070A
Report generation method and device, electronic equipment and storage medium
CN117593410A
Production operation data analysis method and system, storage medium and electronic equipment
CN117633158A
Systems and methods for facilitating database queries
US20240394251A1
Cited By
Visual report display method and system and electronic equipment
CN121681635A
Report number asking method and device based on PLM dimension index self-sensing and multi-layer alignment
CN121786090A
Data query method and system based on ontology semantic data network and ABC normal form
CN122173689A