Index data query method and device applied to database, equipment and medium
Through unified indicator identification, multiple groups of indicator data in the database are managed and data query is implemented based on indicator identification, the problem of multiple data applications in the database is solved, and efficient data management and query is achieved.
Patent Information
- Application Number
- CN202311287559.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-03-28
AI Technical Summary
In a database, when it is necessary to target multiple data applications at the same time, it is difficult for the prior art to realize efficient data management and query, resulting in low efficiency.
Through unified indicator identification, multiple groups of indicator data in the database are managed and data query is implemented based on indicator identification. The specific method includes determining the user's data query request, responding to changes in the added data dimensions, and adjusting the query statement to ensure the accuracy and efficiency of the query results.
It realizes efficient management and query of multiple groups of indicator data in the database, improves the efficiency and convenience of data query, and can adapt to changes in data structures.
Smart Images

Figure CN119719173A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of database technology, in particular to the field of data query technology, and specifically to an indicator data query method, device, electronic device, and computer-readable storage medium applied to a database. Background Art
[0002] With the continuous development of database technology, database-based applications and services can be applied to various scenarios. When the amount of data contained in the database is large, or the database needs to be oriented to multiple data users at the same time, more efficient data management and query methods need to be applied.
[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0004] The present invention provides an indicator data query method, device, electronic device, and computer-readable storage medium applied to a database.
[0005] According to one aspect of the present disclosure, there is provided an indicator data query method applied to a database, wherein the database stores a plurality of indicator identifiers and a plurality of groups of indicator data corresponding to the plurality of indicator identifiers, each group of indicator data in the plurality of groups of indicator data includes a plurality of data dimensions, the method comprising: determining a data query request of a user including a target query parameter at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension filtering condition corresponding to the target indicator identifier; in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension filtering condition, determining a query statement for the database based on the target query parameter and the newly added data dimension; and executing the query statement in the database to obtain target query data for returning to the user.
[0006] According to another aspect of the present disclosure, there is provided an indicator data query device applied to a database, wherein the database stores a plurality of indicator identifiers and a plurality of groups of indicator data corresponding to the plurality of indicator identifiers, each group of indicator data in the plurality of groups of indicator data includes a plurality of data dimensions, and the device includes: a first determination unit, configured to determine a data query request of a user including a target query parameter at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension filtering condition corresponding to the target indicator identifier; a second determination unit, configured to determine a query statement for the database based on the target query parameter and the newly added data dimension in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension filtering condition; and a query unit, configured to execute the query statement in the database to obtain target query data for returning to the user.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned indicator data query method.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the above-mentioned indicator data query method.
[0009] According to one or more embodiments of the present disclosure, it is possible to manage multiple groups of indicator data in a database using a unified indicator identifier, and to implement data query based on the indicator identifier.
[0010] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0012] Figure 1A flowchart of an indicator data query method according to an exemplary embodiment of the present disclosure is shown;
[0013] Figure 2 A schematic diagram showing an indicator data query process according to an exemplary embodiment of the present disclosure is shown;
[0014] Figure 3 A structural block diagram of an indicator data query device according to an exemplary embodiment of the present disclosure is shown;
[0015] Figure 4 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0016] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0017] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0018] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0019] In the related art, when the indicator database needs to face multiple data application parties at the same time, the multiple data application parties usually manage the indicator data they need to store and query respectively, and the efficiency of data management and query is low.
[0020] Based on this, the present disclosure provides an indicator data query method applied to a database, which uses a unified indicator identifier to manage multiple groups of indicator data in the database, and when a data query request including a target indicator identifier and a data dimension screening condition is received, it is converted into a query statement for the database, so as to realize the use of a unified query interface to execute data queries, and when the data structure (i.e., multiple data dimensions) in the database changes, the query statement can be jointly determined based on the target query parameters and the change dimensions of the data structure, so as to realize the query interface's adaptation to changes in the data structure and improve data query efficiency and convenience.
[0021] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0022] Figure 1 The flowchart of the index data query method 100 applied to a database according to an exemplary embodiment of the present disclosure is shown. The database stores multiple index identifiers and multiple groups of index data corresponding to the multiple index identifiers. Each group of index data in the multiple groups of index data includes multiple data dimensions. Figure 1 As shown, the method 100 includes:
[0023] Step S101: determining a data query request including a target query parameter from a user at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension screening condition corresponding to the target indicator identifier;
[0024] Step S102: in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension screening condition, determining a query statement for a database based on the target query parameter and the newly added data dimension; and
[0025] Step S103: execute the query statement in the database to obtain target query data for returning to the user.
[0026] Thus, it is possible to manage and query multiple groups of indicator data in the database using a unified indicator identifier, and convert a data query request including a target indicator identifier into a structured query statement when it is received, so as to implement data query using a unified query method, avoid duplicate storage of indicator data, and improve the efficiency of data management and query. At the same time, when the data structure (i.e., multiple data dimensions) in the database changes, and the changed data dimensions can affect the initial query results, the query statement can be jointly determined based on the target query parameters and the changed dimensions of the data structure, so as to realize the query interface's self-adaptation to the data structure changes and improve the efficiency and convenience of data query.
[0027] In some examples, the indicator data may include various indicator data in a variety of application scenarios. For example, when method 100 is applied to e-commerce scenarios such as online ordering, the indicator data may be the sales of different types of food or various types of goods in the scenario, or the indicator data may be the number of consumer users. For another example, when method 100 is applied to a video playback scenario, the indicator data may include the number of views, clicks, and number of viewing users of various videos. It should be understood that method 100 may also be applied to other scenarios, and the indicator data may include various performance indicators in different scenarios, which is not limited in this disclosure.
[0028] In some examples, multiple data dimensions can be manually set according to needs. For example, time dimensions of various granularities may be included, such as time dimensions divided by natural year, natural month or natural day. When method 100 is applied to e-commerce scenarios such as online ordering, multiple data dimensions may also include meal period dimensions such as breakfast period and dinner period. For another example, multiple data dimensions may include spatial dimensions of various granularities, such as provincial and municipal dimensions divided according to administrative regions. When method 100 is applied to e-commerce scenarios such as online ordering, multiple data dimensions may also include consumption scenario dimensions such as dine-in and delivery.
[0029] It can be understood that each group of indicator data includes multiple indicator data, and each indicator data includes an indicator data value and a dimension value corresponding to each data dimension in the multiple data dimensions included in the group of indicator data. For example, when method 100 is applied to an e-commerce scenario, multiple groups of indicator data may include sales, order quantity, number of consumer users, etc. In this case, multiple data dimensions may include a time dimension divided by natural days and a geographical dimension divided by administrative divisions, so that multiple data included in each group of indicator data can be obtained. For example, the sales indicator data may include multiple sales data corresponding to the daily sales value of each division.
[0030] In some examples, the data query request may also include multiple sets of target query parameters, each set of target query parameters includes a target indicator identifier and corresponding data dimension filtering conditions, so that queries for multiple sets of target indicator data can be implemented more efficiently.
[0031] It can be understood that in this case, the target query data is obtained by filtering the multiple indicator data corresponding to the target indicator identifier based on the data dimension filtering condition. In this case, when the data corresponding to the newly added data dimension overlaps with the data corresponding to the at least one data dimension filtering condition, since the initial data dimension filtering condition does not include filtering for the newly added data dimension, the data corresponding to the newly added data dimension will affect the data query result. By executing the above method 100, the target query statement can be adjusted based on the newly added data dimension to ensure the correctness of the data query result.
[0032] In some examples, multiple indicator identifiers in a database and multiple groups of indicator data corresponding to the multiple indicator identifiers can form a structured indicator data table, and at the same time, descriptive information of each group of indicator identifiers can be stored, thereby enabling unified management of indicator data and enabling data query using structured statements.
[0033] In an example, each set of indicator data may be stored in a table format. For example, a data table as shown in Table 1 may be constructed for each set of indicator data.
[0034] Table 1:
[0035] Indicator data value Data Dimension A Data Dimension B Data Dimension C xxx A1 B1 C1 yyy A1 B2 C2 zzz A2 B3 C2
[0036] According to some embodiments, the target query parameter is JSON data, and the query statement includes an SQL statement. Thus, the target query parameter can be transmitted using structured JSON data, so that the target indicator identifier therein can be extracted and translated into a structured SQL query statement, thereby realizing efficient query for indicator data.
[0037] In some examples, the target query parameter and the query statement may also be in other forms. For example, the target query parameter may be transmitted in the form of XML data, and the query statement may be, for example, an HQL statement.
[0038] In actual application scenarios, a query interface for a database may be constructed in the form of an application programming interface (API). A user may pass a target query parameter to the database through the query interface, which is equivalent to initiating a data query request, so that a query operation for the database may be performed based on the target query parameter to obtain the target query data.
[0039] In some examples, when a database user calls a query interface, it is necessary to first apply for the corresponding interface information and calling permissions to record the user identity information when performing data query operations to ensure data security. The interface information may include, for example, a query interface ID, a query interface link, an exemplary query request adapted to the query interface, etc. In some examples, a query interface authentication signature may be generated based on the query interface ID and timestamp information. By passing the user's query interface authentication signature to the query interface, the query interface can verify the user's calling permissions based on this to improve the security of the query interface, thereby ensuring the security of the database.
[0040] In some examples, the user's data query request may be obtained by configuring a user interface adapted to the query interface. For example, the target indicator identifier and data dimension screening condition may be obtained by obtaining the user's selection operation on the indicator identifier and data dimension in the user interface.
[0041] In some examples, the indicator data query process described in the present disclosure may be implemented using a multi-layer system architecture based on a user interface layer, an API layer, and a database. A user may input a query request through the user interface layer, and the API layer may be used to obtain a query statement that can be executed in the database based on the user's query request, thereby obtaining target query data in the database.
[0042] In some examples, a specific translation module may be constructed at the API layer so that corresponding query statements can be generated based on target query parameters based on pre-set translation logic. In this case, when multiple data dimensions of multiple groups of indicator data in the database change, the translation logic may be adjusted according to the changed dimensions so that the adjusted translation module can generate query statements that are compatible with the new data structure based on the target query parameters.
[0043] According to some embodiments, based on the target query parameters and the newly added data dimensions, determining the query statement for the database includes: determining an indicator identification filter statement corresponding to the target indicator identification; determining at least one data dimension filter statement corresponding to at least one data dimension filter condition; generating a data dimension validity filter statement based on the newly added data dimension; and generating a query statement based on the indicator identification filter statement, at least one data dimension filter statement and the data dimension validity filter statement. Thus, multiple executable statements can be determined based on the content of the target query parameters and the newly added data dimensions, and then the obtained statements are combined to obtain executable query statements, thereby achieving efficient and accurate data query.
[0044] In this example, when multiple data dimensions are added to the database, corresponding data dimension validity filter conditions can be determined based on the newly added data dimensions and data dimension validity filter statements can be generated, so that when a data query is executed based on an existing query request, the newly added data dimension can be set to an invalid state by adjusting the query statement corresponding to the existing query request, so that the data query results corresponding to the existing query request can always remain consistent to ensure the accuracy of the data query.
[0045] For example, when the user's data query request at the first moment is for the indicator data in Table 1, and the data structure corresponding to this group of indicator data in the database has been changed to that shown in Table 2, in this case, it is necessary to determine the corresponding data dimension validity screening conditions by judging the newly added data dimensions in the data table to avoid the newly added data dimensions interfering with the data query results.
[0046] Table 2:
[0047]
[0048]
[0049] Referring to Table 1 and Table 2, it can be seen that the three indicator data initially included in the group of indicator data are xxx, yyy and zzz, and each indicator data contains values of three dimensions A, B and C. In this case, the data dimension screening condition corresponding to the initial data query request can be, for example, the sum of the values of the group of indicator data, that is, no screening is performed for the current data dimension to obtain the sum of xxx, yyy and zzz. When a new data dimension D is added to the database, and indicator data mmm and nnn with dimension values D1 and D2 are added accordingly, the newly added indicator data overlaps with the query data corresponding to the original data dimension screening condition. In this case, it is necessary to determine the corresponding data dimension validity screening condition to invalidate the newly added data dimension D, so that the indicators mmm and nnn corresponding to the data dimension D are not returned during the data query process to ensure the correctness of the data query.
[0050] In one example, when method 100 is applied to e-commerce scenarios such as online ordering, data dimensions A, B, and C can be, for example, time dimensions and consumption scenario dimensions of various granularities, such as the meal period dimension, natural month dimension, and consumption scenario dimension described above. In this case, when the target indicator data is sales data, and the data dimension screening condition is not to screen the current data dimension, xxx, yyy, and zzz can be summed to obtain the total sales data. When a data dimension D indicating space is added to the database, such as a provincial administrative region dimension, it is equivalent to splitting the total sales data into multiple provincial administrative regions to form multiple indicator data. It can be seen that the newly added indicator data overlaps with the original query data, that is, the newly added data dimension D needs to be invalidated to avoid the newly added mmm and nnn affecting the query results of the total sales data.
[0051] According to some embodiments, the target query parameter also includes at least one data return grouping condition, wherein the target query data is grouped based on the at least one data return grouping condition. When the target query parameter also includes at least one data return grouping condition, based on the target query parameter and the newly added data dimension, determining the query statement for the database also includes: determining at least one data grouping statement corresponding to the at least one data return grouping condition, and wherein the query statement is generated based on the indicator identification filter statement, at least one data dimension filter statement, at least one data grouping statement and the data dimension validity filter statement. Thus, the data return grouping condition can be used to characterize the user's demand for the data return display method, and the target indicator data can be grouped based on this to meet the user's needs.
[0052] In some examples, the data return grouping condition may be obtained by acquiring a selection operation performed by a user on a user interface for a data return method.
[0053] In some examples, when the target query parameter is JSON data and the query statement includes an SQL statement, multiple different fields in the JSON data can be used to transmit the target indicator identifier, data dimension screening conditions, and data return grouping conditions respectively. By reading the values corresponding to different fields in the JSON data, the corresponding query statement can be generated based on the preset rules.
[0054] In an example, the content of the JSON data may be as shown in Table 3 below:
[0055] Fields Contents aa.a Target indicator identification bb.b Data dimension filter conditions cc.c Data return grouping conditions dd.d The name of the target indicator data ee.e The ID of the target subdatabase
[0056] In this example, the aa.a field, bb.b field, and cc.c field in the JSON data are used to store the target indicator identifier, the data dimension screening condition, and the data return grouping condition, respectively. In this case, a Select statement can be generated based on the target indicator identifier, so that the target indicator data corresponding to the target indicator identifier can be read from the target sub-database. Furthermore, a Where statement can be generated based on the data dimension screening condition, and a Group by statement can be generated based on the data return grouping condition, so that the group of target indicator data can be screened and returned in groups according to the rules defined by the user.
[0057] For example, when the method 100 is applied to a business platform, and the indicator data includes three data dimensions of date, store, and market, the user's query target may be the number of registered members between 20230401 and 20230402. In this case, the target indicator identifier may be the target indicator identifier corresponding to the number of registered members, and the data dimension filtering condition and the data return grouping condition for the date dimension may be configured to filter and group the indicator data values of 20230401-20230402, and the data dimension filtering condition indicating that the store and market dimensions are not to be filtered is configured at the same time, that is, it is necessary to add the indicator data values of multiple groups corresponding to different store and market dimensions corresponding to each date on the basis of filtering and grouping based on the date dimension to obtain the target query data.
[0058] In one example, when the user's data query request is for the indicator data containing the three data dimensions of date, store, and market as described above, the data structure corresponding to this group of indicator data in the database has added a new channel data dimension. In this case, by performing the steps of filtering and grouping based on the date dimension as described above, adding the multiple groups of indicator data values corresponding to different dimensions corresponding to each date, the indicator data values corresponding to the newly added data dimension will be calculated repeatedly, resulting in errors in the query results. By determining and executing data dimension validity filter statements based on the newly added data dimensions, query errors can be avoided and the accuracy of data queries can be improved.
[0059] According to some embodiments, the database includes multiple sub-databases, and the method 100 further includes: determining a target sub-database storing target indicator data, and wherein, based on the target query parameter and the newly added data dimension, generating a query statement for the database includes: based on the target query parameter and the newly added data dimension, generating a query statement for the target sub-database. Thus, different types of query statements can be configured for different types of sub-databases, and the corresponding target sub-database is determined based on the target indicator identifier during the data query process, thereby obtaining a query statement adapted to the type of the target sub-database.
[0060] In some examples, the multiple sub-databases may include a MySQL database, an HBase database, etc. Therefore, the query statement type may be determined according to the type of database, for example, an SQL query statement may be generated for a MySQL database to ensure the correctness of the data query.
[0061] According to some embodiments, the database further includes a metadata database, in which a mapping relationship between multiple indicator identifiers and multiple sub-databases is stored, and wherein determining a target sub-database storing target indicator data includes: based on the target indicator identifier, querying the target sub-database from the metadata database. Thus, the metadata database can be used to store storage location information of each group of indicator data, and the target sub-database corresponding to the target indicator identifier can be determined by querying the metadata database, thereby improving the efficiency and accuracy of data query.
[0062] In some examples, mapping rules between multiple indicator identifiers and multiple sub-databases may be pre-configured, and a target sub-database corresponding to the target indicator identifier may be determined based on the mapping rules. For example, when multiple indicator identifiers are numbers, the mapping rules may include a mapping relationship between multiple sub-databases and multiple non-overlapping numerical intervals, so that the target sub-database can be determined based on the numerical interval in which the numerical value corresponding to the target indicator identifier is located.
[0063] In some examples, the target query parameter may be used to directly transmit the identifier of the target sub-database to further improve data query efficiency.
[0064] According to some embodiments, the target indicator identifier is selected by a user from a plurality of preset derived indicator identifiers, and method 100 further includes: based on preset rules, determining a plurality of original indicator identifiers and calculation rules corresponding to the target indicator identifier from a plurality of indicator identifiers stored in a database, wherein, in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after a first moment, and determining that the data corresponding to the newly added data dimension overlaps with the data corresponding to the at least one data dimension screening condition, based on the target query parameter and the newly added data dimension, determining a query statement for the database includes: for each of the plurality of original indicator identifiers, in response to determining the query statement corresponding to the original indicator identifier The original indicator data includes a newly added data dimension created at a second moment after the first moment, and it is determined that the data corresponding to the newly added data dimension overlaps with the data corresponding to the at least one data dimension screening condition, and based on the original indicator identifier and the newly added data dimension, a query statement corresponding to the original indicator identifier is determined, and wherein executing the query statement in the database to obtain the target query data for returning to the user includes: for each original indicator identifier in a plurality of original indicator identifiers, executing the query statement corresponding to the original indicator identifier in the database to obtain the corresponding original indicator data; and calculating based on multiple groups of original indicator data and calculation rules corresponding to the multiple original indicator identifiers, to obtain the target query data. Thus, it is possible to obtain richer derivative indicator data by querying multiple original indicator identifiers from the database, and then calculating multiple groups of original indicator data corresponding to the original indicator identifiers based on corresponding calculation rules.
[0065] In some examples, the original indicator identifier and the derived indicator identifier can be divided based on the plaintext data content contained in the database. The original indicator identifier represents the indicator identifier stored in plaintext in the database, and the derived indicator identifier represents the indicator identifier not directly stored in the database. It can be understood that the derived indicator identifier is also pre-defined manually, and the indicator data corresponding to the derived indicator identifier needs to be obtained by performing four arithmetic operations on the indicator data corresponding to the original indicator identifier. In this example, the original indicator identifier corresponding to each derived indicator identifier and the corresponding operation rules are also pre-defined manually.
[0066] In some examples, when method 100 is applied to e-commerce scenarios such as online ordering, the target indicator data corresponding to the derived indicator identifier may be the average customer spending data of a certain restaurant during a target time period. In this case, the target indicator data may be obtained by querying two sets of original indicator data, namely the number of consumer users and sales of the restaurant during the target time period, and then dividing the number of consumer users by the sales.
[0067] Figure 2FIG. 1 is a schematic diagram showing an indicator data query process according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the translation layer is configured to generate a corresponding query statement based on a data query request. After receiving a data query request containing a target query parameter, the type of the target sub-database can be first queried from the metadata database based on the target indicator identifier. The generation module can generate a query statement for the target sub-database based on the target query parameter, for example, by executing the query statement generation process described above. By executing the query statement in the target sub-database, the target indicator data for the data query request can be obtained.
[0068] According to another aspect of the present disclosure, there is also provided an indicator data query device applied to a database, wherein a plurality of indicator identifiers and a plurality of groups of indicator data corresponding to the plurality of indicator identifiers are stored in the database. Figure 3 FIG. 4 shows a structural block diagram of an indicator data query device 300 according to an exemplary embodiment of the present disclosure. Figure 3 As shown, the device 300 includes:
[0069] The first acquisition unit 301 is configured to determine a data query request including a target query parameter from a user at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension screening condition corresponding to the target indicator identifier;
[0070] A second acquisition unit 302 is configured to, in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that the data corresponding to the newly added data dimension overlaps with the data corresponding to the at least one data dimension screening condition, determine a query statement for the database based on the target query parameter and the newly added data dimension; and
[0071] The query unit 303 is configured to execute a query statement in the database to obtain target query data for returning to the user.
[0072] It should be understood that Figure 3 The operations of the various units of the indicator data query device 300 shown in FIG. Figure 1 The steps in the index data query method 100 described above correspond to each other. Therefore, the operations, features and advantages described above for the method 100 are also applicable to the device 300 and the various units included therein. For the sake of brevity, some operations, features and advantages are not repeated here.
[0073] In some examples, the target query parameters further include at least one data return grouping condition, wherein the target query data is grouped based on the at least one data return grouping condition.
[0074] In some examples, the second acquisition unit 302 includes: a first determination subunit, configured to determine an indicator identifier filtering statement corresponding to a target indicator identifier; a second determination subunit, configured to determine at least one data dimension filtering statement corresponding to at least one data dimension filtering condition; a first generation subunit, configured to generate a data dimension validity filtering statement based on a newly added data dimension; and a second generation subunit, configured to generate a query statement based on the indicator identifier filtering statement, at least one data dimension filtering statement and a data dimension validity filtering statement.
[0075] According to some embodiments, when the target query parameters also include at least one data return grouping condition, the second acquisition unit 302 also includes: a third determination subunit, configured to determine at least one data grouping statement corresponding to the at least one data return grouping condition, and wherein the second generation subunit is configured to generate a query statement based on an indicator identification filtering statement, at least one data dimension filtering statement, at least one data grouping statement and a data dimension validity filtering statement.
[0076] In some examples, the database includes multiple sub-databases, and the device 300 also includes: a first determination unit, configured to determine a target sub-database storing target indicator data, and wherein the second acquisition unit 302 is configured to: generate a query statement for the target sub-database based on the target query parameters and the newly added data dimension.
[0077] In some examples, the database further includes a metadata database, in which mapping relationships between multiple indicator identifiers and multiple sub-databases are stored, and wherein the determination unit is configured to: based on the target indicator identifier, query the metadata database to obtain a target sub-database.
[0078] In some examples, the target indicator identifier is selected by a user from multiple preset derived indicator identifiers, and the device 300 also includes: a second determination unit, configured to determine, based on preset rules, multiple original indicator identifiers and calculation rules corresponding to the target indicator identifier from multiple indicator identifiers stored in a database, wherein the second acquisition unit is configured to: for each of the multiple original indicator identifiers, in response to determining that the original indicator data corresponding to the original indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that the data corresponding to the newly added data dimension overlaps with the data corresponding to at least one data dimension filtering condition, determine a query statement corresponding to the original indicator identifier based on the original indicator identifier and the newly added data dimension, and wherein the query unit is configured to: for each of the multiple original indicator identifiers, execute the query statement corresponding to the original indicator identifier in the database to obtain the corresponding original indicator data; and perform calculations based on multiple groups of original indicator data and calculation rules corresponding to the multiple original indicator identifiers to obtain target query data.
[0079] According to some embodiments, the target query parameter is JSON data, and the query statement includes an SQL statement.
[0080] According to another aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned indicator data query method.
[0081] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned indicator data query method.
[0082] See also Figure 4 , a block diagram of an electronic device 400 that can be used as the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be a computer device of different types, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0083] Figure 4 1 shows a block diagram of an electronic device according to an embodiment of the present disclosure. Figure 4 As shown, the electronic device 400 may include at least one processor 401 , a working memory 402 , an I / O device 404 , a display device 405 , a storage device 406 , and a communication interface 407 that can communicate with each other via a system bus 403 .
[0084] Processor 401 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. Processor 401 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. Processor 401 may be configured to obtain and execute computer-readable instructions stored in working memory 402, storage device 406, or other computer-readable media, such as program codes of operating system 402a, program codes of application programs 402b, and the like.
[0085] Working memory 402 and storage device 406 are examples of computer-readable storage media for storing instructions, which are executed by processor 401 to implement the various functions described above. Working memory 402 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, storage device 406 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, memory cards, flash memory, a floppy disk, an optical disk (e.g., CD, DVD), a storage array, a network attached storage, a storage area network, etc. Working memory 402 and storage device 406 may all be collectively referred to herein as memory or computer-readable storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by processor 401 as a specific machine configured to implement the operations and functions described in the examples herein.
[0086] The I / O device 404 may include an input device and / or an output device. The input device may be any type of device capable of inputting information to the electronic device 400, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output device may be any type of device capable of presenting information, and may include but is not limited to a video / audio output terminal, a vibrator, and / or a printer.
[0087] The communication interface 407 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.
[0088] The application 402b in the working register 402 can be loaded to execute the various methods and processes described above, such as Figure 1 In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via the storage device 406 and / or the communication interface 407. When the computer program is loaded and executed by the processor 401, one or more steps of the indicator data query method described above may be executed.
[0089] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0090] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0091] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0093] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0094] A computing system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0095] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0096] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. An indicator data query method applied to a database, wherein the database stores a plurality of indicator identifiers and a plurality of groups of indicator data corresponding to the plurality of indicator identifiers, each group of indicator data in the plurality of groups of indicator data includes a plurality of data dimensions, and the method comprises: Determine a data query request including a target query parameter from a user at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension screening condition corresponding to the target indicator identifier; In response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second time after the first time, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension screening condition, determining a query statement for the database based on the target query parameter and the newly added data dimension; and The query statement is executed in the database to obtain target query data for returning to the user.
2. The method of claim 1, wherein: The target query parameters further include at least one data return grouping condition, wherein the target query data is grouped based on the at least one data return grouping condition.
3. The method according to claim 1 or 2, wherein: The determining, based on the target query parameter and the newly added data dimension, a query statement for the database includes: Determine an indicator identifier filter statement corresponding to the target indicator identifier; Determining at least one data dimension filtering statement corresponding to the at least one data dimension filtering condition; Based on the newly added data dimension, generate a data dimension validity screening statement; and The query statement is generated based on the indicator identification filter statement, the at least one data dimension filter statement and the data dimension validity filter statement.
4. The method of claim 3, wherein: When the target query parameter further includes at least one data return grouping condition, the step of determining the query statement for the database based on the target query parameter and the newly added data dimension further includes: determining at least one data grouping statement corresponding to the at least one data return grouping condition, And wherein, the query statement is generated based on the indicator identification filter statement, the at least one data dimension filter statement, the at least one data grouping statement and the data dimension validity filter statement.
5. The method according to claim 1 or 2, wherein: The database includes a plurality of sub-databases, and the method further includes: determining a target sub-database storing the target indicator data, And wherein, generating a query statement for the database based on the target query parameter and the newly added data dimension includes: Based on the target query parameter and the newly added data dimension, a query statement for the target sub-database is generated.
6. The method of claim 5, wherein: The database also includes a metadata database, in which a mapping relationship between multiple indicator identifiers and multiple sub-databases is stored. And wherein, the determining of the target sub-database storing the target indicator data comprises: Based on the target indicator identifier, the target sub-database is obtained by querying from the metadata database.
7. The method according to claim 1 or 2, wherein: The target indicator identifier is selected by the user from a plurality of preset derivative indicator identifiers, and the method further includes: Based on preset rules, multiple original indicator identifiers and calculation rules corresponding to the target indicator identifier are determined from multiple indicator identifiers stored in the database, In response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension screening condition, determining, based on the target query parameter and the newly added data dimension, a query statement for the database includes: For each of the plurality of original indicator identifiers, in response to determining that the original indicator data corresponding to the original indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension screening condition, determining a query statement corresponding to the original indicator identifier based on the original indicator identifier and the newly added data dimension, And wherein, executing the query statement in the database to obtain target query data for returning to the user includes: For each original indicator identifier of the plurality of original indicator identifiers, executing a query statement corresponding to the original indicator identifier in the database to obtain corresponding original indicator data; and Calculation is performed based on multiple groups of original indicator data corresponding to the multiple original indicator identifiers and the calculation rules to obtain the target query data.
8. The method according to claim 1 or 2, wherein: The target query parameter is JSON data, and the query statement includes an SQL statement.
9. An indicator data query device applied to a database, wherein the database stores a plurality of indicator identifiers and a plurality of groups of indicator data corresponding to the plurality of indicator identifiers, each group of indicator data in the plurality of groups of indicator data includes a plurality of data dimensions, the device comprising: A first determining unit is configured to determine a data query request including a target query parameter from a user at a first moment, wherein the target query parameter includes a target indicator identifier and at least one data dimension screening condition corresponding to the target indicator identifier; a second determining unit, in response to determining that the target indicator data corresponding to the target indicator identifier includes a newly added data dimension created at a second moment after the first moment, and determining that data corresponding to the newly added data dimension overlaps with data corresponding to the at least one data dimension screening condition, determining a query statement for the database based on the target query parameter and the newly added data dimension; and The query unit is configured to execute the query statement in the database to obtain target query data for returning to the user.
10. An electronic device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.