CN112052267B - Data query method, equipment, server and storage medium - Google Patents

Data query method, equipment, server and storage medium Download PDF

Info

Publication number
CN112052267B
CN112052267B CN202011238088.2A CN202011238088A CN112052267B CN 112052267 B CN112052267 B CN 112052267B CN 202011238088 A CN202011238088 A CN 202011238088A CN 112052267 B CN112052267 B CN 112052267B
Authority
CN
China
Prior art keywords
data
network interface
queried
database
configuration information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011238088.2A
Other languages
Chinese (zh)
Other versions
CN112052267A (en
Inventor
王路
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Weikun Shanghai Technology Service Co Ltd
Original Assignee
Weikun Shanghai Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Weikun Shanghai Technology Service Co Ltd filed Critical Weikun Shanghai Technology Service Co Ltd
Priority to CN202011238088.2A priority Critical patent/CN112052267B/en
Publication of CN112052267A publication Critical patent/CN112052267A/en
Application granted granted Critical
Publication of CN112052267B publication Critical patent/CN112052267B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Abstract

The embodiment of the invention relates to the field of big data, and discloses a data query method, equipment, a server and a storage medium, wherein the method comprises the following steps: acquiring a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement; determining a target data table corresponding to an interface identifier to be inquired from a database according to the network interface configuration information, and creating a temporary table in the database; calling a network interface corresponding to the network interface service address to acquire interface service data from an interface server; the data list to be inquired is analyzed from the interface service data and is inserted into the temporary table to obtain an updated database; and querying target data corresponding to the join query statement from the updated database, wherein the target data comprises data queried from a target data table and data queried from a data list. The invention relates to a block chain technology, and the target data can be stored in the block chain.

Description

Data query method, equipment, server and storage medium
Technical Field
The present invention relates to the field of big data, and in particular, to a data query method, device, server, and storage medium.
Background
Join query is a common usage scenario in database applications, and is used to combine a plurality of tables in a database into a query result according to specified query and associated conditions, but usually, the tables in the database need to be joined with data returned by a certain network http interface service. For the scenario, in the current processing scheme of the association query in the industry, a result of a table in a database is queried through the database, and data returned by analyzing is analyzed by calling an http interface service, so that data of the table in the database and data obtained by analyzing are combined to obtain a result of the association query.
However, this approach requires code development, increases technical contract and management costs, and the final convergence is implemented by code, and cannot use advanced functions of database connection query (such as summing by group, counting, averaging, etc.), and additional code development is required to implement similar functions. Therefore, how to perform join queries more efficiently is very important.
Disclosure of Invention
The embodiment of the invention provides a data query method, a device, a server and a storage medium, which can realize that the joint query result of database table and interface service data can be obtained by directly using common joint query statements by automatically importing the data obtained from a network interface into a temporary table of a database, thereby improving the efficiency and effectiveness of data query.
In a first aspect, an embodiment of the present invention provides a data query method, including:
acquiring a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement;
determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information;
calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server;
analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database;
and querying from the updated database to obtain target data corresponding to the join query statement, and sending the target data to the user terminal, wherein the target data comprises data queried from the target data table and data queried from the data list.
Further, the network interface configuration information includes a mapping relationship between the interface identifier and the data table identifier, a service address of the network interface, path information of the data returned by the network interface, names of fields of the data returned by the network interface, and configuration information of corresponding data types.
Further, the determining, from a database according to the network interface configuration information, a target data table corresponding to the interface identifier to be queried includes:
determining a target data table identifier corresponding to the interface identifier to be inquired according to the mapping relation between the interface identifier and the data table identifier in the network interface configuration information;
and acquiring a target data table corresponding to the target data table identifier from the database.
Further, the creating a temporary table in the database according to the network interface configuration information includes:
acquiring each field name of the network interface return data and the corresponding data type in the network interface configuration information;
and creating a temporary table in the database according to the field names of the data returned by the network interfaces in the network interface configuration information and the corresponding data types, and adding a temporary table identifier to the temporary table according to the interface identifier in the network interface configuration information.
Further, the parsing the data list to be queried from the interface service data according to the network interface configuration information includes:
acquiring path information of data returned by the network interface in the network interface configuration information;
and analyzing a data list to be inquired from the interface service data according to the path information of the data returned by the network interface in the network interface configuration information.
Further, the inserting the data list to be queried into the temporary table to obtain an updated database includes:
inserting the data list to be inquired into the temporary table, and performing format conversion on the data in the temporary table;
and obtaining an updated database according to the temporary table obtained after the format conversion and the data table in the database.
Further, the querying the updated database to obtain the target data corresponding to the join query statement includes:
sending the join query statement to the updated database, so that the updated database queries target data corresponding to the join query statement from the data list of the target data table and the temporary table according to the join query statement;
and acquiring the target data obtained by the database query, wherein the target data comprises data obtained by querying in the target data table and data obtained by querying in the data list.
In a second aspect, an embodiment of the present invention provides a data query device, including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a data query request sent by a user terminal, and the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement;
a creating unit, configured to determine, from a database according to network interface configuration information, a target data table corresponding to the interface identifier to be queried, and create a temporary table in the database according to the network interface configuration information;
the calling unit is used for calling the network interface corresponding to the network interface service address and calling the network interface to acquire interface service data from an interface server;
the updating unit is used for analyzing a data list to be queried from the interface service data according to the network interface configuration information and inserting the data list to be queried into the temporary table to obtain an updated database;
and the query unit is used for querying the updated database to obtain target data corresponding to the join query statement and sending the target data to the user terminal, wherein the target data comprises data queried from the target data table and data queried from the data list.
In a third aspect, an embodiment of the present invention provides a server, including a processor, an input device, an output device, and a memory, where the processor, the input device, the output device, and the memory are connected to each other, where the memory is used to store a computer program that supports a data query device to execute the above method, and the computer program includes a program, and the processor is configured to call the program to execute the method of the first aspect.
In a fourth aspect, the present invention provides a computer-readable storage medium, which stores a computer program, where the computer program is executed by a processor to implement the method of the first aspect.
In the embodiment of the invention, a server can obtain a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement; determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information; calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server; analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database; and inquiring the updated database to obtain target data corresponding to the connection inquiry statement, and sending the target data to the user terminal. By automatically importing the data acquired from the network interface into the temporary table of the database, the method realizes that the joint query result of the database table and the interface service data can be acquired by directly using the common joint query statement, and improves the efficiency and effectiveness of data query.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic structural diagram of a data query system according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a module in a user terminal according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a data query method provided by an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a data query device provided by an embodiment of the present invention;
fig. 5 is a schematic block diagram of a server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The data query method provided by the embodiment of the invention can be applied to a data query system, and in some embodiments, the data query system comprises a server and a user terminal. In some embodiments, the server comprises an interface server and a database server, wherein the server comprises a data query device. In some embodiments, the user terminal may establish a communication connection with a server. In some embodiments, the user terminal may establish a communication connection with an interface server. In some embodiments, the user terminal may establish a communication connection with a database server. In some embodiments, the manner of the Communication connection may include, but is not limited to, Wi-Fi, Bluetooth, Near Field Communication (NFC), and the like. In some embodiments, the user terminal includes, but is not limited to, a smart terminal device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like.
The data query system provided by the embodiment of the invention is schematically described below with reference to fig. 1 and 2.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a data query system according to an embodiment of the present invention. The data query system comprises: the system comprises a server 11 and a user terminal 12, wherein the server 11 comprises an interface server 111 and a database server 112. In some embodiments, the user terminal 12 may establish a communication connection with the server 11. In some embodiments, the user terminal 12 may establish a communication connection with the interface server 111. In some embodiments, the user terminal 12 may establish a communication connection with the database server 112. In some embodiments, the user terminal 12 may include, but is not limited to, a smart terminal device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like.
In the embodiment of the present invention, a user may configure the network interface configuration information through an inquiry client in the user terminal 12, and the user terminal 12 may store the network interface configuration information configured by the user for use in data inquiry. The server 11 may obtain a data query request sent by the user terminal 12, where the data query request carries an interface identifier to be queried, a network interface service address to be queried, and a binding query statement. The server 11 may determine a target data table corresponding to the interface identifier to be queried from the database server 112 according to the network interface configuration information, and create a temporary table in the database according to the network interface configuration information. The server 11 may call a network interface corresponding to the network interface service address, and call the network interface to obtain interface service data from the interface server 111; the server 11 may analyze a data list to be queried from the interface service data according to the network interface configuration information, and insert the data list to be queried into the temporary table to obtain an updated database; the server 11 may query the updated database to obtain target data corresponding to the join query statement, and send the target data to the user terminal 12.
In some embodiments, when the user configures the network interface configuration information at the query client of the user terminal 12, the user may configure a mapping relationship between the interface identifier and the data table identifier, a service address of the network interface, path information of data returned by the network interface, names of fields of data returned by the network interface, configuration information of corresponding data types, and the like. In some embodiments, the interface identifies a naming convention that is consistent with a naming convention for a data table in a database. In certain embodiments, the interface identification includes, but is not limited to, numbers, letters, and the like.
In an embodiment, the query client of the user terminal 12 includes 5 sub-modules, which can be specifically described by taking fig. 2 as an example, and fig. 2 is a schematic structural diagram of a module in the user terminal according to an embodiment of the present invention. As shown in fig. 2, the query client of the user terminal 12 includes a graphical interface 121, a query controller 122, a configuration manager 123, a database gateway 124, and an http gateway 125.
In some embodiments, the graphical interface 121 is used to interact with the user for the user to input network interface configuration information and join query statements, and to return a result view to the user terminal 12 for viewing by the user. In some embodiments, the configuration manager 123 is configured to store the configuration information of each network interface input by the user for use in querying. In some embodiments, the query controller 122 is configured to invoke the network interface according to the network interface configuration information, send the relevant instruction to the database server 112 to complete the query, and return the result to the graphical interface 121. In some embodiments, the database gateway 124 is configured to interact with the database server 112 and send instructions to query the controller 122 to the database server 112; in some embodiments, the http gateway 125 is configured to initiate a network request to invoke a network interface to retrieve interface service data from the interface server 111.
The embodiment of the invention realizes that the joint query result of the database table and the interface service data can be obtained by directly using the common joint query statement in the way, thereby improving the efficiency and the effectiveness of data query.
The following describes schematically a data query method provided by an embodiment of the present invention with reference to fig. 3.
Referring to fig. 3, fig. 3 is a schematic flowchart of a data query method according to an embodiment of the present invention, and as shown in fig. 3, the method may be executed by a data query device, where the data query device is disposed in a server, and a specific explanation of the server is as described above, and is not repeated here. Specifically, the method of the embodiment of the present invention includes the following steps.
S301: the method comprises the steps of obtaining a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement.
In the embodiment of the invention, the data query equipment can acquire the data query request sent by the user terminal, wherein the data query request carries the interface identifier to be queried, the network interface service address to be queried and the connection query statement.
In an embodiment, before acquiring a data query request sent by a user terminal, a data query device may acquire network interface configuration information sent by the user terminal, where the network interface configuration information includes a mapping relationship between an interface identifier and a data table identifier, a service address of a network interface, path information of data returned by the network interface, names of fields of the data returned by the network interface, and configuration information of corresponding data types. In some embodiments, the interface identifies a naming convention that is consistent with a naming convention for a data table in a database. In certain embodiments, the interface identification includes, but is not limited to, numbers, letters, and the like.
In one embodiment, the user may write a join query statement at a query client of the user terminal, and input the interface identifier to be queried and the network interface service address to be queried at the query client of the user terminal, so as to generate the data query request according to the interface identifier to be queried, the network interface service address to be queried, and the join query statement. After the user terminal generates the data query request, the data query request may be sent to the server, so that the server receives the data query request sent by the user terminal.
S302: and determining a target data table corresponding to the interface identifier to be inquired from a database according to the network interface configuration information, and creating a temporary table in the database according to the network interface configuration information.
In the embodiment of the present invention, the data query device may determine, from a database, a target data table corresponding to the interface identifier to be queried according to the network interface configuration information, and create a temporary table in the database according to the network interface configuration information.
In an embodiment, when determining, by the data querying device, the target data table corresponding to the interface identifier to be queried from the database according to the network interface configuration information, the data querying device may determine, according to a mapping relationship between the interface identifier and the data table identifier in the network interface configuration information, the target data table identifier corresponding to the interface identifier to be queried, and acquire, from the database, the target data table corresponding to the target data table identifier. In some embodiments, the database includes a plurality of data tables, each data table includes a data table identification, and the data table identifications of different data tables are different.
For example, assuming that an interface identifier to be queried carried in a data query request acquired by a data query device is 1, a target data table identifier a corresponding to the interface identifier 1 to be queried may be determined according to a mapping relationship between the interface identifier and a data table identifier in the network interface configuration information, and a target data table corresponding to the target data table identifier a may be acquired from the database.
In an embodiment, when creating the temporary table in the database according to the network interface configuration information, the data query device may obtain each field name and a corresponding data type of the network interface return data in the network interface configuration information, create the temporary table in the database according to each field name and a corresponding data type of the network interface return data in the network interface configuration information, and add a temporary table identifier to the temporary table according to the interface identifier in the network interface configuration information. In some embodiments, the naming convention identified by the temporary table is the same as the naming convention identified by the interface. In some embodiments, the temporary identifier is different from the interface identifier. In some embodiments, the temporary identifier is different from a data table identifier in a database.
By creating the temporary table in the database according to the network interface configuration information, the subsequent automatic import of the data acquired from the network interface into the temporary table of the database is facilitated, the connection query result of the database table and the interface service data is acquired by directly using a common connection query statement, and the efficiency and effectiveness of data query are improved.
S303: and calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server.
In the embodiment of the invention, the data query equipment can call the network interface corresponding to the network interface service address and call the network interface to acquire interface service data from the interface server. In certain embodiments, the network interface address is an http interface address.
For example, assuming that a network interface service address to be queried carried in a data query request acquired by a data query device is http:// localhost:8080/data/zzz, the data query device may call a network interface corresponding to the network interface service address http:// localhost:8080/data/zzz, and call the network interface to acquire interface service data from an interface server.
And calling the network interface corresponding to the network interface service address and calling the network interface to acquire interface service data from an interface server, so that the data list to be inquired can be determined from the interface service data.
S304: and analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database.
In the embodiment of the present invention, the data query device may analyze the data list to be queried from the interface service data according to the network interface configuration information, and insert the data list to be queried into the temporary table to obtain the updated database.
In an embodiment, when the data query device parses the data list to be queried from the interface service data according to the network interface configuration information, the data query device may obtain path information of network interface return data in the network interface configuration information, and parse the data list to be queried from the interface service data according to the path information of the network interface return data in the network interface configuration information.
In an embodiment, when the data query device inserts the data list to be queried into the temporary table to obtain an updated database, the data query device may insert the data list to be queried into the temporary table, perform format conversion on data in the temporary table, and obtain the updated database according to the temporary table obtained after the format conversion and a data table in the database.
In an embodiment, when performing format conversion on the data in the temporary table, the data query device may obtain a data format in each data table in the database, and convert the data format of the data in the temporary table according to the data format in each data table in the database.
In an embodiment, before performing format conversion on the data in the temporary table, the data querying device may detect whether the data format of the data in the temporary table matches the data format of each data table in the database, and if the detection result indicates that the data format of the data in the temporary table does not match the data format of each data table in the database, perform the step of performing format conversion on the data in the temporary table.
By analyzing the data list to be queried from the interface service data according to the network interface configuration information and inserting the data list to be queried into the temporary table to obtain an updated database, the method can realize that the joint query result of the database table and the interface service data is obtained by directly using a common joint query statement, and is beneficial to improving the efficiency and effectiveness of data query.
S305: and querying from the updated database to obtain target data corresponding to the join query statement, and sending the target data to the user terminal, wherein the target data comprises data queried from the target data table and data queried from the data list.
In this embodiment of the present invention, the data query device may query the updated database to obtain target data corresponding to the join query statement, and send the target data to the user terminal, where the target data includes data queried from the target data table and data queried from the data list.
In some embodiments, the target data includes data in a target data table in the database corresponding to the interface identifier to be queried and data in a data list in the interface service data corresponding to the network interface service address to be queried.
In an embodiment, when the data query device queries the updated database to obtain target data corresponding to the join query statement, the data query device may send the join query statement to the updated database, so that the updated database queries the target data corresponding to the join query statement from the data list of the target data table and the temporary table according to the join query statement, and obtains the target data obtained by querying the database, where the target data includes data queried from the target data table and data queried from the data list.
In one embodiment, the join query statement is used for indicating data of a data table corresponding to an interface identifier to be queried and interface service data corresponding to a network interface service address to be queried in a query database; the data query device may query the updated database to obtain data of a target data table corresponding to the interface identifier to be queried and data of a data list in the interface service data corresponding to the network interface service address to be queried, and send the data of the target data table and the data of the data list in the interface service data, which are obtained by the query, as target data to the user terminal.
In the embodiment of the invention, data query equipment can acquire a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement; determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information; calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server; analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database; and inquiring the updated database to obtain target data corresponding to the connection inquiry statement, and sending the target data to the user terminal. By automatically importing the data acquired from the network interface into the temporary table of the database, the method realizes that the joint query result of the database table and the interface service data can be acquired by directly using the common joint query statement, and improves the efficiency and effectiveness of data query.
Embodiments of the present invention also provide a data query device, which is configured to perform the units of the method described in any one of the preceding claims. Specifically, referring to fig. 4, fig. 4 is a schematic block diagram of a data query device according to an embodiment of the present invention. The data query device of the embodiment includes: an acquisition unit 401, a creation unit 402, a calling unit 403, an updating unit 404, and an inquiry unit 405.
An obtaining unit 401, configured to obtain a data query request sent by a user terminal, where the data query request carries an interface identifier to be queried, a network interface service address to be queried, and a join query statement;
a creating unit 402, configured to determine, according to network interface configuration information, a target data table corresponding to the interface identifier to be queried from a database, and create a temporary table in the database according to the network interface configuration information;
a calling unit 403, configured to call a network interface corresponding to the network interface service address, and call the network interface to obtain interface service data from an interface server;
an updating unit 404, configured to analyze a data list to be queried from the interface service data according to the network interface configuration information, and insert the data list to be queried into the temporary table to obtain an updated database;
a querying unit 405, configured to query the updated database to obtain target data corresponding to the join query statement, and send the target data to the user terminal, where the target data includes data queried from the target data table and data queried from the data list.
Further, the network interface configuration information includes a mapping relationship between the interface identifier and the data table identifier, a service address of the network interface, path information of the data returned by the network interface, names of fields of the data returned by the network interface, and configuration information of corresponding data types.
Further, when the creating unit 402 determines the target data table corresponding to the interface identifier to be queried from the database according to the network interface configuration information, the creating unit is specifically configured to:
determining a target data table identifier corresponding to the interface identifier to be inquired according to the mapping relation between the interface identifier and the data table identifier in the network interface configuration information;
and acquiring a target data table corresponding to the target data table identifier from the database.
Further, when the creating unit 402 creates the temporary table in the database according to the network interface configuration information, the creating unit is specifically configured to:
acquiring each field name of the network interface return data and the corresponding data type in the network interface configuration information;
and creating a temporary table in the database according to the field names of the data returned by the network interfaces in the network interface configuration information and the corresponding data types, and adding a temporary table identifier to the temporary table according to the interface identifier in the network interface configuration information.
Further, when the updating unit 404 analyzes the data list to be queried from the interface service data according to the network interface configuration information, specifically configured to:
acquiring path information of data returned by the network interface in the network interface configuration information;
and analyzing a data list to be inquired from the interface service data according to the path information of the data returned by the network interface in the network interface configuration information.
Further, when the updating unit 404 inserts the data list to be queried into the temporary table to obtain an updated database, the updating unit is specifically configured to:
inserting the data list to be inquired into the temporary table, and performing format conversion on the data in the temporary table;
and obtaining an updated database according to the temporary table obtained after the format conversion and the data table in the database.
Further, when the querying unit 405 queries the updated database to obtain the target data corresponding to the join query statement, the querying unit is specifically configured to:
sending the join query statement to the updated database, so that the updated database queries target data corresponding to the join query statement from the data list of the target data table and the temporary table according to the join query statement;
and acquiring the target data obtained by the database query, wherein the target data comprises data obtained by querying in the target data table and data obtained by querying in the data list.
In the embodiment of the invention, data query equipment can acquire a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement; determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information; calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server; analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database; and inquiring the updated database to obtain target data corresponding to the connection inquiry statement, and sending the target data to the user terminal. By automatically importing the data acquired from the network interface into the temporary table of the database, the method realizes that the joint query result of the database table and the interface service data can be acquired by directly using the common joint query statement, and improves the efficiency and effectiveness of data query.
Referring to fig. 5, fig. 5 is a schematic block diagram of a server according to an embodiment of the present invention. The server in this embodiment as shown in the figure may include: one or more processors 501; one or more input devices 502, one or more output devices 503, and memory 504. The processor 501, the input device 502, the output device 503, and the memory 504 are connected by a bus 505. The memory 504 is used for storing computer programs, including programs, and the processor 501 is used for executing the programs stored in the memory 504. Wherein the processor 501 is configured to invoke the program to perform:
acquiring a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement;
determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information;
calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server;
analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database;
and querying from the updated database to obtain target data corresponding to the join query statement, and sending the target data to the user terminal, wherein the target data comprises data queried from the target data table and data queried from the data list.
Further, the network interface configuration information includes a mapping relationship between the interface identifier and the data table identifier, a service address of the network interface, path information of the data returned by the network interface, names of fields of the data returned by the network interface, and configuration information of corresponding data types.
Further, when the processor 501 determines the target data table corresponding to the interface identifier to be queried from the database according to the network interface configuration information, the processor is specifically configured to:
determining a target data table identifier corresponding to the interface identifier to be inquired according to the mapping relation between the interface identifier and the data table identifier in the network interface configuration information;
and acquiring a target data table corresponding to the target data table identifier from the database.
Further, when the processor 501 creates a temporary table in the database according to the network interface configuration information, it is specifically configured to:
acquiring each field name of the network interface return data and the corresponding data type in the network interface configuration information;
and creating a temporary table in the database according to the field names of the data returned by the network interfaces in the network interface configuration information and the corresponding data types, and adding a temporary table identifier to the temporary table according to the interface identifier in the network interface configuration information.
Further, when the processor 501 analyzes the data list to be queried from the interface service data according to the network interface configuration information, the processor is specifically configured to:
acquiring path information of data returned by the network interface in the network interface configuration information;
and analyzing a data list to be inquired from the interface service data according to the path information of the data returned by the network interface in the network interface configuration information.
Further, when the processor 501 inserts the data list to be queried into the temporary table to obtain an updated database, the method is specifically configured to:
inserting the data list to be inquired into the temporary table, and performing format conversion on the data in the temporary table;
and obtaining an updated database according to the temporary table obtained after the format conversion and the data table in the database.
Further, when the processor 501 queries the updated database to obtain the target data corresponding to the join query statement, the processor is specifically configured to:
sending the join query statement to the updated database, so that the updated database queries target data corresponding to the join query statement from the data list of the target data table and the temporary table according to the join query statement;
and acquiring the target data obtained by the database query, wherein the target data comprises data obtained by querying in the target data table and data obtained by querying in the data list.
In the embodiment of the invention, a server can obtain a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement; determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information; calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server; analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database; and inquiring the updated database to obtain target data corresponding to the connection inquiry statement, and sending the target data to the user terminal. By automatically importing the data acquired from the network interface into the temporary table of the database, the method realizes that the joint query result of the database table and the interface service data can be acquired by directly using the common joint query statement, and improves the efficiency and effectiveness of data query.
It should be understood that, in the embodiment of the present invention, the Processor 501 may be a Central Processing Unit (CPU), and the Processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Input devices 502 may include a touch pad, microphone, etc., and output devices 503 may include a display (LCD, etc.), speakers, etc.
The memory 504 may include a read-only memory and a random access memory, and provides instructions and data to the processor 501. A portion of the memory 504 may also include non-volatile random access memory. For example, the memory 504 may also store device type information.
In a specific implementation, the processor 501, the input device 502, and the output device 503 described in this embodiment of the present invention may execute the implementation described in the method embodiment shown in fig. 3 provided in this embodiment of the present invention, and may also execute the implementation of the data query device described in fig. 4 in this embodiment of the present invention, which is not described again here.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when executed by a processor, the computer program implements the data query method described in the embodiment corresponding to fig. 3, and may also implement the data query device in the embodiment corresponding to fig. 4 of the present invention, which is not described herein again.
The computer readable storage medium may be an internal storage unit of the data query device in any of the foregoing embodiments, for example, a hard disk or a memory of the data query device. The computer readable storage medium may also be an external storage device of the data query device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the data query device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the data query device. The computer readable storage medium is used for storing the computer program and other programs and data required by the data query device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a computer-readable storage medium, which includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned computer-readable storage media comprise: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. The computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
It is emphasized that, to further ensure the privacy and security of the target data, the diagnostic result may also be stored in a node of a blockchain. The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The above description is only a part of the embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present invention, and these modifications or substitutions should be covered within the scope of the present invention.

Claims (8)

1. A method for querying data, comprising:
acquiring network interface configuration information sent by a user terminal, wherein the network interface configuration information is input by a user on a graphical interface of a query client of the user terminal;
acquiring a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement, and the connection query statement is used for indicating data of a target data table corresponding to the interface identifier to be queried and interface service data corresponding to the network interface service address to be queried in a query database;
determining a target data table corresponding to the interface identifier to be inquired from a database according to network interface configuration information, and creating a temporary table in the database according to the network interface configuration information;
calling a network interface corresponding to the network interface service address, and calling the network interface to acquire interface service data from an interface server;
analyzing a data list to be queried from the interface service data according to the network interface configuration information, and inserting the data list to be queried into the temporary table to obtain an updated database;
the analyzing a data list to be queried from the interface service data according to the network interface configuration information includes:
acquiring path information of data returned by the network interface in the network interface configuration information;
analyzing a data list to be queried from the interface service data according to path information of data returned by the network interface in the network interface configuration information;
the inserting the data list to be queried into the temporary table to obtain an updated database includes:
inserting the data list to be inquired into the temporary table;
acquiring data formats in all data tables in a database, and detecting whether the data formats of the data in the temporary tables are matched with the data formats of all the data tables in the database;
if the detection result is that the data format of the data in the temporary table is not matched with the data format of each data table in the database, carrying out format conversion on the data in the temporary table;
obtaining an updated database according to the temporary table obtained after the format conversion and the data table in the database;
inquiring from the updated database to obtain target data corresponding to the join inquiry statement, and sending the target data to the user terminal, wherein the target data comprises data inquired from the target data table and data inquired from the data list;
the querying from the updated database to obtain the target data corresponding to the join query statement includes:
and inquiring the updated database to obtain the data of a target data table corresponding to the interface identifier to be inquired and the data of a data list in the interface service data corresponding to the network interface service address to be inquired, and taking the data of the target data table and the data of the data list in the interface service data as the target data.
2. The method of claim 1,
the network interface configuration information comprises the mapping relation between the interface identifier and the data table identifier, the service address of the network interface, the path information of the data returned by the network interface, the name of each field of the data returned by the network interface and the configuration information of the corresponding data type.
3. The method according to claim 2, wherein the determining a target data table corresponding to the interface identifier to be queried from a database according to the network interface configuration information includes:
determining a target data table identifier corresponding to the interface identifier to be inquired according to the mapping relation between the interface identifier and the data table identifier in the network interface configuration information;
and acquiring a target data table corresponding to the target data table identifier from the database.
4. The method of claim 1, wherein creating a temporary table in the database according to the network interface configuration information comprises:
acquiring each field name of the network interface return data and the corresponding data type in the network interface configuration information;
and creating a temporary table in the database according to the field names of the data returned by the network interfaces in the network interface configuration information and the corresponding data types, and adding a temporary table identifier to the temporary table according to the interface identifier in the network interface configuration information.
5. The method of claim 1, wherein querying from the updated database results in target data corresponding to the join query statement, comprising:
sending the join query statement to the updated database, so that the updated database queries target data corresponding to the join query statement from the data list of the target data table and the temporary table according to the join query statement;
and acquiring the target data obtained by the database query.
6. A data query device, comprising:
the system comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring network interface configuration information sent by a user terminal, and the network interface configuration information is input by a user on a graphical interface of a query client of the user terminal; acquiring a data query request sent by a user terminal, wherein the data query request carries an interface identifier to be queried, a network interface service address to be queried and a connection query statement, and the connection query statement is used for indicating data of a target data table corresponding to the interface identifier to be queried and interface service data corresponding to the network interface service address to be queried in a query database;
a creating unit, configured to determine, from a database according to network interface configuration information, a target data table corresponding to the interface identifier to be queried, and create a temporary table in the database according to the network interface configuration information;
the calling unit is used for calling the network interface corresponding to the network interface service address and calling the network interface to acquire interface service data from an interface server;
the updating unit is used for analyzing a data list to be queried from the interface service data according to the network interface configuration information and inserting the data list to be queried into the temporary table to obtain an updated database;
the updating unit is specifically configured to obtain path information of data returned by a network interface in the network interface configuration information when analyzing a data list to be queried from the interface service data according to the network interface configuration information; analyzing a data list to be queried from the interface service data according to path information of data returned by the network interface in the network interface configuration information;
the updating unit is specifically configured to insert the data list to be queried into the temporary table when inserting the data list to be queried into the temporary table to obtain an updated database; acquiring data formats in all data tables in a database, and detecting whether the data formats of the data in the temporary tables are matched with the data formats of all the data tables in the database; if the detection result is that the data format of the data in the temporary table is not matched with the data format of each data table in the database, carrying out format conversion on the data in the temporary table; obtaining an updated database according to the temporary table obtained after the format conversion and the data table in the database;
a query unit, configured to query the updated database to obtain target data corresponding to the join query statement, and send the target data to the user terminal, where the target data includes data queried from the target data table and data queried from the data list;
when the query unit queries the updated database to obtain the target data corresponding to the join query statement, the query unit is specifically configured to query the updated database to obtain data of a target data table corresponding to the interface identifier to be queried and data of a data list in the interface service data corresponding to the network interface service address to be queried, and use the data of the target data table and the data of the data list in the interface service data obtained through query as the target data.
7. A server comprising a processor, an input device, an output device and a memory, the processor, the input device, the output device and the memory being interconnected, wherein the memory is configured to store a computer program, the computer program comprising a program, the processor being configured to invoke the program to perform the method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executed by a processor to implement the method of any of claims 1-5.
CN202011238088.2A 2020-11-09 2020-11-09 Data query method, equipment, server and storage medium Active CN112052267B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011238088.2A CN112052267B (en) 2020-11-09 2020-11-09 Data query method, equipment, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011238088.2A CN112052267B (en) 2020-11-09 2020-11-09 Data query method, equipment, server and storage medium

Publications (2)

Publication Number Publication Date
CN112052267A CN112052267A (en) 2020-12-08
CN112052267B true CN112052267B (en) 2021-03-02

Family

ID=73605277

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011238088.2A Active CN112052267B (en) 2020-11-09 2020-11-09 Data query method, equipment, server and storage medium

Country Status (1)

Country Link
CN (1) CN112052267B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120304A1 (en) * 2006-11-21 2008-05-22 Calio Robert J Method and system for providing high performance data modification of relational database tables
CN101685449A (en) * 2008-09-26 2010-03-31 国际商业机器公司 Method and system for connecting tables in a plurality of heterogeneous distributed databases
CN107346317A (en) * 2016-05-06 2017-11-14 北京神州泰岳软件股份有限公司 A kind of data query method and apparatus
CN111858760A (en) * 2020-07-13 2020-10-30 中国工商银行股份有限公司 Data processing method and device for heterogeneous database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080120304A1 (en) * 2006-11-21 2008-05-22 Calio Robert J Method and system for providing high performance data modification of relational database tables
CN101685449A (en) * 2008-09-26 2010-03-31 国际商业机器公司 Method and system for connecting tables in a plurality of heterogeneous distributed databases
CN107346317A (en) * 2016-05-06 2017-11-14 北京神州泰岳软件股份有限公司 A kind of data query method and apparatus
CN111858760A (en) * 2020-07-13 2020-10-30 中国工商银行股份有限公司 Data processing method and device for heterogeneous database

Also Published As

Publication number Publication date
CN112052267A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN109600441B (en) Alliance link information publishing control method and terminal equipment
CN109688186B (en) Data interaction method, device, equipment and readable storage medium
EP3178011A1 (en) Method and system for facilitating terminal identifiers
CN111683066A (en) Heterogeneous system integration method and device, computer equipment and storage medium
CN111782652B (en) Data calling method, device, computer equipment and storage medium
CN112887451B (en) Domain name resolution method and device and computer equipment
CN112052267B (en) Data query method, equipment, server and storage medium
CN109040089B (en) Network policy auditing method, equipment and computer readable storage medium
CN110874365A (en) Information query method and related equipment thereof
CN112583606B (en) Security verification method, server, terminal and storage medium
CN114968822A (en) Interface testing method and device, computer equipment and storage medium
CN110119337B (en) Data analysis method and device and server
CN114185804A (en) Interface testing method and device and terminal equipment
CN111767481B (en) Access processing method, device, equipment and storage medium
CN113094283A (en) Data acquisition method, device, equipment and storage medium
CN112800130A (en) Data uplink method, system, device, equipment and storage medium
CN111008220A (en) Dynamic identification method and device of data source, storage medium and electronic device
CN111459899A (en) Log sharing method and device and terminal equipment
CN112416619A (en) Interface configuration method, equipment, terminal and storage medium
CN111917575B (en) Gateway offline configuration method, system, terminal equipment and storage medium
CN111178044B (en) Method and device for determining target text elements
CN115208951B (en) Request processing method, request processing device, electronic equipment and computer readable storage medium
CN114095272B (en) Intranet data linking method and device based on internal and external network security architecture
CN110933661B (en) Mobile terminal addressing method, device, mobile terminal and medium with one card and multiple numbers

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant