Data query method and device, equipment and medium

By receiving the target query identification and input in the data query method and device, the query pipeline is automatically determined and multiple query nodes are queried, which solves the problem of low efficiency of multi-database query in the prior art, and an efficient and automated query process is realized.

CN120179681APending Publication Date: 2025-06-20AVATR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510247506.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

The existing technology cannot realize automated cross-system query of multiple databases, resulting in low query efficiency, and requires manual sorting out query logic and querying multiple databases separately.

Method used

By providing a data query method and device, the method receives the target query identification and target input, determines the target query pipeline based on the target query identification, including multiple query nodes and query relationships, and automatically query multiple query nodes, obtains target information and outputs query results.

Benefits of technology

Automatic multi-database query is realized, query efficiency is improved, manual participation and data transmission is reduced, and transmission efficiency and automation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179681A_ABST
    Figure CN120179681A_ABST
Patent Text Reader

Abstract

The invention discloses a data query method and device, equipment and a medium. The method is applied to a called party. The method at least comprises the steps of receiving a target query identifier and target input sent by a calling party; the target query identifier is used for pointing to a target query pipeline for querying target information in a plurality of databases according to the target input; based on the target query identifier, determining a target query pipeline pointed by the target query identifier; the target query pipeline comprises a plurality of query nodes and a query relationship among the plurality of query nodes; one query node is used for carrying out one query on one database in the plurality of databases; querying a plurality of query nodes in a target query pipeline based on the target input and the target query pipeline to obtain target information; outputting a target query result corresponding to the target information to the calling party; the target query result at least comprises the target information. According to the scheme, the query efficiency is improved, and the automation degree is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, including but not limited to data query methods, devices, equipment, and media. Background Art

[0002] With the rapid development of Internet technology, there are more and more databases, and the application of query scenarios is also increasing. Among them, some queries need to be implemented between multiple databases and cross-system queries are required.

[0003] In the current solutions, automatic query cannot be achieved. For queries of multiple databases, generally, the queries between multiple databases are independent. It is necessary to manually sort out the query logic, then query multiple databases separately, and finally obtain the query results. The entire query process is inefficient. Summary of the Invention

[0004] To solve the above problems, this application provides at least data query methods, devices, equipment, and media products, which improve the query efficiency and have a high degree of automation.

[0005] The technical solution of this application is implemented as follows:

[0006] In a first aspect, this application provides a data query method, which is applied to the callee; the method includes:

[0007] Receiving a target query identifier and a target input sent by a caller; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input;

[0008] Based on the target query identifier, determining the target query pipeline pointed to by the target query identifier; the target query pipeline includes a plurality of query nodes and the query relationships between the plurality of query nodes; one query node is used to point to a single query of one of the multiple databases;

[0009] Querying the multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain the target information;

[0010] Outputting a target query result corresponding to the target information to the caller; the target query result includes at least the target information.

[0011] In a second aspect, this application provides a data query device, which is deployed on the callee, and the device includes:

[0012] A receiving unit, configured to receive a target query identifier and a target input sent by a caller; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input;

[0013] A determination unit for determining a target query pipeline pointed to by a target query identifier based on the target query identifier; the multiple query nodes included in the target query pipeline and the query relationships between the multiple query nodes; one query node is used to point to a query of one of multiple databases once.

[0014] A query unit for querying multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain target information.

[0015] An output unit for outputting a target query result corresponding to the target information to a caller; the target query result includes at least the target information.

[0016] In a third aspect, the present application provides an electronic device, which includes a memory and a processor. A computer program or instruction is stored on the memory. When the computer program or instruction is executed by the processor, the data query method provided in the first aspect is implemented.

[0017] In a fourth aspect, the present application further provides a storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed by the processor, any of the data query methods provided in the first aspect is implemented.

[0018] In a fifth aspect, the present application further provides a computer program product, which includes a computer program or instruction. When the computer program or instruction is executed by the processor, any of the data query methods provided in the first aspect is implemented.

[0019] The data query solution provided by the present application includes but is not limited to data query methods, devices, equipment, storage media, and program products. For this data query solution, first, it can directly receive the target query identifier and target input sent by the caller for querying. The query content can be perceived through the target query identifier, without the need for the user to send specific query content, saving the data transmission volume between the caller and the callee and improving the transmission efficiency. Second, the caller can determine the target query pipeline according to the target query identifier. Since the target query pipeline includes multiple query nodes and the query relationships between the multiple query nodes, the caller can obtain the query nodes and query logic through the target query identifier, and the implementation process does not require manual participation and has a high degree of automation. Third, the caller can independently query multiple query nodes according to the target input and the target query pipeline to obtain the target information and then output the target query result including the target information. The query process between the multiple query nodes is automatically implemented by the caller, and the query process only queries multiple nodes in the target query pipeline, with high query efficiency. Description of the Drawings

[0020] Figure 1An optional schematic diagram of the application scenario for data query provided by the embodiments of the present application;

[0021] Figure 2 The first optional flowchart of the data query method provided by the embodiments of the present application;

[0022] Figure 3 The second optional flowchart of the data query method provided by the embodiments of the present application;

[0023] Figure 4 The third optional flowchart of the data query method provided by the embodiments of the present application;

[0024] Figure 5 The fourth optional flowchart of the data query method provided by the embodiments of the present application;

[0025] Figure 6 The fifth optional flowchart of the data query method provided by the embodiments of the present application;

[0026] Figure 7 An optional structural diagram of the data query system provided by the embodiments of the present application;

[0027] Figure 8 An optional structural diagram of the data query device provided by the embodiments of the present application;

[0028] Figure 9 An optional structural diagram of the electronic device provided by the embodiments of the present application. Detailed implementation manners

[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will further describe the specific technical solutions of the application in detail in conjunction with the accompanying drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not used to limit the scope of the present application.

[0030] In the following description, "some embodiments" are involved, which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0031] In the following description, the terms "first / second / third" involved are only used to distinguish different objects and do not represent a specific order for the objects, and there is no limitation on the order of precedence. It can be understood that "first / second / third" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms used herein are for the purpose of describing embodiments of this application only and are not intended to limit this application.

[0033] Embodiments of this application provide a data query method, apparatus, device, storage medium, and program product. In practical applications, the data query method can be implemented by a data query apparatus, and each functional entity in the data query apparatus can be implemented in cooperation with the hardware resources (such as computing resources such as a processor and communication resources) of an electronic device.

[0034] Next, the application scenarios of the data query provided by the embodiments of this application will be described.

[0035] Refer to Figure 1 the content shown, including a caller 10 and a callee 20. Communication can occur between the caller 10 and the callee 20.

[0036] The caller 10 is used to send a target query identifier and a target input to the callee 20.

[0037] The callee 20 is used to: receive the target query identifier and the target input sent by the caller; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input; determine the target query pipeline pointed to by the target query identifier based on the target query identifier; the target query pipeline includes multiple query nodes and the query relationships between the multiple query nodes; one query node is used to point to a single query of one of the multiple databases; query the multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain the target information; output the target query result corresponding to the target information to the caller; the target query result includes at least the target information.

[0038] The number of callers 10 in the embodiments of this application is not limited and can be configured according to actual needs. The caller 10 here can be one or multiple.

[0039] The caller 10 and the callee 20 are electronic devices with relevant data processing capabilities.

[0040] In one example, the caller 10 and the callee 20 can be different microservices.

[0041] Among them, the caller 10 and the callee 20 can be integrated on one electronic device or independently deployed on different electronic devices.

[0042] Next, the embodiments of the data query method, apparatus, device, storage medium, and program product provided by the embodiments of this application will be described.

[0043] In a first aspect, an embodiment of the present application provides a data query method, which is applied to a data query device. The functions implemented by this method can be achieved by an electronic device calling program code. Of course, the program code can be stored in a computer storage medium. It can be seen that the electronic device at least includes a processor and a processor.

[0044] Next, taking the callee as the execution subject, the data query method provided by the embodiment of the present application will be described.

[0045] Specifically, referring to Figure 2 the content shown, this process may include but is not limited to the following S201 to S204.

[0046] S201. The callee receives the target query identifier and the target input sent by the caller.

[0047] The target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input.

[0048] Among them, for different query identifiers, different query functions correspond. For example, query identifier 001 corresponds to the function of querying consumption amount according to name. For example, query identifier 002 corresponds to querying employee salary and employee mobile phone number according to employee number.

[0049] The target query identifier can be any query identifier sent by the caller. The query identifier can be a combination of numbers, letters, etc. The embodiment of the present application does not limit the definition method of the query identifier and can be configured according to actual needs.

[0050] One query identifier is used to point to one query pipeline. The query pipeline includes multiple query nodes and the query relationships between multiple query nodes.

[0051] The target input refers to all input data of the current query sent by the caller.

[0052] In a possible implementation manner, the target input includes: input parameter values.

[0053] In another possible implementation manner, the target input includes: input parameter values and constraint conditions of query nodes.

[0054] The target input may also include other contents, such as the target output format, etc., which will not be listed one by one here.

[0055] S201 can be implemented as: the callee receives the target query identifier and the target input sent by the caller according to the communication connection between the caller and the callee.

[0056] S202. The callee determines a target query pipeline pointed to by the target query identifier based on the target query identifier.

[0057] The target query pipeline includes multiple query nodes and the query relationships between the multiple query nodes; one query node is used to point to a query of one of multiple databases.

[0058] The embodiment of the present application does not limit the format of the target query pipeline, which can be configured according to actual needs. For example, the target query pipeline can be in the format of a schematic diagram, a text expression, or a format combining a schematic diagram and a text expression, a table format, etc.

[0059] The query relationship is used to represent the logical relationship between multiple query nodes. The query relationship here can include but is not limited to: a parallel query relationship and a serial query relationship. In the parallel query relationship, multiple query nodes are juxtaposed, and each query node has its own input and output; in the serial query relationship, multiple query nodes are in series, and the output of the previous query node is the input of the next query node.

[0060] One query node is used to point to a query of one of multiple databases. For example, query node 1 can point to a query of database 1 in sequence, and query node 2 can point to a query of database 2 in sequence.

[0061] Different query identifiers correspond to different query functions, different query logics, that is, different query pipelines. Therefore, the query identifier is pre-bound to the corresponding query pipeline, and then the callee can determine the query pipeline bound by the target query identifier based on the target query identifier as the target query pipeline.

[0062] S203. The callee queries multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain target information.

[0063] S203 can be implemented as: the callee first determines multiple query nodes in the target query pipeline and the query relationships between the respective query nodes, and then performs multiple queries on the multiple query nodes in the target query pipeline according to the query relationship to obtain target information.

[0064] S204. The callee outputs a target query result corresponding to the target information to the caller.

[0065] The target query result at least includes the target information. The embodiment of the present application does not limit the content of the target query result, which can be configured according to actual needs.

[0066] In a possible implementation manner, the target query result includes the target information.

[0067] In another possible implementation, the target query result may include target information and a target input.

[0068] The target query result may further include other content, such as query nodes, etc., which will not be enumerated one by one here.

[0069] The embodiments of the present application do not limit the output format of the target query result, which can be configured according to actual requirements.

[0070] In one possible implementation, the output format of the target query result may be fixed, or alternatively, different output formats of the target query result may be configured according to different target query identifiers.

[0071] The data query method provided in this embodiment is applied to the callee. The method at least includes: receiving a target query identifier and a target input sent by the caller; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input; determining the target query pipeline pointed to by the target query identifier based on the target query identifier; the target query pipeline includes multiple query nodes and the query relationships between the multiple query nodes; one query node is used to point to querying one of the multiple databases once; querying the multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain the target information; outputting the target query result corresponding to the target information to the caller; the target query result at least includes the target information. This solution improves the query efficiency.

[0072] For this data query method, first, it is possible to directly receive the target query identifier and the target input sent by the caller for querying. Through the target query identifier, the query content can be perceived without the user sending specific query content, saving the data transmission volume between the caller and the callee and improving the transmission efficiency. Second, the callee can determine the target query pipeline according to the target query identifier. Since the target query pipeline includes multiple query nodes and the query relationships between the multiple query nodes, the callee can obtain the query nodes and the query logic through the target query identifier, and the implementation process does not require manual participation and has a high degree of automation. Third, the callee can independently query the multiple query nodes according to the target input and the target query pipeline to obtain the target information and then output the target query result including the target information. The query process between the multiple query nodes is automatically implemented by the callee, and the query process only queries the multiple nodes in the target query pipeline, so the query efficiency is relatively high.

[0073] Next, the process in which the callee in S203 queries the multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain the target information will be described.

[0074] Reference Figure 3 Referring to the content shown, the process may include but is not limited to the following S2031 to S2033.

[0075] S2031. The callee parses the target query pipeline to obtain multiple query nodes and the query relationships between the multiple query nodes.

[0076] The callee parses the target query pipeline through the definition rules of the query pipeline, so as to obtain multiple query nodes and the query relationships between the multiple query nodes.

[0077] For example, the target query pipeline may include: query node 1--query node 2--query node 3; where query node 1 represents performing a query on database 1, query node 2 represents performing a query on database 2, and query node 3 represents performing a query on database 3. Query node 1, query node 2, and query node 3 are in series in sequence.

[0078] For another example, the target query pipeline may include: query node 1 / query node 2 / query node 3; where query node 1 represents performing a query on database 1, query node 2 represents performing a query on database 2, and query node 3 represents performing a query on database 3. Query node 1, query node 2, and query node 3 are in a parallel relationship.

[0079] S2032. In the case where the query relationship is a parallel query relationship, the callee respectively determines the output of each query node among the multiple query nodes based on the target input; and combines the outputs of the multiple query nodes to obtain the target information.

[0080] In the case where the query relationship is a parallel query relationship, the callee respectively determines the output of each query node among the multiple query nodes based on the target input, traverses each query node in the target query pipeline to obtain the outputs of the multiple query nodes, and then combines the outputs of the multiple query nodes to obtain the target information.

[0081] S2033. In the case where the query relationship is a serial query relationship, the callee determines the node order between the multiple query nodes; sequentially determines the output of each query node among the multiple query nodes according to the node order based on the target input; and determines the output of the last query node among the multiple query nodes as the target information.

[0082] In the case where the query relationship is a serial query relationship, the callee determines the node order among multiple query nodes; for each query node among the multiple query nodes in sequence according to the node order, the output of the query node is determined based on the target input; for example, first determine the first query node, obtain the output of the first query node, use the output of the first query node as the input of the second query node, then determine the output of the second query node, and so on in a loop until the output of the last query node is obtained, and the output of the last query node is determined as the target information.

[0083] In this embodiment, various scenarios can be queried to obtain the target information. For example, queries of multiple serial query nodes or multiple parallel query nodes can be implemented, expanding the application scope, meeting the requirements of various user scenarios, and providing a high user experience.

[0084] Next, the process of determining the output of the query node based on the target input in S2032 and S2033 will be described.

[0085] Refer to Figure 4 The content shown. This process may include but is not limited to the following S401 to S405.

[0086] S401. The callee determines the type of the database corresponding to the query node.

[0087] Here, the type of the database is not limited and can be configured according to actual needs.

[0088] The database type may include but is not limited to: relational database, non-relational database, etc.

[0089] Relational databases may include: MySQL, Oracle Database, Microsoft SQL Server, PostgreSQL, etc.

[0090] Non-relational databases may include: document databases (such as MongoDB), key-value databases (such as Redis), column family databases (such as Apache Cassandra), graph databases (such as Neo4j), etc.

[0091] Since one query node corresponds to a query of one database. Therefore, after obtaining the query node, the database corresponding to the query node can be determined, and then the type of the database can be determined. For example, for query node 1, the corresponding database is the salary database, and the database type is Redis.

[0092] S402. The callee obtains the query statement template of the query node based on the type of the database.

[0093] Due to the different types of databases, the corresponding storage rules are different, and the corresponding query statement templates are different.

[0094] After determining the type of the database corresponding to the query node, the callee directly calls the query statement template of this type among multiple query statement templates.

[0095] S403. The callee determines the input of the query node based on the target input.

[0096] The input of the query node can be the target input or the output of the previous query node.

[0097] Here, the inputs of the query nodes in the serial relationship and the parallel relationship may be the same or different, which will not be elaborated here.

[0098] The input of the query node is the input parameter value of the query node.

[0099] For example, for query node 1, the corresponding database is the salary database, and the input parameter value of this query node 1 can be the employee name value.

[0100] S404. The callee fills at least the input of the query node into the query statement template to obtain the query statement of the query node.

[0101] Of course, other information can also be filled into the query statement template to update the query statement of this query node.

[0102] S405. The callee queries the database corresponding to the query node through the query statement of the query node to obtain the output of the query node.

[0103] The callee queries the database corresponding to the query node through the query statement of the query node, searches for the output field corresponding to the input of this query node, and determines the value of the output field as the output of this query node.

[0104] In this embodiment, multiple query nodes need to query multiple databases. Considering the situation that the query statement models of different types of databases are different, different query statement templates are obtained for different types of databases, and then the input is filled to obtain the query statement for querying, so as to obtain the output of the query node; it can meet the queries of various database types, and the implementation logic is concise, reliable, and has a large scope.

[0105] Next, the process by which the callee determines the input of the query node based on the target input in S403 will be described.

[0106] If the query node is a query node in a parallel query relationship, the input parameter value in the target input is determined as the input of the query node; if the query node is the first query node in a serial query relationship, the input parameter value in the target input is determined as the input of the query node; if the query node is a query node other than the first query node in a serial query relationship, the output of the previous query node of the query node is determined as the input of the query node.

[0107] In this embodiment, the input of the query node in various cases is defined, which can meet the requirements of various scenarios.

[0108] Next, the process in which the callee fills at least the input of the query node into the query statement template in S404 to obtain the query statement of the query node will be described.

[0109] In a possible implementation manner, the input of the query node is filled into the query statement template to obtain the query statement of the query node.

[0110] In another possible implementation manner, the input of the query node and the constraint condition of the query node are filled into the query statement template to obtain the query statement of the query node; the target input includes the constraint condition of the query node.

[0111] The embodiment of the present application does not limit the content of the constraint condition, which can be configured according to actual needs.

[0112] In a possible implementation manner, the constraint condition can be a time constraint condition, a level constraint condition, etc. For example, the constraint condition can include: from October 1, 2024 to January 20, 2025. For example, the constraint condition can be: the level is between the third level and the fifth level.

[0113] In this embodiment, the query statement can be configured according to actual needs, which can achieve more accurate search and high user experience.

[0114] Next, the process in which the callee outputs the target query result corresponding to the target information to the caller in S204 will be described.

[0115] Refer to Figure 5 As shown in the content, this process may include but is not limited to the following S2041 and S2042.

[0116] S2041. The callee determines the target output format of the target query result based on the target query identifier.

[0117] The output format may include: voice output format, document output format, graph output format, etc.

[0118] Different query identifiers may correspond to different output formats. The callee determines, based on the target query identifier, that the output format corresponding to the target query identifier is the target output format of the target query result.

[0119] S2042. After organizing the target query result into the target output format, the callee outputs it to the caller.

[0120] After obtaining the target output format, the callee organizes the target query result, outputs the target query result after organizing it into the target output format to the caller.

[0121] In this embodiment, the target output format can be configured according to actual needs, so as to meet the output requirements of various formats.

[0122] Next, the process of determining the target query identifier and sending the target query identifier will be described.

[0123] In one embodiment, before executing the above S201, first execute Figure 6 the S601 to S605 shown.

[0124] S601. The callee obtains the fields of each database in multiple databases.

[0125] For example, the fields of database 1 include: employee number, employee name.

[0126] For example, the fields of database 2 include: employee name, employee salary.

[0127] For example, the fields of database 3 include: employee name, employee address.

[0128] S602. The callee determines a target query pipeline for querying the target information according to the target input based on the target input, the target information, and the fields of each database.

[0129] Based on the target input, the target information, and the fields of each database, the callee analyzes which database fields are related to the target input and the target information, obtains the input database, the target database, and there may also be intermediate databases, and then determines the corresponding query nodes in sequence from the input database, the target database, and the intermediate databases, so as to obtain the target query pipeline.

[0130] For example, when the target input is employee number 0123 and the target information is employee salary, it is determined that the target query pipeline includes serial query nodes 1 and 2, where query node 1 is used to query in database 1 and query node 2 is used to query in database 2.

[0131] S603. The callee generates a target query identifier based on the target query pipeline.

[0132] The generation algorithm of the target query identifier can be configured according to actual requirements and is not uniquely limited here. For example, a random algorithm can be adopted, or the target query identifier can be generated according to keyword definitions or other methods.

[0133] S604. The callee binds the target query identifier to the target query pipeline.

[0134] The embodiments of the present application do not limit the specific binding method, which can be configured according to actual requirements. For example, binding can be performed through a table, or through a connection line in a figure, or through a text description.

[0135] S605. The callee sends at least the target query identifier to the caller.

[0136] Of course, the callee can send the function description corresponding to the target query identifier to the caller so that the caller can quickly understand the query function corresponding to the target query identifier.

[0137] In this embodiment, the target query pipeline is obtained by analyzing the target input, target information, and fields of each database, and the target query identifier corresponding to the target query pipeline is generated. By only sending the target query identifier to the caller, the caller can perceive the query function of the callee, with a high degree of automation and a small data transmission volume.

[0138] In practice, the callee can configure many query identifiers according to actual requirements and send the query identifiers to the callers related to the query functions of the query identifiers. The specific implementation process is similar to that of the target query identifier and will not be listed one by one here.

[0139] Next, taking the caller and the callee as different microservices as an example, the data query solution provided by the present application will be described.

[0140] In an enterprise information system, according to the 80 / 20 principle, 80% of the traffic belongs to query traffic, and only a small part of the traffic needs to process data addition, deletion, and modification. Among the 80%, the vast majority are very simple queries. For example, querying a user's mobile phone number according to the user identity document (ID), or querying the user's ID according to the user's mobile phone number, performing simple queries from multiple dimensions of the data itself. If a new simple query interface is encountered, it often needs to go through a series of steps such as coding, testing, and going online. In fact, for such simple query logics, some components can be used to handle them, so that coding is not required and only configuring query rules can meet the requirements.

[0141] The technical components of this embodiment mainly include three parts: one part is the query statement configuration platform, the second part is the microservice data source, and the third part is the query configuration software development kit (SDK).

[0142] First, developers configure relevant query statements on the query statement configuration platform. After the configuration is completed, a unique ID (equivalent to the above-mentioned query identifier) will be generated and provided to the caller. When the caller calls the microservice that needs to be called, the ID is passed to the callee. The callee then queries the statement content according to the ID, calls different databases according to different statement contents, and finally encapsulates the results of the query statements (equivalent to the above-mentioned target query results) and returns them to the caller.

[0143] Reference Figure 7 As shown in the content, the query system may include a first microservice 701, a second microservice 702, a mysql database 703, a redis database 704, an es database 705, and a query configuration service 706.

[0144] The second microservice 702 includes: a query configuration SDK 7021, a mysql client 7022, a redis client 7023, and an es client 7024. Among them:

[0145] The query configuration service 706 is used to: configure query statement templates for different databases.

[0146] The first microservice 701 is used to initiate a query request, and the query request includes a target query identifier and a target input.

[0147] The query configuration SDK 7021 is used to: receive the query request and call the mysql client 7022, the redis client 7023, and the es client 7024 based on the query request, so as to implement the query of the mysql database 703, the redis database 704, and the es database 705.

[0148] For the callee (the second microservice 702), it is necessary to access the query configuration SDK, and this microservice has data source information for querying data content.

[0149] Developers configure query statements in the query configuration background, and the configuration of the statements needs to pay attention to the following contents.

[0150] Query node. A query node represents a query statement, and each query node has input and output parameters of the parameters.

[0151] Pipeline. Multiple query nodes can form a pipeline, and the parameter query result of the previous node can be used as the input parameter of the second query node.

[0152] Input parameter. The input parameter refers to the content queried by this query statement.

[0153] Output parameter. The output parameter is the result queried by a query statement.

[0154] Statement. The statement is composed of a template statement, which is dynamically rendered by the template engine according to the input parameter during the execution process.

[0155] Return result. After the pipeline execution is completed, it is necessary to encapsulate the result into the final return result from the query node.

[0156] Data source: That is, from which database to fetch data.

[0157] After these contents are configured, a unique ID (equivalent to the above query identifier) will be generated to represent this query configuration.

[0158] The callee, according to the ID, obtains the query configuration statement. The query configuration SDK starts to parse the rules therein and executes from the first node in the pipeline manner. It obtains the input parameter to fill the rendering statement template to get the finally required statement, hands the statement to the data source, obtains the query result, assembles the output parameter, and hands it to the next node for execution. After the execution of the entire node is completed, according to the rules of the return result, it is encapsulated into the final result and returned to the caller.

[0159] For example, assume that Service A calls Service B, and the content to be queried is to query the user's mobile phone number based on the user's ID, as well as the payment amount in the orders from August to December this year. Assume that the mobile phone number is stored in Redis, and the order information is stored in MySQL. The query configuration has a pipeline and two query nodes, and the configuration content is as follows:

[0160]

[0161]

[0162]

[0163] For a query, a global ID needs to be configured for it. This ID can be generated by a unique ID generator or manually input by oneself, as long as it is unique. In addition, a name also needs to be given to this configuration, as long as it is meaningful.

[0164] Next is the configuration of the query node:

[0165] Call the entire query process a pipeline. A pipeline can contain multiple query statements, and each query statement interacts with the database once.

[0166] The entire query may access the database multiple times, and each query requires configuration. Each database query is called a query node. Therefore, the configuration that each node should have includes: input parameters, output parameters, database information, and execution statements. When configuring each node, it is necessary to select the type of database queried by the current node. The second step is to configure the input parameters of the query statement, which can be the query result of the previous node or the input parameter of the interface. The third step is to configure the statement template of the query statement. In actual operation, the statement template needs to combine the input parameters to dynamically generate the final execution statement.

[0167] Next, configure the next node until the last node is configured.

[0168] After the node configuration is completed, it is necessary to encapsulate the query results and convert the results of each node for return to the caller.

[0169] The query process for multiple database nodes can refer to the following description

[0170] The input parameters include:

[0171] {

[0172] "userID": "abcdef",

[0173] "startTime": "2024-01-01 00:00:00"

[0174] "endTime": "2024-11-01 00:00:00"

[0175] }

[0176] First, the developer configures the entire query, and the configuration process is as analyzed above.

[0177] Next, the caller calls the interface according to the configuration ID. Service B obtains the pipeline and node information to be executed from the configuration service based on the configuration ID and starts execution from the first one. First, execute the 9a5d408f-1 node information. First, parse the param information, obtain the userID information from the query, and assign the value to the alias userID. According to the input parameters and the statement template, render the actual redis statement as: get abcdef. Execute the finally generated statement to obtain the execution result {"phone": "13811111111"}. Parse the phone information in the final execution result.

[0178] Next is to parse the second node and find the parameters from the input parameter information. Parse the template engine, execute the SQL: select order_no, amount from orders where phone = 13811111111 and pay_time >= ’2024-01-01 00:00:00’ and pay_time <= ‘2024-11-01 00:00:00’. Return the result of the final execution.

[0179] After all processes are executed, execute the method of resultSet, that is, parse and encapsulate the results of each node execution and return them to the caller.

[0180] The results can be referred to the following program content.

[0181]

[0182] In a second aspect, an embodiment of the present application provides a data query device, as Figure 8 shown, the data query device 80 includes: a receiving unit 801, a determining unit 802, a query unit 803, and an output unit 804.

[0183] Wherein:

[0184] The receiving unit 801 is configured to receive a target query identifier and a target input sent by a calling party; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input;

[0185] The determining unit 802 is configured to determine, based on the target query identifier, the target query pipeline pointed to by the target query identifier; the target query pipeline includes a plurality of query nodes and the query relationships between the plurality of query nodes; one query node is used to point to a query of one of the multiple databases;

[0186] The query unit 803 is configured to query the multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain the target information;

[0187] The output unit 804 is configured to output a target query result corresponding to the target information to the calling party; the target query result includes at least the target information.

[0188] In some embodiments, the query unit 803 is further configured to: parse the target query pipeline to obtain a plurality of query nodes and the query relationships between the plurality of query nodes; in the case where the query relationship is a parallel query relationship, for each query node in the plurality of query nodes, determine the output of the query node based on the target input; and merge the outputs of the plurality of query nodes to obtain the target information; in the case where the query relationship is a serial query relationship, determine the node order between the plurality of query nodes; sequentially for each query node in the plurality of query nodes according to the node order, determine the output of the query node based on the target input; and determine the output of the last query node in the plurality of query nodes as the target information.

[0189] In some embodiments, the query unit 803 is further configured to: determine the type of the database corresponding to the query node; obtain the query statement template of the query node based on the type of the database; determine the input of the query node based on the target input; at least fill the input of the query node into the query statement template to obtain the query statement of the query node; and query the database corresponding to the query node through the query statement of the query node to obtain the output of the query node.

[0190] In some embodiments, the query unit 803 is further configured to: if the query node is one of the query nodes in the parallel query relationship, determine the input parameter value in the target input as the input of the query node; if the query node is the first query node in the serial query relationship, determine the input parameter value in the target input as the input of the query node; if the query node is a query node other than the first query node in the serial query relationship, determine the output of the previous query node of the query node as the input of the query node.

[0191] In some embodiments, the query unit 803 is further configured to: fill the input of the query node into the query statement template to obtain the query statement of the query node; or, fill the input of the query node and the constraint condition of the query node into the query statement template to obtain the query statement of the query node; the target input includes the constraint condition of the query node.

[0192] In some embodiments, the output unit 804 is further configured to: determine the target output format of the target query result based on the target query identifier; and output the target query result to the caller after organizing it into the target output format.

[0193] In some embodiments, the data query device 80 may further include a preprocessing unit, and the preprocessing unit is configured to: obtain the fields of each database in the plurality of databases; determine a target query pipeline for querying the target information according to the target input based on the target input, the target information, and the fields of each database; generate a target query identifier based on the target query pipeline; and bind the target query identifier to the target query pipeline; at least send the target query identifier to the caller.

[0194] It should be noted that the data query device provided in the embodiments of the present application, including each unit included therein, can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; during the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Micro Processor Unit), a digital signal processor (DSP, Digital Signal Processor), or a field programmable gate array (FPGA), etc.

[0195] The description of the above device embodiments is similar to that of the above method embodiments and has similar beneficial effects to those of the method embodiments. For the technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.

[0196] It should be noted that in the embodiments of the present application, if the above vehicle driving control method is implemented in the form of software function modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the various embodiments of the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), magnetic disks, or optical discs, etc., all of which can store program codes. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0197] In a third aspect, the embodiments of the present application provide an electronic device, which can implement the data query method provided in the first aspect above.

[0198] In an example, referring to Figure 9 the content shown in the figure, the electronic device 90 includes: a processor 901, at least one communication bus 902, a user interface 903, at least one external communication interface 904, and a memory 905. Among them, the communication bus 902 is configured to implement connection communication between these components. Among them, the user interface 903 can include a display screen, a keyboard, etc., and the external communication interface 904 can include a standard wired interface and a wireless interface.

[0199] The memory 905 is configured to store instructions and applications executable by the processor 901, and can also cache data to be processed or already processed by the processor 901 and each module in the electronic device (for example, image data, audio data, voice communication data, and video communication data), and can be implemented by flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0200] In a fourth aspect, an embodiment of the present application provides a storage medium, that is, a computer-readable storage medium, on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps in any of the data query methods provided in the first aspect of the above embodiments are implemented.

[0201] In a fifth aspect, an embodiment of the present application provides a computer program product. The computer program product includes a computer program or instruction. When the computer program or instruction is executed by a processor, the steps in any of the data query methods provided in the first aspect of the above embodiments are implemented.

[0202] It should be noted here that: The descriptions of the embodiments of the above storage medium, device, apparatus, and program product are similar to the descriptions of the above method embodiments and have beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the embodiments of the storage medium, device, apparatus, and program product of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.

[0203] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in some embodiments" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in various embodiments of the present application, the order numbers of the above processes do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0204] It should be noted that in this text, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "including a..." does not exclude the presence of additional identical elements in the process, method, article or device including such element.

[0205] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division. In actual implementation, there may be other division methods, such as multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. Additionally, the couplings, direct couplings, or communication connections between the various components shown or discussed can be through some interfaces. The indirect couplings or communication connections of devices or units can be electrical, mechanical, or other forms.

[0206] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0207] In addition, in each embodiment of this application, the various functional units can all be integrated in one processing unit, or each unit can be a separate unit individually, or two or more units can be integrated in one unit; the above-mentioned integrated units can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.

[0208] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: various media such as removable storage devices, read-only memory (ROM), magnetic disks, or optical discs that can store program codes.

[0209] Alternatively, if the above integrated units of the present application are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the related technology can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as removable storage devices, ROMs, magnetic disks, or optical discs.

[0210] The above are only the implementation manners of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A data query method, characterized in that: The method is applied to the called party, and the method comprises: Receive a target query identifier and a target input sent by a caller; the target query identifier is used to point to a target query pipeline that queries target information in multiple databases according to the target input; Based on the target query identifier, determining a target query pipeline pointed to by the target query identifier; the target query pipeline includes a plurality of query nodes and a query relationship between the plurality of query nodes; a query node is used to point to a query on one of the plurality of databases; Based on the target input and the target query pipeline, query multiple query nodes in the target query pipeline to obtain target information; Outputting a target query result corresponding to the target information to the caller; the target query result at least includes the target information.

2. The method according to claim 1, characterized in that The step of querying multiple query nodes in the target query pipeline based on the target input and the target query pipeline to obtain target information includes: Parsing the target query pipeline to obtain multiple query nodes and query relationships between the multiple query nodes; In the case where the query relationship is a parallel query relationship, for each of the multiple query nodes, determining the output of the query node based on the target input; and merging the outputs of the multiple query nodes to obtain the target information; In the case where the query relationship is a serial query relationship, determine a node order between the multiple query nodes; determine an output of the query node based on the target input for each of the multiple query nodes in turn according to the node order; and determine the output of the last query node among the multiple query nodes as the target information.

3. The method according to claim 2, characterized in that The determining the output of the query node based on the target input comprises: Determine the type of database corresponding to the query node; Acquire a query statement template of the query node based on the type of the database; determining an input of the query node based on the target input; At least filling the input of the query node into the query statement template to obtain the query statement of the query node; The database corresponding to the query node is queried through the query statement of the query node to obtain the output of the query node.

4. The method according to claim 3, characterized in that: The determining the input of the query node based on the target input includes: If the query node is a query node in the parallel query relationship, determining the input parameter value in the target input as the input of the query node; If the query node is the first query node in the serial query relationship, determining the input parameter value in the target input as the input of the query node; If the query node is a query node other than the first query node in a serial query relationship, the output of the previous query node of the query node is determined as the input of the query node.

5. The method according to claim 3, characterized in that: The step of at least filling the query node input into the query statement template to obtain the query statement of the query node includes: Filling the query statement template with the input of the query node to obtain the query statement of the query node; or, The query node input and the query node constraint conditions are filled into the query statement template to obtain the query statement of the query node; the target input includes the query node constraint conditions.

6. The method according to any one of claims 1 to 5, characterized in that: The outputting the target query result corresponding to the target information to the caller includes: Based on the target query identifier, determining a target output format of the target query result; The target query result is sorted into the target output format and then output to the caller.

7. The method according to any one of claims 1 to 5, characterized in that: Before receiving the target query identifier and target input sent by the caller, the method further includes: Obtaining a field of each of the multiple databases; Based on the target input, the target information, and the fields of each of the databases, determining a target query pipeline for querying the target information according to the target input; Generate a target query identifier based on the target query pipeline; and binding the target query identifier with the target query pipeline; At least the target query identifier is sent to the caller.

8. A data query device, characterized in that: The device is deployed at the called party, and the device includes: A receiving unit, configured to receive a target query identifier and a target input sent by a caller; the target query identifier is used to point to a target query pipeline for querying target information in multiple databases according to the target input; A determination unit, configured to determine, based on the target query identifier, a target query pipeline pointed to by the target query identifier; the target query pipeline includes a plurality of query nodes and a query relationship between the plurality of query nodes; a query node is configured to point to a query on one of the plurality of databases; A query unit, configured to query a plurality of query nodes in the target query pipeline based on the target input and the target query pipeline to obtain target information; An output unit is used to output a target query result corresponding to the target information to the caller; the target query result at least includes the target information.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein a computer program or instructions are stored in the memory, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instructions, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.