Data query result determination method and device, storage medium and electronic device
By responding to interactive interface commands in the data management system to query the database topic list and generate query statements, the problem of insufficient data query accuracy is solved, and efficient and flexible data query and analysis are achieved.
Patent Information
- Application Number
- CN202510854357.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-11-11
AI Technical Summary
Existing data management systems suffer from insufficient accuracy in querying data, resulting in low efficiency in determining data query results. They also rely on the domain knowledge of developers and are susceptible to errors due to human intervention.
By responding to interactive interface commands to query the database topic list, obtain dimension configuration data and indicator data, generate and execute database query statements, including syntax checking and pre-execution operations, to ensure the accuracy and efficiency of the query statements.
It enables autonomous querying and filtering of data topics in the database, improving the flexibility and accuracy of data querying, reducing human intervention errors, and increasing the efficiency of determining data query results.
Smart Images

Figure CN120929474A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to a method, apparatus, storage medium, and electronic device for determining data query results. Background Technology
[0002] With the rapid development of the information age, the speed and volume of data generation have exploded, covering everything from financial statements and customer interaction records to production process monitoring. This data deluge not only brings unprecedented opportunities for business insights and decision support, but also places higher demands on data management capabilities.
[0003] Current data management systems often add new data metrics to address changing business needs. However, this process requires specialized personnel, which frequently leads to inefficiencies due to a shortage of qualified professionals. Furthermore, each new metric or dimension requires developers to not only write complex queries or design data processing frameworks (such as Hadoop and Spark) to manually create or modify data, but also to configure task scheduling for periodic or on-demand data updates. This time-consuming process, reliant on developers' domain knowledge, not only extends the development cycle but also increases the probability of errors due to human intervention, impacting data quality and consequently affecting the accuracy of subsequent user queries. Therefore, existing data management systems suffer from deficiencies in data query accuracy, resulting in inefficient determination of query results.
[0004] Therefore, in related technologies, there is a technical problem that insufficient accuracy of the queried data leads to low efficiency in determining the data query results.
[0005] There is currently no effective solution to the technical problem of low efficiency in determining data query results due to insufficient accuracy of query data in related technologies. Summary of the Invention
[0006] This application provides a method, apparatus, storage medium, and electronic device for determining data query results, in order to at least solve the technical problem in the related art where insufficient accuracy of query data leads to low efficiency in determining data query results.
[0007] According to one embodiment of this application, a method for determining data query results is provided, comprising: responding to a first query instruction sent by a target object through an interactive interface, querying a list of topics from a database and sending the list of topics to the target object, wherein the list of topics includes at least data topics supported by a data management system; obtaining dimension configuration data and indicator data of the data topics from the database according to a second query instruction; obtaining filtering results for the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data; generating a database query statement based on the target dimension configuration data and the target indicator data; executing the database query statement to obtain the data query result corresponding to the database query statement.
[0008] In one exemplary embodiment, the database stores at least a topic configuration table. In response to a first query instruction sent by a target object through an interactive interface, the database is queried to retrieve a topic list, including: obtaining different topic numbers and topic data of the different topic numbers from the topic configuration table according to the first query instruction; determining target topic data that supports autonomous analysis from the topic data of the different topic numbers, and determining the target topic number corresponding to the target topic data; and generating the topic list according to the data topic indicated by the target topic.
[0009] In one exemplary embodiment, determining target topic data that supports autonomous analysis from topic data with different topic numbers, and determining the target topic number corresponding to the target topic data, includes: traversing the different topic numbers, and for the current topic number that is traversed, determining the analysis capability identifier corresponding to the current topic number from the topic description of the current topic number; if it is determined that the analysis capability identifier indicates that the current topic number supports autonomous analysis, determining the current topic number as the target topic number, and determining the topic data of the current topic number as the target topic data.
[0010] In one exemplary embodiment, determining target topic data that supports autonomous analysis from topic data with different topic numbers, and determining the target topic number corresponding to the target topic data, includes: traversing the different topic numbers, determining the topic name corresponding to the current topic number from the topic description of the current topic number for the current topic number traversed; if it is determined that the topic name belongs to a topic name that supports autonomous analysis, determining the current topic number as the target topic number, and determining the topic data of the current topic number as the target topic data.
[0011] In an exemplary embodiment, the database further stores a topic event dimension configuration table and a topic event support metric table. Obtaining the dimension configuration data and metric data of the data topic from the database according to a second query instruction sent by the target object includes: obtaining dimension configuration data of different data topics from the topic event dimension configuration table according to a data number list included in the second query instruction, wherein the data number list includes data numbers of all data topics; and obtaining metric data of different data topics from the topic event support metric table according to the data number list.
[0012] In an exemplary embodiment, before executing the database query statement and obtaining the data query result, the method further includes: performing a syntax check on the database query statement according to database language rules to obtain a first check result, wherein the syntax check includes at least one of the following: keyword check, syntax structure check, and spelling error check; performing a field check on the database query statement according to database field rules to obtain a second check result; and performing a parameter type check on the database query statement according to database parameter definition rules to obtain a third check result; and if the first check result, the second check result, and the third check result all indicate that the database query statement has passed the check, performing a pre-execution operation on the database query statement to obtain a pre-execution result.
[0013] In an exemplary embodiment, generating a database query statement based on the target dimension configuration data and the target indicator data includes: determining dimension values from the target dimension configuration data and determining indicator values from the target indicator data; setting the dimension values and indicator values as query fields, generating a Structured Query Language (SQL) statement based on the query fields, and adding sorting and grouping statements to the SQL statement to obtain the database query statement.
[0014] In an exemplary embodiment, obtaining the filtering results of the dimension configuration data and the indicator data includes: obtaining a first filtering field and a second filtering field selected by the target object from the preset filtering fields corresponding to the data topic; using the first filtering field to filter the dimension configuration data of the data topic to obtain the target dimension configuration data; and using the second filtering field to filter the indicator data of the data topic to obtain the target indicator data.
[0015] In an exemplary embodiment, generating a database query statement based on the target dimension configuration data and the target indicator data includes: determining dimension values from the target dimension configuration data and indicator values from the target indicator data; determining a target topic event based on the target dimension configuration data and the target indicator data; setting the dimension values and the indicator values as query fields; generating a Structured Query Language (SQL) statement based on the query fields, the target topic event, the first filter field, and the second filter field; and adding sorting and grouping statements to the SQL statement to obtain the database query statement.
[0016] According to another aspect of the embodiments of this application, a data query result determination device is also provided, comprising: a query module, configured to, in response to a first query instruction sent by a target object through an interactive interface, query a list of topics from a database and send the list of topics to the target object, wherein the list of topics includes at least data topics supported by a data management system; an acquisition module, configured to, according to a second query instruction, acquire dimension configuration data and indicator data of the data topics from the database; and a generation module, configured to, acquire filtering results of the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query result corresponding to the database query statement.
[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described method for determining the data query results when it is run.
[0018] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described method for determining the data query result through the computer program.
[0019] In this embodiment, in response to a first query command sent by a target object through an interactive interface, a list of topics is retrieved from the database and sent to the target object. The topic list includes at least data topics supported by the data management system. According to a second query command, dimensional configuration data and indicator data of the data topics are retrieved from the database. A filtering result is obtained from the dimensional configuration data and indicator data, including target dimensional configuration data and target indicator data. A database query statement is generated based on the target dimensional configuration data and target indicator data, and the database query statement is executed to obtain the corresponding data query result. This application enables autonomous querying and filtering of data topics in the database, improving the flexibility and efficiency of data querying. By generating and executing database query statements, the data query results required by the target object can be obtained quickly and accurately. The above technical solution solves the technical problem of low efficiency in determining data query results due to insufficient accuracy of the queried data. This method not only improves the efficiency and accuracy of data querying but also enhances the flexibility of data querying, thereby improving the efficiency of determining data query results. It is suitable for application scenarios requiring extensive data analysis and decision-making. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of the hardware environment for a method of determining data query results according to an embodiment of this application;
[0023] Figure 2 This is a flowchart of a method for determining data query results according to an embodiment of this application;
[0024] Figure 3 This is a flowchart illustrating a method for determining data query results according to an embodiment of this application.
[0025] Figure 4 This is a schematic diagram of the underlying logic between different data tables according to embodiments of this application;
[0026] Figure 5 This is a schematic diagram of the self-analysis details table according to an embodiment of this application;
[0027] Figure 6 This is a schematic diagram of a topic event dimension configuration table according to an embodiment of this application;
[0028] Figure 7 This is a schematic diagram of a topic event support index table according to an embodiment of this application;
[0029] Figure 8 This is a structural block diagram of a data query result determination device according to an embodiment of this application. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] According to one aspect of the embodiments of this application, a method for determining data query results is provided. This method for determining data query results is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, smart home device ecosystems, and smart house ecosystems. Optionally, in this embodiment, the above-mentioned method for determining data query results can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.
[0033] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.
[0034] This embodiment provides a method for determining data query results, applied to the aforementioned data management system. Figure 2 This is a flowchart of a method for determining data query results according to an embodiment of this application. The process includes the following steps:
[0035] Step S202: In response to the first query command sent by the target object through the interactive interface, a topic list is retrieved from the database and sent to the target object, wherein the topic list includes at least data topics supported by the data management system;
[0036] The data topics supported by the aforementioned data management systems are all data topics that support independent analysis.
[0037] Optionally, the interactive interface may include modules such as business themes, dimensions, metrics, business metrics, and business drill-down. The business theme module displays a list of business themes that support analysis (i.e., the theme list mentioned above). Users can select one or more data themes from the list to perform data analysis on the selected themes. The dimension module displays a list of dimensions under the business theme. Users can select one or more dimensions from the list and drag them into the dimension configuration area to configure the dimension information. The metric module displays a list of metrics under the business theme. Users can select one or more metrics from the list and drag them into the metric configuration area to configure the metric information.
[0038] Optionally, dimensions are used to describe the attributes or categories of entities in a dataset, facilitating viewing the data from different perspectives. For example, in sales data, "region," "time," "product category," and "sales channel" can all be considered dimensions. Configuring dimension information involves how to use these dimensions in data analysis. For instance, a user might want to view sales figures by region; in this case, they would need to select the "region" dimension in the analysis tool and drag it into the "Dimension Configuration Area."
[0039] Optionally, metrics refer to data points used to quantify and analyze a specific dimension or business theme. The numerical value of a metric reflects a certain state or performance of the business. In sales data, some common metrics include: sales revenue (the total amount of money spent on goods sold within a certain period); sales quantity (the total number of goods sold within a certain period); average unit price (the average price obtained by dividing total sales revenue by sales quantity); profit (sales revenue after deducting costs); and customer satisfaction rating. Configuring metric information involves selecting and defining specific metrics for analysis. For example, if a user wants to understand the sales performance of a product in different regions, they might select "sales revenue" as the metric and drag it into the "metric configuration area."
[0040] Furthermore, the business metrics module displays the configured dimensions and metrics. Dimensions and metrics can be combined to form business metrics, and a single dimension can be configured with multiple metrics, and a single metric can be configured with multiple dimensions. This allows users to filter the most suitable data configuration items from multiple dimension configurations and metric data during data analysis, ensuring that the data query results meet user needs and thus achieving the purpose of data analysis.
[0041] It is evident that by providing an interactive interface, a user-friendly interactive method is offered for real-time dynamic data analysis, thereby improving data processing efficiency.
[0042] Step S204: Obtain the dimension configuration data of the data topic and the indicator data of the data topic from the database according to the second query instruction;
[0043] Step S206: Obtain the filtering results of the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query results corresponding to the database query statement.
[0044] Through the above steps, in response to a first query command sent by the target object through the interactive interface, a list of topics is retrieved from the database and sent to the target object. The list of topics includes at least data topics supported by the data management system. Based on a second query command, dimensional configuration data and indicator data of the data topics are retrieved from the database. Filtering results of the dimensional configuration data and indicator data are obtained, including target dimensional configuration data and target indicator data. A database query statement is generated based on the target dimensional configuration data and target indicator data, and the database query statement is executed to obtain the corresponding data query results. This application enables autonomous querying and filtering of data topics in the database, improving the flexibility and efficiency of data querying. By generating and executing database query statements, the data query results required by the target object can be obtained quickly and accurately. The above technical solution solves the technical problem of low efficiency in determining data query results due to insufficient accuracy of the queried data. This method not only improves the efficiency and accuracy of data querying but also enhances the flexibility of data querying, thereby improving the efficiency of determining data query results. It is suitable for application scenarios requiring extensive data analysis and decision-making.
[0045] In one exemplary embodiment, the database stores at least a topic configuration table. In response to a first query command sent by a target object via an interactive interface, retrieving a topic list from the database involves the following process: obtaining different topic numbers and topic data for each topic number from the topic configuration table according to the first query command; identifying target topic data that supports independent analysis from the topic data with different topic numbers, and determining the target topic number corresponding to the target topic data; and generating the topic list based on the data topic indicated by the target topic. In this way, the system can automatically identify and provide topics that can be analyzed independently, avoiding blind selection by users during queries, improving the targeting and efficiency of queries, and is suitable for scenarios requiring rapid acquisition of specific topic data, such as market trend analysis and product performance evaluation.
[0046] Optionally, the topic configuration table can also be bound to the user configuration table based on the topic number, so that the data query results can be sent to the users in the user configuration table.
[0047] In one exemplary embodiment, a further technical solution is proposed for determining target topic data supporting autonomous analysis from topic data with different topic numbers, and determining the target topic number corresponding to the target topic data. This includes: traversing the different topic numbers; for the current topic number encountered, determining the analysis capability identifier corresponding to the current topic number from its topic description; if the analysis capability identifier indicates that the current topic number supports autonomous analysis, determining the current topic number as the target topic number, and determining the topic data of the current topic number as the target topic data. This meticulous filtering mechanism ensures that users can obtain data that truly supports autonomous analysis, avoids invalid operations during data querying, and is suitable for scenarios such as deep data mining and analysis.
[0048] In an exemplary embodiment, the process of determining target topic data that supports autonomous analysis from topic data with different topic numbers, and determining the target topic number corresponding to the target topic data, may further include: traversing the different topic numbers; for the current topic number encountered, determining the topic name corresponding to the current topic number from the topic description of the current topic number; if it is determined that the topic name belongs to a topic name that supports autonomous analysis, determining the current topic number as the target topic number, and determining the topic data of the current topic number as the target topic data. By filtering by topic name, users can more intuitively identify the required data topic, improving the user-friendliness of data queries and making it suitable for scenarios where non-professionals perform daily data queries and analysis.
[0049] In an exemplary embodiment, the database further stores a topic event dimension configuration table and a topic event support metric table. The process of retrieving the dimension configuration data and metric data of the data topic from the database according to the second query instruction sent by the target object may include: retrieving dimension configuration data for different data topics from the topic event dimension configuration table based on a data number list included in the second query instruction sent by the target object, wherein the data number list includes data numbers for all data topics; and retrieving metric data for the different data topics from the topic event support metric table based on the data number list. This data retrieval method ensures that the system quickly and accurately obtains the data dimensions and metrics required by the user, improving the accuracy and efficiency of data queries, and is suitable for scenarios requiring multi-dimensional, multi-metric data queries and analysis.
[0050] Among them, the above-mentioned dimension configuration data and the indicator data of all data topics have corresponding topic numbers, that is, the same topic number has both dimension configuration data and indicator data.
[0051] In an exemplary embodiment, before executing the database query statement and obtaining the data query result, a pre-execution process for the database query statement is further proposed. This process specifically includes: performing a syntax check on the database query statement according to database language rules to obtain a first check result, wherein the syntax check includes at least one of the following: keyword checking, syntax structure checking, and spelling error checking; performing a field check on the database query statement according to database field rules to obtain a second check result; and performing a parameter type check on the database query statement according to database parameter definition rules to obtain a third check result; and if the first check result, the second check result, and the third check result all indicate that the database query statement has passed the check, then performing a pre-execution operation on the database query statement to obtain a pre-execution result. By performing the query statement checks and pre-execution steps, the correctness and security of the query statement are improved, and the probability of data query failures or system anomalies due to query statement errors is reduced. This approach is suitable for large-scale data query and analysis scenarios such as big data analysis platforms and enterprise-level data warehouses.
[0052] Furthermore, executing the database query statement to obtain data query results also includes: if the pre-execution result is successful, executing the database query statement to obtain data query results. The data query results can be saved for subsequent repeated queries or verification.
[0053] If the pre-execution result is an execution failure, the cause of the failure is determined, and a solution suggestion is generated. The cause of failure is the error message in the SQL statement, including the error type and location. The error message helps users or developers quickly locate and correct the problem.
[0054] SQL stands for Structured Query Language.
[0055] SQL is a standard programming language used for managing and processing relational databases, and it is widely used for data querying, manipulation, management, and definition. As one of the most commonly used languages in the database field, SQL statements are used for routine data management and manipulation, and are also a fundamental tool in data analysis, data warehousing, and data mining projects.
[0056] For example, SQL allows users to query specific information from a database using the "SELECT" statement. Users can specify which tables (or tables) to select, which columns to choose, and any applicable filtering conditions. It also provides "INSERT," "UPDATE," and "DELETE" statements, allowing users to add new data, update existing data, or delete unwanted data. Furthermore, SQL enables users to define and modify the database structure through statements such as "CREATE TABLE," "ALTER TABLE," and "DROP TABLE." This includes creating new tables, adding or modifying columns, creating indexes, and defining foreign key constraints.
[0057] In addition, SQL's GRANT and REVOKE statements allow database administrators to control user access permissions to specific database objects (such as tables and views), thereby achieving data security management. SQL ensures that data in the database conforms to predefined rules and conditions by defining constraints (such as PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, etc.), maintaining data integrity and consistency. SQL supports transaction processing, a set of operations that either all succeed or all fail, ensuring the consistency of the database state. SQL also supports creating views (a type of virtual table whose results are determined by SQL queries stored in the database) and stored procedures (pre-compiled blocks of SQL code that can be executed in the database to improve performance and encapsulate complex operations). SQL's GROUP BY function and aggregate functions (such as SUM, AVG, MAX, MIN, etc.) allow users to group data and perform statistical calculations, which is very useful in data reporting and analysis.
[0058] SQL's join operations allow data to be combined from multiple tables, which is the core capability of SQL in handling multi-table relationships. There are several types of joins, such as INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN. SQL supports nesting other queries within a single query, which can be used for more complex conditional filtering and data manipulation.
[0059] It should be noted that prepared SQL statements, also known as "compiled" SQL statements, include processes such as syntax checking, performance analysis, and data validation, as detailed below:
[0060] Syntax check: This checks whether the SQL statement conforms to the database's SQL language specifications, including keywords, syntax structure, and spelling errors. It also verifies the correctness of table names, field names, and function names, and checks for syntax errors such as mismatched parentheses or missing semicolons.
[0061] Data type and constraint checks: Ensure that the data types of fields and parameters match the definitions in the database table. Also check whether the statements comply with primary key, foreign key, uniqueness, and NOT NULL constraints of the table.
[0062] Performance analysis: The pre-execution phase typically involves query optimization, such as using an interpreter or optimizer to analyze the execution plan of the SQL statement to ensure query efficiency. It also includes checking whether the SQL statement uses indexes, whether it might generate a large number of I / O (write / read) operations, and whether it can effectively utilize the database's query cache.
[0063] Resource checks: Determine if the SQL statement to be executed will consume excessive system resources, such as CPU (Central Processing Unit), memory, or disk space, thus causing a degrade in system performance. Also check for lock waits to prevent queries from causing data lock contention.
[0064] Data validation: During the pre-execution phase, although no actual data is read or written, it checks whether the SQL statement references a non-existent table or field. It also assesses for potential data access issues, such as access failures due to insufficient permissions.
[0065] Error Feedback: If any issues are detected during the pre-execution phase, the system should be able to provide detailed error messages, including the error type, location, and possible resolution suggestions. These error messages help users or developers quickly locate and fix the problem.
[0066] Simulated execution results: By providing the function of simulated execution, that is, predicting the execution result of SQL statement without actually reading data, such as the number of rows returned, the estimated execution time, etc.
[0067] By pre-executing SQL statements, potential problems can be identified and resolved as much as possible before actual execution, improving the accuracy and efficiency of subsequent queries while reducing the impact on the production environment.
[0068] In an exemplary embodiment, the implementation scheme for generating a database query statement based on the target dimension configuration data and the target indicator data specifically includes: determining dimension values from the target dimension configuration data and indicator values from the target indicator data; setting the dimension values and indicator values as query fields, generating a Structured Query Language (SQL) statement based on the query fields, and adding sorting and grouping statements to the SQL statement to obtain the database query statement. This query statement generation method not only quickly and accurately obtains the data required by the user, but also supports sorting and grouping of query results, further improving the convenience and depth of data analysis, providing users with richer and more intuitive data displays, helping users to quickly understand and make decisions, and is suitable for scenarios requiring refined data analysis and decision-making.
[0069] In one exemplary embodiment, obtaining the filtering results of the dimension configuration data and the indicator data may include: obtaining a first filtering field and a second filtering field selected by the target object from the preset filtering fields corresponding to the data topic; using the first filtering field to filter the dimension configuration data of the data topic to obtain the target dimension configuration data; and using the second filtering field to filter the indicator data of the data topic to obtain the target indicator data.
[0070] In an exemplary embodiment, the process of generating a database query statement based on the target dimension configuration data and the target indicator data includes: determining dimension values from the target dimension configuration data and determining indicator values from the target indicator data; determining a target topic event based on the target dimension configuration data and the target indicator data; setting the dimension values and the indicator values as query fields; generating a Structured Query Language (SQL) statement based on the query fields, the target topic event, the first filter field, and the second filter field; and adding sorting and grouping statements to the SQL statement to obtain the database query statement.
[0071] To better understand the process of determining the above data query results, the implementation flow of the above data query results determination method will be described below in conjunction with optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.
[0072] In one embodiment, a data topic configuration strategy is proposed that tightly integrates data topics and key metrics, and the analysis results are presented through an efficient and intuitive user interface. This optimizes the user experience and reduces the amount of coding required, thereby helping users quickly gain insights into business trends and patterns. Figure 3 As shown, the specific steps are as follows:
[0073] Step S1: Query the topic list. Retrieve the topic configuration table from the database to display the data topics currently supported by the system. The topic configuration table is as follows: Figure 4 As shown, it can include topic number, topic name, topic description, table name, whether it is online, data lifecycle, and whether it has dimensions that support independent analysis (corresponding to is_dim), etc.
[0074] Step S2: Send the topic list data;
[0075] Step S3: Query topic data;
[0076] Step S4: Return topic details; display the enumeration values under the topic dimension. The topic event dimension configuration information is as follows: Figure 6 As shown, this includes the topic ID, event calculation formula, logical field ID, logical field name, and field type. The topic dimension enumeration values include the logical field ID, enumeration value, and enumeration value description. Supported metrics information for topic events is as follows: Figure 7 As shown, it includes topic number, logical field number, indicator number, indicator name, indicator formula, etc.
[0077] Step S5: Query dimension values; retrieve the specific topic's information configuration table (including ordinary fields and dimension fields) and topic event support indicator table from the database.
[0078] Step S6: Query the target user;
[0079] Step S7: Select the target user's corresponding segment from the tag factory;
[0080] Step S8: Pre-execute SQL statement; Based on the charts (line charts / tables) formed by business personnel dragging (filtering) indicators, dimensions, etc. on the page, generate the corresponding SQL statement, pre-execute the SQL and return the data results.
[0081] Step S9: Save the query results to obtain the detailed self-analysis table (i.e., the data query results mentioned above). Save the configured charts, including the chart style, the corresponding theme information, dimensions, metrics, and executed SQL. The detailed self-analysis table (data query results) is as follows: Figure 5 As shown, it includes the primary key ID, creator's name, chart rules, and executed SQL.
[0082] Through the above steps, multiple data themes are set up according to requirements, and related key performance indicators and dimensions are set under each theme. Rich interactive functions are provided, allowing users to directly filter, sort, and compare data on the interface. Users can customize their preferred themes and corresponding indicator sets, and add or delete indicator items as needed, ensuring that information display meets users' personalized requirements. Advanced charting techniques (such as line charts, bar charts, heatmaps, etc.) can be used to display query results, making complex data easier to understand. When a user modifies a parameter, the system can quickly respond and update the view, maintaining the consistency and accuracy of data display. This allows users to go beyond single-dimensional observation and delve deeper into the value of information from different perspectives. As can be seen, this application uses configuration to determine data query results, configure dimension events, and configure indicators, eliminating the need for developers to create indicators and reports. This facilitates users' analysis of desired data through the page.
[0083] Through such Figure 3 The intelligent data management system (i.e., intelligent BI management system) shown enables autonomous querying and filtering of data topics in the database, improving the flexibility and efficiency of data retrieval. By checking and pre-executing query statements, the correctness and security of the queries are ensured, avoiding data query failures or system anomalies caused by query errors. Furthermore, this method supports sorting and grouping of query results, further enhancing the convenience and depth of data analysis, providing users with richer and more intuitive data displays, and helping users quickly understand and make decisions. These technical solutions provide users with efficient, secure, and flexible data query and analysis services.
[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0085] Figure 8 This is a structural block diagram of a data query result determination device according to an embodiment of this application; as shown below. Figure 8 As shown, it includes:
[0086] The query module 82 is used to respond to a first query command sent by the target object through the interactive interface, query a list of topics from the database, and send the list of topics to the target object, wherein the list of topics includes at least the data topics supported by the data management system;
[0087] The acquisition module 84 is used to acquire the dimension configuration data of the data topic and the indicator data of the data topic from the database according to the second query instruction;
[0088] A generation module 86 is used to obtain the filtering results of the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query result corresponding to the database query statement. Through the above device, in response to a first query instruction sent by a target object through an interactive interface, a topic list is retrieved from the database and sent to the target object, wherein the topic list includes at least data topics supported by the data management system; according to a second query instruction, the dimension configuration data and indicator data of the data topic are obtained from the database; the filtering results of the dimension configuration data and the indicator data are obtained, the filtering results including target dimension configuration data and target indicator data, a database query statement is generated based on the target dimension configuration data and the target indicator data, the database query statement is executed, and the data query result corresponding to the database query statement is obtained; through this application, autonomous querying and filtering of data topics in the database is realized, improving the flexibility and efficiency of data querying. By generating and executing database query statements, the data query results required by the target object can be obtained quickly and accurately. The above technical solution solves the technical problem of low efficiency in determining data query results due to insufficient accuracy of the query data. This method not only improves the efficiency and accuracy of data query, but also enhances the flexibility of data query, thereby improving the efficiency of determining data query results. It is suitable for application scenarios that require a large amount of data analysis and decision-making.
[0089] In an exemplary embodiment, the database stores at least a topic configuration table. The query module is further configured to: obtain different topic numbers and topic data of the different topic numbers from the topic configuration table according to the first query instruction; determine target topic data that supports autonomous analysis from the topic data of the different topic numbers, and determine the target topic number corresponding to the target topic data; and generate the topic list according to the data topic indicated by the target topic.
[0090] In an exemplary embodiment, the query module is further configured to: traverse the different topic numbers, and for the current topic number traversed, determine the analysis capability identifier corresponding to the current topic number from the topic description of the current topic number; if it is determined that the analysis capability identifier indicates that the current topic number supports autonomous analysis, determine the current topic number as the target topic number, and determine the topic data of the current topic number as the target topic data.
[0091] In an exemplary embodiment, the query module is further configured to: traverse the different topic numbers, and for the current topic number that has been traversed, determine the topic name corresponding to the current topic number from the topic description of the current topic number; if it is determined that the topic name belongs to a topic name that supports autonomous analysis, determine the current topic number as the target topic number, and determine the topic data of the current topic number as the target topic data.
[0092] In an exemplary embodiment, the database further stores a topic event dimension configuration table and a topic event support indicator table. The acquisition module is further configured to: acquire dimension configuration data of different data topics from the topic event dimension configuration table according to the data number list contained in the second query instruction sent by the target object, wherein the data number list includes data numbers of all data topics; and acquire indicator data of the different data topics from the topic event support indicator table according to the data number list.
[0093] In an exemplary embodiment, the generation module is further configured to pre-execute the database query statement before executing the database query statement and obtaining the data query result. Specifically, this includes: performing a syntax check on the database query statement according to database language rules to obtain a first check result, wherein the syntax check includes at least one of the following: keyword checking, syntax structure checking, and spelling error checking; performing a field check on the database query statement according to database field rules to obtain a second check result; and performing a parameter type check on the database query statement according to database parameter definition rules to obtain a third check result; and, if the first check result, the second check result, and the third check result all indicate that the database query statement has passed the check, performing a pre-execution operation on the database query statement to obtain a pre-execution result.
[0094] In an exemplary embodiment, the generation module is further configured to: determine dimension values from the target dimension configuration data and determine indicator values from the target indicator data; set the dimension values and indicator values as query fields, generate a structured query language (SQL) statement based on the query fields, and add sorting and grouping statements to the SQL statement to obtain the database query statement.
[0095] In an exemplary embodiment, the generation module is further configured to: obtain a first filter field and a second filter field selected by the target object from the preset filter fields corresponding to the data topic; use the first filter field to configure the dimension data of the data topic to obtain the target dimension configuration data; and use the second filter field to filter the indicator data of the data topic to obtain the target indicator data.
[0096] In an exemplary embodiment, the generation module is further configured to: determine dimension values from the target dimension configuration data and determine indicator values from the target indicator data; determine a target topic event based on the target dimension configuration data and the target indicator data; set the dimension values and the indicator values as query fields; generate a structured query language (SQL) statement based on the query fields, the target topic event, the first filter field, and the second filter field; and add sorting and grouping statements to the SQL statement to obtain the database query statement.
[0097] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0098] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0099] S1, in response to the first query command sent by the target object through the interactive interface, a list of topics is retrieved from the database and sent to the target object, wherein the list of topics includes at least the data topics supported by the data management system;
[0100] S2, retrieve the dimension configuration data and indicator data of the data topic from the database according to the second query instruction;
[0101] S3, obtain the filtering results of the dimension configuration data and the indicator data, the filtering results include target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query result corresponding to the database query statement.
[0102] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0103] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0104] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0105] S1, in response to the first query command sent by the target object through the interactive interface, a list of topics is retrieved from the database and sent to the target object, wherein the list of topics includes at least the data topics supported by the data management system;
[0106] S2, retrieve the dimension configuration data and indicator data of the data topic from the database according to the second query instruction;
[0107] S3, obtain the filtering results of the dimension configuration data and the indicator data, the filtering results include target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query result corresponding to the database query statement.
[0108] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0109] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0110] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0111] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for determining data query results, characterized in that, include: In response to a first query command sent by the target object through an interactive interface, a list of topics is retrieved from the database and sent to the target object, wherein the list of topics includes at least data topics supported by the data management system; According to the second query instruction, retrieve the dimension configuration data of the data topic and the indicator data of the data topic from the database; Obtain the filtering results of the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query results corresponding to the database query statement.
2. The method for determining data query results according to claim 1, characterized in that, The database stores at least a topic configuration table. In response to a first query command sent by the target object through the interactive interface, a list of topics is retrieved from the database, including: According to the first query instruction, different topic numbers and topic data of the different topic numbers are obtained from the topic configuration table; From the topic data with different topic numbers, identify the target topic data that supports autonomous analysis, and determine the target topic number corresponding to the target topic data; The topic list is generated based on the data topic indicated by the target topic.
3. The method for determining the data query result according to claim 2, characterized in that, From the topic data with different topic numbers, target topic data that supports autonomous analysis is identified, and the target topic number corresponding to the target topic data is determined, including: Traverse the different topic numbers, and for the current topic number that is traversed, determine the analysis capability identifier corresponding to the current topic number from the topic description of the current topic number; If the analytical capability identifier indicates that the current topic number supports autonomous analysis, the current topic number is determined as the target topic number, and the topic data of the current topic number is determined as the target topic data.
4. The method for determining data query results according to claim 2, characterized in that, From the topic data with different topic numbers, target topic data that supports autonomous analysis is identified, and the target topic number corresponding to the target topic data is determined, including: Iterate through the different topic numbers, and for the current topic number that is encountered, determine the topic name corresponding to the current topic number from the topic description of the current topic number; If it is determined that the topic name belongs to a topic name that supports autonomous analysis, the current topic number is determined as the target topic number, and the topic data of the current topic number is determined as the target topic data.
5. The method for determining the data query result according to claim 1, characterized in that, The database also stores a topic event dimension configuration table and a topic event support metric table. According to the second query instruction, the dimension configuration data and metric data of the data topic are retrieved from the database, including: The dimension configuration data of different data themes are obtained from the topic event dimension configuration table according to the data number list contained in the second query instruction sent by the target object, wherein the data number list includes the data numbers of all data themes; And obtain the indicator data of the different data themes from the topic event support indicator table according to the data number list.
6. The method for determining data query results according to claim 1, characterized in that, Before executing the database query statement and obtaining the data query results, the method further includes: The database query statement is subjected to a syntax check according to the database language rules to obtain a first check result. The syntax check includes at least one of the following: keyword check, syntax structure check, and spelling error check. The database query statement is checked according to the database field rules to obtain a second check result; And perform parameter type checks on the database query statement according to the database parameter definition rules to obtain the third check result; If the first check result, the second check result, and the third check result all indicate that the database query statement has passed the check, a pre-execution operation is performed on the database query statement to obtain a pre-execution result.
7. The method for determining data query results according to claim 1, characterized in that, Generate a database query statement based on the target dimension configuration data and the target indicator data, including: Dimension values are determined from the target dimension configuration data, and indicator values are determined from the target indicator data; Set the dimension value and the indicator value as query fields, generate a structured query language (SQL) statement based on the query fields, add sorting and grouping statements to the SQL statement to obtain the database query statement.
8. The method for determining data query results according to claim 1, characterized in that, Obtaining the filtering results for the dimension configuration data and the indicator data includes: Obtain the first and second filter fields selected by the target object from the preset filter fields corresponding to the data topic; The first filter field is used to filter the dimension configuration data of the data topic to obtain the target dimension configuration data, and the second filter field is used to filter the indicator data of the data topic to obtain the target indicator data.
9. The method for determining data query results according to claim 8, characterized in that, Generate a database query statement based on the target dimension configuration data and the target indicator data, including: Dimension values are determined from the target dimension configuration data, and indicator values are determined from the target indicator data; The target topic event is determined based on the target dimension configuration data and the target indicator data. The dimension value and the indicator value are set as query fields. A structured query language (SQL) statement is generated based on the query fields, the target topic event, the first filter field, and the second filter field. Sorting and grouping statements are added to the SQL statement to obtain the database query statement.
10. A device for determining data query results, characterized in that, include: The query module is used to respond to a first query command sent by the target object through the interactive interface, retrieve a list of topics from the database, and send the list of topics to the target object, wherein the list of topics includes at least the data topics supported by the data management system; The acquisition module is used to acquire the dimension configuration data of the data topic and the indicator data of the data topic from the database according to the second query instruction; The generation module is used to obtain the filtering results of the dimension configuration data and the indicator data, the filtering results including target dimension configuration data and target indicator data, generate a database query statement based on the target dimension configuration data and the target indicator data, execute the database query statement, and obtain the data query result corresponding to the database query statement.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 9.
12. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 through the computer program.
Citation Information
Patent Citations
Structured query language instruction generation method and device based on index system
CN108681589A
Method and device for realizing data visualization
CN111444256A
Report generation method and device and electronic equipment
CN118227674A
Data analysis method and system based on dynamic SQL (Structured Query Language)
CN119003566A
Enterprise-level index management system, method and equipment based on big data and medium
CN119443957A