A data query method and device
By constructing query logic expressions in business intelligence tools to directly obtain query results, the problems of high query complexity and low efficiency are solved, achieving more efficient data querying.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING GRIDSUM TECH CO LTD
- Filing Date
- 2022-06-30
- Publication Date
- 2026-07-21
AI Technical Summary
Existing business intelligence tools suffer from high query complexity and low efficiency because they cannot translate all query logic into the structured query language SQL.
By receiving query requests, determining query parameters and data sources, using query parameters to obtain the data to be queried, and constructing query logic expressions to directly obtain query results, the query parameters are avoided from being converted into complex SQL statements.
It reduces query complexity, improves query efficiency, and enhances query flexibility and accuracy.
Smart Images

Figure CN117370370B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data query technology, and in particular to a data query method and apparatus. Background Technology
[0002] Business Intelligence (BI) tools typically save the query and analysis logic configured by users through a graphical interface as structured query parameters. During query execution, these parameters are translated into Structured Query Language (SQL) statements and sent to the appropriate query engine or data source. However, while the query parameters need to be converted into SQL, not all query logic can be expressed using SQL. When encountering logic that cannot be expressed in SQL, the entire query logic needs to be broken down into multiple parts, each using different techniques to query the data. This leads to high query complexity and low efficiency when the query engine or data source executes the query. Summary of the Invention
[0003] In view of this, the present invention provides a data query method and apparatus that can effectively reduce query complexity and improve query efficiency.
[0004] To achieve the above objectives, the present invention mainly provides the following technical solutions:
[0005] In a first aspect, the present invention provides a data query method, the method comprising:
[0006] Based on the received query request, determine the query parameters and the query data source;
[0007] The query parameters are used to obtain the data to be queried from the query data source;
[0008] Based on the query parameters and the data to be queried, construct a query logic expression corresponding to the query parameters;
[0009] The query results are obtained from the data to be queried based on the query logic expression.
[0010] Secondly, the present invention provides a data query device, the device comprising:
[0011] The determination module is used to determine the query parameters and query data source based on the received query request;
[0012] The acquisition module is used to acquire the data to be queried from the query data source using the query parameters;
[0013] The construction module is used to construct a query logic expression corresponding to the query parameters based on the data to be queried;
[0014] The query module is used to obtain query results from the data to be queried based on the query logic expression.
[0015] By employing the above technical solution, the present invention provides a data query method and apparatus. After receiving a user's query request and generating query parameters, the method obtains the data to be queried through the query parameters and constructs a query logical expression corresponding to the query parameters. By converting the query parameters into a query logical expression, the query logical expression can be used to query data in the data to be queried, thereby obtaining the corresponding query results. This eliminates the need to convert the query parameters into complex SQL statements, effectively reducing conversion complexity and query complexity, while simultaneously increasing query efficiency. Furthermore, in this embodiment of the invention, by directly converting the query into a query logical expression and using the query logical expression to query data, the problem of low query complexity and efficiency caused by converting query parameters into complex SQL statements in the prior art can be effectively avoided.
[0016] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a data query method disclosed in this invention;
[0019] Figure 2 This is a flowchart illustrating a method for constructing a query logic expression disclosed in this invention.
[0020] Figure 3 This is a flowchart illustrating a method for constructing a first target data table disclosed in this invention.
[0021] Figure 4 This is a flowchart illustrating a method for constructing a second target data table disclosed in this invention;
[0022] Figure 5 This is a flowchart illustrating another method for constructing a second target data table disclosed in this invention;
[0023] Figure 6 This is a flowchart illustrating a query condition configuration method disclosed in this invention;
[0024] Figure 7 This is a flowchart illustrating a query parameter generation method disclosed in this invention;
[0025] Figure 8 This is a schematic diagram of a data query device disclosed in this invention;
[0026] Figure 9 This is a schematic diagram of another data query device disclosed in this invention;
[0027] Figure 10 A block diagram of a device disclosed in this invention. Detailed Implementation
[0028] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0029] Business Intelligence (BI) tools typically save the query and analysis logic configured by users through a graphical interface as structured query parameters. When executing a query, these parameters are translated into Structured Query Language (SQL) statements and sent to the appropriate query engine or data source. However, while the query parameters need to be converted into SQL, not all query logic can be expressed using SQL. When encountering logic that cannot be expressed in SQL, the entire query logic needs to be broken down into multiple segments, each using different techniques to query the data.
[0030] To address the above problems, embodiments of the present invention provide a data query method, the method comprising:
[0031] Step 101: Determine the query parameters and query data source based on the received query request.
[0032] Specifically, after receiving a query request, the query request is converted into corresponding query parameters, and the corresponding query data source is determined through the query parameters. Specifically, when the fields in the query parameters converted from the query request are A, B, and C, the query parameters are composed of fields A, B, and C. Based on the query parameters, the corresponding query data sources for the query request are determined as query data source A0, query data source B0, and query data source C0, respectively. By converting the query request into query parameters, the query data source can be accurately selected, which can effectively improve the query speed and thus improve the query efficiency.
[0033] Step 102: Use the query parameters to obtain the data to be queried from the query data source.
[0034] Specifically, after executing step 101, the query data source corresponding to the query parameters is determined using step 101. Data related to the query parameters is extracted from the query data sources corresponding to each query parameter. The extracted data is the data to be queried. Specifically, when the field information in the converted query parameters is A, B, and C, firstly, based on field A, data Aa related to field A is extracted from query data source A0. Similarly, data Bb and Cc related to fields B and C are extracted from query data sources B0 and C0, respectively. The data Aa, Bb, and Cc as a whole are called the data to be queried. The data table in query data source A0 is table1, the data table in query data source B0 is table2, and the data table in query data source C0 is table3. The whole of table1, table2, and table3 is the data to be queried for the query parameters. The data structure of the data to be queried is organized into a tabular data structure (DateFrame). The data to be queried includes DateFrameA0, DateFrameB0, and DateFrameC0. In the steps of this embodiment, by utilizing query parameters, data related to the query parameters can be extracted from the corresponding query data source, which can effectively narrow the query scope and thus effectively improve query efficiency.
[0035] Step 103: Based on the query parameters and the data to be queried, construct a query logic expression corresponding to the query parameters.
[0036] Specifically, after executing step 102, the data to be queried is integrated according to the determined query parameters, and a query logic expression corresponding to the query parameters is generated after integration. In this embodiment of the invention, by directly converting the query parameters into query logic expressions, the process of converting the query parameters into SQL statements is omitted, effectively reducing the difficulty and complexity of the conversion. At the same time, by directly converting the query parameters into query logic expressions, the query parameters can be processed uniformly, effectively avoiding the problem that query parameters cannot be converted into SQL statements, and effectively improving the flexibility of the conversion.
[0037] Step 104: Obtain the query result from the data to be queried according to the query logic expression.
[0038] Specifically, after executing step 103, the completed query logic expression is used to construct a corresponding logical plan set, and a corresponding physical plan set is generated based on the logical plan set. By executing the physical plan set in the data to be queried, the corresponding query results are obtained. Specifically, in this embodiment, data query is performed by executing the query logic expression, omitting the process of converting query parameters into SQL statements, effectively reducing the difficulty and complexity of conversion. By querying the corresponding data in the data to be queried to obtain the corresponding query results, the scope of data query is effectively narrowed, thereby effectively improving data query efficiency and reducing the complexity of data query.
[0039] Furthermore, embodiments of the present invention also provide a method for constructing query logical expressions, which is a method for... Figure 1 The detailed description of step 103 in the illustrated embodiment, "constructing a query logic expression corresponding to the query parameters based on the query parameters and the data to be queried," is as follows: Figure 2 The following are included:
[0040] Step 201: Based on the query parameters and the data to be queried, construct a first target data table.
[0041] Specifically, in step 103, based on the query parameters, column data related to the query parameters is extracted from the data to be queried. This extraction of column data generates the corresponding first target data table. Specifically, when the determined query parameters are (A, B), column data corresponding to the field is extracted from the data to be queried to construct the first target data table corresponding to that field. Similarly, column data corresponding to field B is extracted from the data to be queried to construct the first target data table corresponding to field B, thus determining the first target data table corresponding to each query parameter. Specifically, in this embodiment, the number of first target data tables is the same as the number of query fields in the query parameters. In this embodiment, by constructing the corresponding first target data table from the data to be queried based on the query parameters, data can be extracted within a limited range, effectively improving the speed of constructing the first target data table and saving time in constructing the query logic expression, further improving the efficiency of data querying.
[0042] Step 202: Construct the second target data table based on the first target data table.
[0043] The second target data table includes at least one of the first target data tables.
[0044] Specifically, after executing step 201 and constructing the first target data table, the various first target data tables are further integrated and processed based on the fields in the query parameters. The column data in each first target table is rearranged and combined to form the second target data table. Specifically, if there is only one first target data table in step 201, the second target data table in this step is identical to the first target data table. By constructing the second target data table in this step, the column data in the various first data tables can be further integrated, thereby further narrowing the data query scope for constructing the query logic expression, saving time in constructing the query logic expression, and further improving the efficiency of data querying.
[0045] Step 203: Based on the query parameters, construct the query logic expression according to the second target data table.
[0046] Specifically, after executing step 202, the second data table is further organized and processed based on the fields in the query parameters, thereby constructing the corresponding query logic expression. The column data in the second data table is further organized to construct the query logic expression. This step directly converts the query parameters into query logic expressions, thus omitting the process of converting the query parameters into SQL statements, effectively reducing the difficulty and complexity of the conversion. Furthermore, by directly converting the query parameters into query logic expressions, the query parameters can be processed uniformly, effectively avoiding the problem of query parameters being unable to be converted into SQL statements, and effectively improving the flexibility of the conversion.
[0047] Furthermore, embodiments of the present invention also provide a method for constructing a first target data table, the method being... Figure 2 The detailed description of step 201 in the illustrated embodiment, "constructing a first target data table based on the query parameters and the data to be queried," is as follows: Figure 3 The following are included:
[0048] Step 301: Parse the query parameters and obtain the field information in the query parameters.
[0049] Specifically, in step 201, the received query parameters are parsed to obtain the field information within the query parameters. Specifically, when the determined query parameters are (A, B), A and B are parsed separately to obtain column1 corresponding to A, which is the query field, and column2 corresponding to B, which is also the query field. Specifically, the query parameters include, but are not limited to, query fields, related fields, and parsed fields. In this embodiment, by parsing the query parameters, the data to be queried can be accurately determined, thereby improving the efficiency and accuracy of data retrieval.
[0050] Step 302: Extract the data corresponding to the query field from the data to be queried based on the field information.
[0051] Specifically, after executing step 301 and determining the query fields in the query parameters, column data related to the query fields is extracted from the data to be queried. Specifically, in this embodiment, when the query fields determined in step 301 are column1 and column2, column data related to column1 is extracted from query data source A0 in the data to be queried, and column data related to column2 is extracted from query data source B0 in the data to be queried, thus completing the data extraction. By extracting column data related to the query fields, the efficiency of data extraction is improved, thereby saving data query time and improving data query efficiency.
[0052] Step 303: Construct the first target data table based on the extracted data.
[0053] Specifically, after executing step 302, the extracted column data is arranged to construct a first target data table corresponding to the query fields. Specifically, in this embodiment, when the query fields determined in step 302 are column1 and column2, column data related to column1 is extracted from query data source A0 in the data to be queried, and the extracted column data is arranged to construct a first target data table related to the query field column1. Similarly, column data related to column2 is extracted from query data source B0 in the data to be queried, and the extracted column data is arranged to construct a first target data table related to the query field column2. By constructing the first target data table based on the extracted data, the speed of constructing the first target data table is effectively improved, thereby saving time in constructing the query logic expression and further improving the efficiency of data querying.
[0054] Furthermore, embodiments of the present invention also provide a method for constructing a second target data table, the method being... Figure 2 The specific steps of "constructing the second target data table based on the first target data table" in step 202 of the embodiment are as follows: Figure 4 The following are included:
[0055] Step 401: Determine whether there is a related field in the field information of the query parameters.
[0056] The association field is used to associate multiple first target data tables.
[0057] Specifically, in step 202, the query parameters are parsed to determine the type of the field information. Based on this, it is determined whether the field information contains related fields. If related fields exist, step 402 is executed; otherwise, step 403 is executed. Specifically, in this embodiment, when the query parameters also include C, C is parsed as column3, and the type of column3 is determined. If this column is a related field, step 402 is executed; otherwise, step 403 is executed. By determining the type of the field information in the query parameters, a second target data table can be accurately constructed. This allows for the accurate construction of query logic expressions based on the second target data table, thereby improving the efficiency of data queries.
[0058] Step 402: Based on the association field, construct the second target data table based on the multiple first target data tables associated with the association field.
[0059] Specifically, after executing step 401, if there are related fields in the field information, the first target data table associated with that related field is determined, and multiple first target data tables associated with that related field are integrated to construct a second target data table. Specifically, when the field information in the query parameters is column1, column2, and column3, where column1 and column2 are query fields, and column3 is a related field, the related field column3 is associated with both the first target data table corresponding to column1 and the first target data table corresponding to column2. By integrating the first target data tables corresponding to column1 and column2 using the related field column3, the second target data table is formed. The second target data table includes the column data from both the first target data tables corresponding to column1 and column2. By using related fields to construct the second target data table, the query logic expression can be constructed more accurately, thereby effectively improving data query efficiency during execution.
[0060] Step 403: The first target data table is determined as the second target data table.
[0061] Specifically, after executing step 401, if the field information does not contain any related fields, then there is no need to integrate the first target data table. Instead, the first target data table corresponding to each query field is determined as the second target data table, and the determined second target data table is used to construct the query logic expression. Specifically, when the field information in the query parameters is column1, column2, and column3, where column1, column2, and column3 are all query fields, then there are three second target data tables, each corresponding to a different first target data table for the query fields column1, column2, and column3. By determining each first target data table as the second target data table, the query logic expression can be constructed more accurately, thereby effectively improving data query efficiency during execution.
[0062] Furthermore, embodiments of the present invention provide yet another method for constructing a second target data table, which is a method for... Figure 4 The specific steps in step 402 of the embodiment, "after constructing the second target data table based on the first target data table according to the associated fields," are as follows: Figure 5 As shown, the method further includes:
[0063] Step 501: Determine whether a filter field exists in the field information.
[0064] Specifically, in step 402, the query parameters are parsed to determine the type of the fields in the parameters and whether they contain filtering fields. If a filtering field exists, step 502 is executed, requiring filtering of the second target data table. If no filtering field exists, step 504 is executed, and no filtering of the second target data table is required. Specifically, when the query parameters contain columns1, 2, 3, and 4, where columns1 and 2 are query fields, column3 is a join field, and column4 is a filtering field, the second target data table constructed using columns1 and 2 as query fields and column3 as a join field is filtered. By further determining the field types and constructing the second target data table based on the determination results, the query logic expression can be constructed more accurately, thereby effectively improving data query efficiency.
[0065] Step 502: Filter the data in the second target data table according to the filtering fields to construct a third target data table.
[0066] Specifically, after executing step 501, when a filter field exists in the field information, the characters of the filter field are obtained. Based on the characters of the filter field, data in the second target data table that matches the characters in the filter field are matched. The successfully matched data is deleted to construct the third target data table. Specifically, when matching characters in the filter field in the second target data table, the data names of each column in the second target data table are first obtained. The data names of each column are matched with the characters in the filter field in turn. When a match is successful, the successfully matched columns are deleted to construct the third target data table. Specifically, in this embodiment, when the data names of each column in the second target data table are column1, column2, column3, and column4, the total number of columns is 20. The filter field column4 is matched with the data names in the second target data table, and the columns in the second data table corresponding to the filter field column4 are deleted in turn. The data names of each column in the constructed third target data table are column1, column2, and column3. By filtering the second data source table, the query logic expression can be constructed more accurately, thereby effectively improving the efficiency of data query when executing the query.
[0067] Step 503: Replace the second target data table with the third target data table.
[0068] Specifically, after executing step 502, the constructed third target data table replaces the second target data table in step 203, and then the replaced second target data table is used to construct the query logic expression. By replacing the original second target data table with the third data table, the query logic expression can be accurately constructed according to the user's query request, thereby improving the accuracy of data querying using the query logic expression and further improving the efficiency of data querying.
[0069] In step 504, the second target data table is not filtered.
[0070] Specifically, after executing step 501, if it is determined that the field information of the query parameters does not contain a filter field, then there is no need to further process the constructed second target data table. Instead, the query logic expression can be constructed based on the constructed second target data table.
[0071] Furthermore, embodiments of the present invention also provide a query condition configuration method, which in Figure 1 In the illustrated embodiment, after "determining the query parameters and query data source based on the received query request" in step 101, the specific steps are as follows: Figure 6 As shown, the method further includes:
[0072] Step 601: Determine the number of query data sources based on the determined query data sources.
[0073] Specifically, after executing step 101, based on the determined query data source, the number of query data sources referenced by the actual query parameters is counted. Specifically, when the fields in the query parameters are A, B, and C, the number of query data sources referenced by fields A, B, and C is counted as 3, where field A references query data source A0, field B references query data source B0, and field C references query data source C0.
[0074] Step 602: Determine whether the number of the query data sources is greater than or equal to the threshold.
[0075] Specifically, after executing step 601, the number of actual query data sources determined in step 601 is compared with a threshold to accurately determine whether the number of query data sources is greater than or equal to the threshold. Specifically, in this embodiment, the threshold is preset; preferably, the threshold value is 2. When the number of query data sources determined in step 601 is greater than or equal to 2, it is determined that the number of query data sources is greater than the threshold, and step 603 is executed. When the number of query data sources determined in step 601 is less than 2, step 604 is executed. Those skilled in the art will understand that the threshold in this embodiment can also be other values.
[0076] Step 603: Send a prompt message to the configuration interface.
[0077] Specifically, after executing step 602, if the number of query data sources is greater than or equal to a threshold, a prompt message is sent to the configuration interface to inform the user that some query conditions are missing and that the missing query conditions need to be configured. In this embodiment, when there are three determined query data sources, it checks whether the query conditions corresponding to the associated fields are configured in the configuration interface. If the query conditions corresponding to the associated fields are not configured in the configuration interface, the user is prompted in the configuration interface that the query conditions corresponding to the associated fields are missing; otherwise, no prompt is made in the configuration interface. Specifically, in this embodiment, when sending a prompt message to the user interface, the missing query conditions are highlighted first to prompt the user. Other prompting methods can also be used. This invention does not limit the specific prompting method, as long as it can complete the prompting of the user.
[0078] Step 604: Do not send a prompt message to the configuration interface.
[0079] Specifically, after executing step 602 and determining that the number of query data sources is less than the threshold, the query conditions configured by the user in the configuration interface are not missing, and therefore there is no need to send a prompt message to the configuration interface.
[0080] Furthermore, embodiments of the present invention also provide a method for generating query parameters, which is a method for... Figure 1 The detailed description of step 101 in the illustrated embodiment, "determining the query parameters and query data source based on the received query request," is as follows: Figure 7 The following are included:
[0081] Step 701: Parse the query conditions configured by the user on the query interface according to the query request.
[0082] Specifically, upon receiving a user's query request, the query conditions within the request are parsed. In this embodiment, when the received query request includes three query logics (a, b, and c), the query conditions configured for query logics a, b, and c in the query interface are parsed. After parsing, the query condition corresponding to query logic a is a0, the query condition corresponding to query logic b is b0, and the query condition corresponding to query logic c is c0. By parsing the query logics in the query request to correspond to the query conditions, the user-configured query conditions can be accurately controlled, and a query logic expression corresponding to the query adjustment can be constructed. This effectively improves data query efficiency during data query execution.
[0083] Step 702: Generate a template based on the query parameters and obtain the corresponding field information and identification information from the query conditions.
[0084] The identification information is used to determine the query data source referenced by the field information.
[0085] Specifically, after executing step 701, the parsed query conditions are input into the query parameter generation template to match the field information corresponding to each query condition in the template. Simultaneously, based on the data source referenced by each query condition, identification information corresponding to the query condition is generated to determine the data source referenced by each query condition. Specifically, when obtaining the field information corresponding to the query conditions, the query conditions are input into the query parameter generation template to determine the values corresponding to each query condition, and based on the values, the field information corresponding to each query condition is determined. Similarly, when obtaining the identification information corresponding to the query conditions, the query conditions are input into the query parameter generation template to determine the values corresponding to each query condition, and based on the values, the representation information corresponding to each query condition is determined. The query parameter template is pre-set. Through the query parameter generation template, the query conditions configured by the user in the query interface can be converted into corresponding query parameters. Then, based on the query parameters, corresponding query logic expressions can be constructed, thereby effectively improving data query efficiency during data query execution.
[0086] Step 703: Determine the corresponding query parameters and query data source based on the field information and identifier information.
[0087] Specifically, after executing step 702, the field information and identification information obtained in step 702 are integrated to determine the query parameters corresponding to the query conditions, and the query data source is determined according to the identification information of each query condition determined in step 702. Thus, the corresponding query logic expression is constructed according to the query parameters and the query data source, thereby effectively improving the data query efficiency when executing data queries.
[0088] Furthermore, as mentioned above Figures 1-7 In addition to the implementation of the method embodiments shown, this embodiment of the invention also provides a data query device. This device can directly convert query parameters into query logical expressions and obtain query results by executing the query logical expressions, thereby reducing the complexity of the query and effectively improving the data query efficiency. The embodiment of this device corresponds to the foregoing method embodiments. For ease of reading, this embodiment will not repeat the details of the foregoing method embodiments one by one, but it should be clear that the device in this embodiment can implement all the contents of the foregoing method embodiments. Specifically, as shown... Figure 8 As shown, the device includes:
[0089] The determination module 10 is used to determine the query parameters and the query data source based on the received query request.
[0090] The acquisition module 20 is used to acquire the data to be queried from the data source determined by the determination module 10.
[0091] The construction module 30 is used to construct a query logic expression corresponding to the query parameters based on the query parameters determined by the determination module 10 and the query data obtained by the acquisition module 20.
[0092] The query module 40 is used to obtain query results from the data to be queried based on the query logic expression constructed by the construction module 30.
[0093] Furthermore, such as Figure 9 As shown, the building module 30 also includes:
[0094] The first construction unit 310 is used to construct a first target data table based on the query parameters and the data to be queried.
[0095] The second construction unit 320 is used to construct the second target data table based on the first target data table constructed by the first construction unit 310.
[0096] The third construction unit 330 is used to construct the query logic expression based on the query parameters and the second target data table constructed by the second construction unit 320.
[0097] Furthermore, the first construction unit 310 is also used to parse the query parameters to obtain field information in the query parameters; extract data corresponding to the query fields from the data to be queried based on the field information; and construct the first target data table based on the extracted data.
[0098] Furthermore, the second construction unit 320 is also used to determine whether there is a related field in the field information of the query parameters, the related field being used to associate multiple first target data tables; if it exists, then based on the related field and the multiple first target data tables associated with the related field, a second target data table is constructed; if it does not exist, then the first target data table is determined as the second target data table.
[0099] Furthermore, such as Figure 9 As shown, it also includes a fourth construction unit 340, which is used to: determine whether there is a filter field in the field information; if there is, filter the data in the second target data table according to the filter field to construct a third target data table; and replace the second target data table with the third target data table.
[0100] Furthermore, such as Figure 9 As shown, the data query device also includes a prompting module 50, which includes:
[0101] The statistics unit 510 is used to determine the number of query data sources based on the determined query data sources;
[0102] The judgment unit 520 is used to determine the number of query data sources determined by the unit 510, and to determine whether the number of query data sources is greater than or equal to a threshold.
[0103] The prompting unit 530 is used to send a prompt message to the configuration interface based on the judgment result of the judgment unit 520.
[0104] Furthermore, such as Figure 9 As shown, the determining module 10 also includes:
[0105] The parsing unit 110 parses the query conditions configured by the user on the query interface according to the query request;
[0106] The generation unit 120 generates a template based on the query parameters and obtains the corresponding field information and identification information from the query conditions according to the parsing unit 110. The identification information is used to determine the query data source referenced by the field information.
[0107] The determining unit 130 determines the corresponding query parameters and query data source based on the field information and identification information obtained from the generating unit 120.
[0108] Furthermore, embodiments of the present invention also provide an electronic device, the electronic device including at least one processor, and at least one memory and bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the above-mentioned... Figures 1-7 The data query method described in [the document].
[0109] Furthermore, embodiments of the present invention also provide a storage medium for storing a computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the above-described... Figures 1-7 The data query method described in [the document].
[0110] Furthermore, such as Figure 10 The diagram shown is a block diagram of a device provided in an embodiment of the present invention. The device 400 includes at least one processor 401, at least one memory 402 connected to the processor 401, and a bus 403; wherein the processor 401 and the memory 402 communicate with each other via the bus 403. The processor 401 is used to call program instructions in the memory 402 to execute the aforementioned data sharing method. The device described herein can be a server (e.g., a local server or a cloud server), a smartphone, tablet computer, PDA, portable computer, or a fixed terminal such as a desktop computer.
[0111] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0112] It is understood that the relevant features in the above methods and apparatus can be referenced interchangeably. Furthermore, the terms "first," "second," etc., in the above embodiments are used to distinguish between embodiments and do not represent the superiority or inferiority of any particular embodiment.
[0113] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0114] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0115] In addition, the memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0116] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0117] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams.Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0120] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0121] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0122] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0123] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0124] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0125] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. A data query method, characterized in that, The method includes: Based on the received query request, determine the query parameters and the query data source; The query parameters are used to obtain the data to be queried from the query data source; Based on the query parameters and the data to be queried, construct a query logic expression corresponding to the query parameters; The query results are obtained from the data to be queried based on the query logic expression. The step of constructing a query logic expression corresponding to the query parameters based on the data to be queried includes: Based on the query parameters and the data to be queried, a first target data table is constructed. Based on the first target data table, a second target data table is constructed, wherein the second target data table includes at least one of the first target data tables; Based on the query parameters, the query logic expression is constructed according to the second target data table; The step of constructing a first target data table based on the query parameters and the data to be queried includes: Parse the query parameters to obtain the field information in the query parameters; Based on the field information, extract the data corresponding to the query field from the data to be queried; Based on the extracted data, construct the first target data table; The step of constructing a second target data table based on the first target data table includes: Determine whether there is a related field in the field information of the query parameters, wherein the related field is used to associate multiple first target data tables; If it exists, then based on the associated field, construct the second target data table based on the multiple first target data tables associated with the associated field; If it does not exist, then the first target data table will be designated as the second target data table.
2. The method according to claim 1, characterized in that, After constructing the second target data table based on the first target data table according to the associated fields, the method further includes: Determine whether a filter field exists in the field information; If it exists, then filter the data in the second target data table according to the filter field to construct the third target data table; Replace the second target data table with the third target data table.
3. The method according to claim 1, characterized in that, After determining the query parameters and query data source based on the received query request, the method further includes: Based on the identified query data sources, determine the number of query data sources; Determine whether the number of the query data sources is greater than or equal to the threshold; If so, a prompt message will be sent to the configuration interface.
4. The method according to claim 1, characterized in that, The step of determining the query parameters and query data source based on the received query request includes: The query conditions configured by the user on the query interface are parsed according to the query request; A template is generated based on the query parameters, and the corresponding field information and identification information are obtained from the query conditions. The identification information is used to determine the query data source referenced by the field information. Based on the field information and identifier information, determine the corresponding query parameters and query data source.
5. A data query device, characterized in that, The device includes: The determination module is used to determine the query parameters and query data source based on the received query request; The acquisition module is used to acquire the data to be queried from the query data source using the query parameters; The construction module is used to construct a query logic expression corresponding to the query parameters based on the data to be queried; The query module is used to obtain query results from the data to be queried based on the query logic expression; Specifically, the building module is used for: Based on the query parameters and the data to be queried, a first target data table is constructed. Based on the first target data table, a second target data table is constructed, wherein the second target data table includes at least one of the first target data tables; Based on the query parameters, the query logic expression is constructed according to the second target data table; Specifically, the building module is used for: Parse the query parameters to obtain the field information in the query parameters; Based on the field information, extract the data corresponding to the query field from the data to be queried; Based on the extracted data, construct the first target data table; Specifically, the building module is used for: Determine whether there is a related field in the field information of the query parameters, wherein the related field is used to associate multiple first target data tables; If it exists, then based on the associated field, construct the second target data table based on the multiple first target data tables associated with the associated field; If it does not exist, then the first target data table will be designated as the second target data table.
6. A storage medium comprising a stored program, wherein, When the program is running, it controls the device containing the storage medium to execute the data query method according to any one of claims 1 to 4.
7. An electronic device, the electronic device comprising at least one processor, and at least one memory and a bus connected to the processor; wherein, The processor and memory communicate with each other via a bus; The processor is used to invoke program instructions in memory to execute the data query method according to any one of claims 1 to 4.