Data query method, device, electronic device and storage medium

By supporting filtering functions and query end conditions in binary log file query, the problem of inflexible and convenient query in the existing technology is solved, and more efficient query operations and result processing is achieved.

CN117591480BActive Publication Date: 2025-03-25XINGIN INFORMATION TECH (SHANGHAI) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311265129.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-03-25
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

The existing binary log file query method is not flexible and convenient enough, and the query efficiency is low.

Method used

Provides a data query method, which obtains the target binary log file by receiving query requests, including database identification and filtering conditions, and querys the change data according to the filtering conditions, and supports functions such as preset time range, query end conditions, preset data number and preset timeout time.

Benefits of technology

Simplify query operations, reduce redundant information in query results, improve query efficiency, and make users more flexible and convenient to use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117591480B_ABST
    Figure CN117591480B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a data query method, device, electronic device and storage medium, the method comprising: receiving a query request, the query request including a database identifier and a screening condition; determining the database corresponding to the database identifier as a target database, obtaining a target binary log file from the target database; querying the change data recorded in the target binary log file according to the screening condition, and obtaining a target data set that meets the screening condition. The embodiment of the present application can simplify the query operation and improve the query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of database processing, and in particular to a data query method, device, electronic device and storage medium. Background Art

[0002] Binary log files (Binlog) are files that record database change operations. Binlog queries can be used for data change queries, data change statistics, change rollbacks, etc. The current Binlog query method generally uses Binlog query tools (such as mysqldump) or the show syntax in Structured Query Language (SQL) for querying. However, this method is not flexible and convenient to use, and the query efficiency is low. Summary of the invention

[0003] The present application provides a data query method, device, electronic device and storage medium, which can simplify query operations and improve query efficiency.

[0004] In a first aspect, an embodiment of the present application provides a data query method, the method comprising:

[0005] receiving a query request, wherein the query request includes a database identifier and a screening condition;

[0006] Determine the database corresponding to the database identifier as the target database, and obtain a target binary log file from the target database;

[0007] The change data recorded in the target binary log file is queried according to the screening condition to obtain a target data set that meets the screening condition.

[0008] Through the above embodiments, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to provide a database identifier and a filtering condition, and the query server can obtain the change data that meets the filtering condition from the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0009] In a possible implementation of the first aspect, the screening condition includes a preset time range; and obtaining a target binary log file from the target database includes:

[0010] Obtain a list of binary log file names from the target database;

[0011] Selecting binary log file names one by one from the binary log file name list in chronological order, and obtaining corresponding binary log files one by one from the target database according to the selected binary log file names;

[0012] Each time a binary log file is obtained, the binary log file is parsed to obtain a recording time of the binary log file, and when the recording time meets the preset time range, the binary log file is determined as a target binary log file.

[0013] Through the above implementation, a preset time range is introduced into the screening condition, and the target binary log file is locked by judging whether the recording time of the binary log file is within the preset time range, which is conducive to quickly querying the change data that meets the preset time range.

[0014] In a possible implementation manner of the first aspect, the query request further includes a query end condition; and querying the change data recorded in the target binary log file according to the screening condition to obtain a target data set that meets the screening condition includes:

[0015] Parsing the target binary log files one by one to obtain the change data recorded in the target binary log files;

[0016] Each time a piece of changed data that meets the screening condition is obtained, the changed data that meets the screening condition is determined as a piece of target data, and when the query end condition is met, parsing is stopped, and the set of target data is used as the target data set.

[0017] Through the above implementation, a query end condition is introduced. When the query end condition is met, obtaining the target binary log file from the database and filtering the target data from the target binary log file can be stopped, which is conducive to reducing the impact on the database.

[0018] In a possible implementation of the first aspect, the query end condition includes a preset number of data items; and the method further includes:

[0019] When the number of target data items reaches the preset number of data items, it is determined that the query end condition is met.

[0020] Through the above implementation, a limit mechanism is introduced, and the query can be terminated when the number of target data reaches a preset number of data, which is helpful to reduce the impact on the database.

[0021] In a possible implementation manner of the first aspect, the query end condition includes a preset timeout period; and the method further includes:

[0022] When the query time reaches the preset timeout time, it is determined that the query end condition is met.

[0023] Through the above implementation, a time limit mechanism is introduced, and the query can be terminated when the query time reaches the preset timeout time, which is helpful to reduce the impact on the database.

[0024] In a possible implementation of the first aspect, the screening condition includes a preset change type and / or a preset column value.

[0025] Through the above implementation, the preset change type and / or preset column value are introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset change type and / or preset column value.

[0026] In a possible implementation of the first aspect, the method further includes:

[0027] Obtaining table structure information corresponding to the query request;

[0028] The target data set is encapsulated according to the table structure information.

[0029] Through the above implementation, the target data set is encapsulated according to the table structure information, which can enhance the readability of the query result, make the query result more intuitive, and help lower the threshold of understanding.

[0030] In a second aspect, an embodiment of the present application provides a data query method, the method comprising:

[0031] Receiving a query instruction, wherein the query instruction includes a database identifier and a screening condition;

[0032] Sending a query request to a query server, wherein the query request includes the database identifier and the screening condition, and is used to request obtaining a target data set that meets the screening condition from a binary log file in a target database, wherein the target database is a database corresponding to the database identifier;

[0033] The target dataset is displayed.

[0034] Through the above embodiment, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to input the database identifier and the filtering condition through the query terminal and initiate the query instruction. The query terminal can obtain and display the change data that meets the filtering condition in the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0035] In a possible implementation of the second aspect, the screening condition includes a preset time range.

[0036] Through the above implementation, a preset time range is introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset time range.

[0037] In a possible implementation of the second aspect, the query instruction further includes a query end condition, and the query request further includes the query end condition.

[0038] Through the above implementation, a query end condition is introduced. When the query end condition is met, the query of the changed data meeting the screening condition from the database can be stopped, which is helpful to reduce the impact on the database.

[0039] In a possible implementation of the second aspect, the query end condition includes a preset number of data items.

[0040] Through the above implementation, a limit mechanism is introduced, and the query can be terminated when the number of changed data that meets the screening conditions reaches a preset number of data, which is helpful to reduce the impact on the database.

[0041] In a possible implementation of the second aspect, the query end condition includes a preset timeout period.

[0042] Through the above implementation, a time limit mechanism is introduced, and the query can be terminated when the query time reaches the preset timeout time, which is helpful to reduce the impact on the database.

[0043] In a possible implementation of the second aspect, the screening condition includes a preset change type and / or a preset column value.

[0044] Through the above implementation, the preset change type and / or preset column value are introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset change type and / or preset column value.

[0045] In a third aspect, an embodiment of the present application provides a data query device, the device comprising:

[0046] A receiving unit, configured to receive a query request, wherein the query request includes a database identifier and a screening condition;

[0047] an acquisition unit, configured to determine the database corresponding to the database identifier as a target database, and acquire a target binary log file from the target database;

[0048] The query unit is used to query the change data recorded in the target binary log file according to the screening condition to obtain the target data set that meets the screening condition.

[0049] Through the above embodiments, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to provide a database identifier and a filtering condition, and the query server can obtain the change data that meets the filtering condition from the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0050] In a possible implementation manner of the third aspect, the screening condition includes a preset time range; when the acquisition unit acquires the target binary log file from the target database, is specifically configured to:

[0051] Obtain a list of binary log file names from the target database;

[0052] Selecting binary log file names one by one from the binary log file name list in chronological order, and obtaining corresponding binary log files one by one from the target database according to the selected binary log file names;

[0053] Each time a binary log file is obtained, the binary log file is parsed to obtain a recording time of the binary log file, and when the recording time meets the preset time range, the binary log file is determined as a target binary log file.

[0054] Through the above implementation, a preset time range is introduced into the screening condition, and the target binary log file is locked by judging whether the recording time of the binary log file is within the preset time range, which is conducive to quickly querying the change data that meets the preset time range.

[0055] In a possible implementation manner of the third aspect, the query request further includes a query end condition; when the query unit queries the change data recorded in the target binary log file according to the screening condition and obtains the target data set that meets the screening condition, it is specifically used to:

[0056] Parsing the target binary log files one by one to obtain the change data recorded in the target binary log files;

[0057] Each time a piece of changed data that meets the screening condition is obtained, the changed data that meets the screening condition is determined as a piece of target data, and when the query end condition is met, parsing is stopped, and the set of target data is used as the target data set.

[0058] Through the above implementation, a query end condition is introduced. When the query end condition is met, obtaining the target binary log file from the database and filtering the target data from the target binary log file can be stopped, which is conducive to reducing the impact on the database.

[0059] In a possible implementation of the third aspect, the query end condition includes a preset number of data items; and the query unit is further used to: when the number of target data items reaches the preset number of data items, determine that the query end condition is satisfied.

[0060] Through the above implementation, a limit mechanism is introduced, and the query is terminated when the number of target data reaches a preset number of data, thereby reducing the impact on the database.

[0061] In a possible implementation of the third aspect, the query termination condition includes a preset timeout period; and the query unit is further configured to: when the query time reaches the preset timeout period, determine that the query termination condition is satisfied.

[0062] Through the above implementation, a time limit mechanism is introduced, and the query is terminated when the query time reaches the preset timeout time, thereby reducing the impact on the database.

[0063] In a possible implementation of the third aspect, the screening condition includes a preset change type and / or a preset column value.

[0064] Through the above implementation, the preset change type and / or preset column value are introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset change type and / or preset column value.

[0065] In a possible implementation manner of the third aspect, the query unit is further configured to: obtain table structure information corresponding to the query request; and encapsulate the target data set according to the table structure information.

[0066] Through the above implementation, the target data set is encapsulated according to the table structure information, which can enhance the readability of the query result, make the query result more intuitive, and help lower the threshold of understanding.

[0067] In a fourth aspect, an embodiment of the present application provides a data query device, the device comprising:

[0068] A receiving unit, configured to receive a query instruction, wherein the query instruction includes a database identifier and a screening condition;

[0069] A sending unit, configured to send a query request to a query platform server, wherein the query request includes the database identifier and the screening condition, and is configured to request to obtain a target data set that meets the screening condition from a binary log file in a target database, wherein the target database is a database corresponding to the database identifier;

[0070] A display unit is used to display the target data set.

[0071] Through the above embodiment, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to input the database identifier and the filtering condition through the query terminal and initiate the query instruction. The query terminal can obtain and display the change data that meets the filtering condition in the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0072] In a possible implementation of the fourth aspect, the screening condition includes a preset time range.

[0073] Through the above implementation, a preset time range is introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset time range.

[0074] In a possible implementation of the fourth aspect, the query instruction also includes a query end condition, and the query request also includes the query end condition.

[0075] Through the above implementation, a query end condition is introduced. When the query end condition is met, the query of the changed data meeting the screening condition from the database can be stopped, which is helpful to reduce the impact on the database.

[0076] In a possible implementation of the fourth aspect, the query end condition includes a preset number of data items.

[0077] Through the above implementation, a limit mechanism is introduced, and the query can be terminated when the number of changed data that meets the screening conditions reaches a preset number of data, which is helpful to reduce the impact on the database.

[0078] In a possible implementation of the fourth aspect, the query end condition includes a preset timeout period.

[0079] Through the above implementation, a time limit mechanism is introduced, and the query can be terminated when the query time reaches the preset timeout time, which is helpful to reduce the impact on the database.

[0080] In a possible implementation of the fourth aspect, the screening condition includes a preset change type and / or a preset column value.

[0081] Through the above implementation, the preset change type and / or preset column value are introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset change type and / or preset column value.

[0082] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method of any one of the first to second aspects above and any possible implementation manner thereof is implemented.

[0083] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any one of the first to second aspects above and any possible implementation manner thereof is implemented.

[0084] In a seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the method in any one of the first to second aspects above and any possible implementation manner thereof.

[0085] The beneficial effects brought about by the fifth to seventh aspects mentioned above can be referred to the description of the beneficial effects in the first to second aspects, and will not be repeated here.

[0086] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.

[0088] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0089] Figure 1 It is a schematic diagram of an application environment of a data query method provided in an embodiment of the present application;

[0090] Figure 2 It is a flowchart of a data query method provided in an embodiment of the present application;

[0091] Figure 3 It is a flowchart of another data query method provided in an embodiment of the present application;

[0092] Figure 4 It is a schematic diagram of a query page of a Binlog query platform provided in an embodiment of the present application;

[0093] Figure 5 It is a flowchart of another data query method provided in an embodiment of the present application;

[0094] Figure 6 It is a structural schematic diagram of a data query device provided in an embodiment of the present application;

[0095] Figure 7 is a structural schematic diagram of another data query device provided in an embodiment of the present application;

[0096] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0097] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0098] The terms "first", "second", etc. in the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0099] It should be understood that in the present application, "at least one (item)" means one or more, "more than one" means two or more, and "at least two (items)" means two or three and more than three. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " can indicate that the previous and next associated objects are in an "or" relationship, which refers to any combination of these items, including any combination of single items (items) or plural items (items). For example, at least one item (item) of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0100] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0101] Binary log files (Binlog) are files that record database change operations. Binlog queries can be used for data change queries, data change statistics, change rollbacks, etc. The current Binlog query method generally uses Binlog query tools (such as mysqldump) or the show syntax in Structured Query Language (SQL) for querying. However, this method is not flexible and convenient to use, and the query efficiency is low.

[0102] Based on this, an embodiment of the present application provides a data query method, which can implement binary log file query more flexibly and conveniently, thereby improving query efficiency.

[0103] The execution subject of the data query method may be a data query device, for example, the data query method may be executed by a terminal device or a server or other processing device, wherein the terminal device may be, but is not limited to, various personal computers, laptops, tablet computers, smart phones, and portable wearable devices, and the server may be implemented as an independent server or a server cluster composed of multiple servers. In some possible implementations, the data query method may be implemented by a processor calling a computer-readable instruction stored in a memory.

[0104] See also Figure 1 , Figure 1 1 is a schematic diagram of an application environment of a data query method provided in an embodiment of the present application. The application environment involves a query terminal 101, a query server 102 and a database 103. The query terminal 101 can be connected to the query server 102 in communication, and the query server 102 can be connected to the database 103 in communication.

[0105] Exemplarily, a user may access a platform that can provide Binlog query services (referred to as a Binlog query platform) through the query terminal 101, and the query server 102 may be a server where the Binlog query platform is located. The user may initiate a query request for the database 103 to the query server 102 through the query terminal 101, and the query server 102 may query and obtain corresponding change data from the database 103 in response to the query request.

[0106] See also Figure 2 , Figure 2 is a flow chart of a data query method provided in an embodiment of the present application, and the data query method can be applied to Figure 1 The query server 102 in FIG. Figure 2 As shown, the data query method includes the following steps S201 to S203.

[0107] S201, receiving a query request, the query request including a database identifier and a screening condition.

[0108] The database identifier is used to indicate the database to be queried, the screening condition is used to indicate the condition that the changed data to be queried must meet, and the query request is used to request to obtain the changed data that meets the screening condition from the database indicated by the database identifier.

[0109] S202: determine the database corresponding to the database identifier as a target database, and obtain a target binary log file from the target database.

[0110] The correspondence between the database identifier and the database can be predefined or preconfigured. The query server can obtain the database corresponding to the database identifier based on the correspondence and the database identifier in the query request, and record it as the target database. The target database is also the database to be queried.

[0111] The target database may store multiple binary log files, each of which can record multiple change data. The target binary log file can be understood as the binary log file to be queried in the target database, and the number of target binary log files can be one or more.

[0112] In a possible implementation, before the query server obtains the target binary log file from the target database, it first establishes a connection with the target database. Exemplarily, the query server can determine the connection parameters of the target database, such as the Internet Protocol (IP) address, port, user name and password information, and use the connection parameters to establish a connection with the target database.

[0113] It should be understood that the above password information can be uniformly authorized to the Binlog query platform. Users do not perceive the password information. Users only need to enter the database identifier on the Binlog query platform, and the query server can automatically connect to the target database, which helps to reduce possible information security risks.

[0114] S203, querying the change data recorded in the target binary log file according to the screening condition to obtain a target data set that meets the screening condition.

[0115] After the query server obtains the target binary log file, it can parse the target binary log file to obtain the change data recorded in the target binary log file, and filter out the change data that meets the filter conditions, and obtain the target data set based on the filtered change data, thereby obtaining the query result.

[0116] Through the above embodiments, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to provide a database identifier and a filtering condition, and the query server can obtain the change data that meets the filtering condition from the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0117] In a possible implementation, the screening condition includes a preset time range; obtaining a target binary log file from a target database may specifically include: obtaining a binary log file name list from the target database; selecting binary log file names one by one from the binary log file name list in chronological order, and obtaining corresponding binary log files one by one from the target database according to the selected binary log file names; each time a binary log file is obtained, the binary log file is parsed to obtain a recording time of the binary log file, and when the recording time meets the preset time range, the binary log file is determined as a target binary log file.

[0118] The preset time range refers to the time range to be queried, and can also be understood as the time range that the recording time of the change data to be queried must meet. Exemplarily, the preset time range is [T1, T2], where T1 represents the start date and T2 represents the end date. It should be understood that the preset time range can be set according to actual needs, and the embodiments of the present application do not limit this.

[0119] The binary log file name list may be a list consisting of all or part of the binary log file names in the target database. Optionally, the target database includes multiple binary log file name lists, and the query request may also include a list identifier to indicate the binary log file name list to be queried (recorded as the target binary log file name list). In this case, the binary log file name list obtained by the query server from the target database is the target binary log file name list.

[0120] The binary log file name list may include multiple binary log file names. Optionally, the multiple binary log file names in the binary log file name list are arranged in chronological order, for example, in chronological order from recent to distant, and the later the binary log file name is generated, the higher it is in the binary log file name list.

[0121] After the query server obtains the binary log file name list from the target database, the binary log file names are selected one by one from the binary log file name list in chronological order, for example, the binary log file names may be selected one by one in chronological order from recent to distant.

[0122] Each time the query server selects a binary log file name, it can send a backup (Dump) request to the server of the target database to obtain the binary log file corresponding to the binary log file name from the target database. Each time the query server obtains a binary log file, it performs a preliminary analysis on the binary log file, such as parsing the header content in the binary log file to obtain the recording time of the binary log file.

[0123] Exemplarily, the recording time of the binary log file may be the latest recording time of the binary log file, that is, the recording time of the latest change data in the binary log file. If the recording time of the binary log file meets the preset time range, it can be understood that the latest recording time is within the preset time range. If the recording time of the binary log file does not meet the preset time range, it can be understood that the latest recording time is earlier than the earliest time in the preset time range.

[0124] Optionally, when the recording time of the binary log file meets the preset time range, it can be considered that there is change data that meets the preset time range in the change data recorded in the binary log file, and thus the binary log file is determined as a target binary log file.

[0125] Optionally, when the recording time of the binary log file does not meet the preset time range, it can be considered that there is no change data that meets the preset time range in the change data recorded in the binary log file, and then it can be considered that there is no change data that meets the preset time range in the change data recorded in the binary log file corresponding to the binary log file name not selected in the binary log file name list. Therefore, the query server can stop selecting binary log file names from the binary log file name list and stop obtaining binary log files from the target database, thereby eliminating the need to traverse each binary log file name in the binary log file name list and its corresponding binary log file, thereby reducing the query time.

[0126] Through the above implementation, a preset time range is introduced into the screening condition, and the target binary log file is locked by judging whether the recording time of the binary log file is within the preset time range, which is conducive to quickly querying the change data that meets the preset time range.

[0127] In a possible implementation, the query request also includes a query end condition; querying the change data recorded in the target binary log file according to the filtering condition to obtain a target data set that meets the filtering condition may specifically include: parsing the target binary log files one by one to obtain the change data recorded in the target binary log file; each time a change data that meets the filtering condition is obtained, the change data that meets the filtering condition is determined as a target data, and when the query end condition is met, parsing is stopped, and the set of target data is used as the target data set.

[0128] The query end condition refers to the condition to be met for terminating the query, and the query end condition may include one or more conditions. Optionally, when the query end condition includes multiple conditions, when any one of the multiple conditions is met, the query end condition is determined to be met. It should be understood that the query end condition can be specifically set according to actual needs, and the embodiments of the present application do not limit this.

[0129] Each time the query server determines a target binary log file, it parses the target binary log file, for example, by parsing the main content of the target binary log file, and can obtain the change data recorded in the target binary log file. Each time the query server obtains a change data, it can determine whether the change data meets the screening conditions. Each time it obtains a change data that meets the screening conditions, it can determine the change data that meets the screening conditions as a target data. When the query end condition is met, the query server can stop parsing the target binary log file and use the determined set of target data as the target data set.

[0130] Through the above implementation, a query end condition is introduced. When the query end condition is met, obtaining the target binary log file from the database and filtering the target data from the target binary log file can be stopped, which is conducive to reducing the impact on the database.

[0131] In a possible implementation, the query end condition includes a preset number of data items; when the number of target data items reaches the preset number of data items, it is determined that the query end condition is satisfied.

[0132] Among them, the preset number of data items refers to the maximum limit number of target data items. It should be understood that the preset number of data items can be set according to actual needs, and the embodiments of the present application do not limit this.

[0133] Exemplarily, the query server may count the number of target data, with the count starting from zero, and increasing by one each time a target data is determined. When the count reaches a preset number of data, it is determined that the query end condition is satisfied.

[0134] Through the above implementation, a limit mechanism is introduced, and the query can be terminated when the number of target data reaches a preset number of data, which is helpful to reduce the impact on the database.

[0135] In a possible implementation, the query termination condition includes a preset timeout period; when the query time reaches the preset timeout period, it is determined that the query termination condition is satisfied.

[0136] The preset timeout refers to the maximum limit of the query, that is, the maximum limit of the query time, which can be the time from the time when the query server receives the query request. It should be understood that the preset timeout can be set according to actual needs, and the embodiment of the present application does not limit this.

[0137] Exemplarily, the query server starts timing from when the query request is received, and when the timing reaches a preset timeout period, it is determined that the query end condition is met.

[0138] Through the above implementation, a time limit mechanism is introduced, and the query can be terminated when the query time reaches the preset timeout time, which is helpful to reduce the impact on the database.

[0139] In a possible implementation, the screening condition includes a preset change type and / or a preset column value.

[0140] The preset change type refers to the change type to be queried, for example, it may include one or more of insertion, modification and deletion. The preset column value refers to the column value to be queried, for example, for the "city" column, the column value to be queried may include one or more specific city names.

[0141] Through the above implementation, the preset change type and / or preset column value are introduced into the screening condition, which is conducive to quickly querying the change data that meets the preset change type and / or preset column value.

[0142] In a possible implementation, after obtaining the target data set, the query server may further: obtain table structure information corresponding to the query request; and encapsulate the target data set according to the table structure information.

[0143] The table structure information is used to construct the query result, which can be understood as the result obtained by encapsulating the target data set using the table structure information. For example, the table structure information may include field names such as column names, values ​​before and after changes, and allows users to customize modifications to cope with scenarios where the table structure changes.

[0144] Through the above implementation, the target data set is encapsulated according to the table structure information, which can enhance the readability of the query result, make the query result more intuitive, and help lower the threshold of understanding.

[0145] See also Figure 3 , Figure 3 is a flow chart of another data query method provided in an embodiment of the present application, which can be applied to Figure 1 The query terminal 101 in FIG. Figure 3 As shown, the data query method includes the following steps S301 to S303.

[0146] S301, receiving a query instruction, wherein the query instruction includes a database identifier and a screening condition.

[0147] Exemplarily, a user can log in to the Binlog query platform through a query terminal, and then enter relevant information on the query page of the Binlog query platform, such as a database identifier and a filter condition, and optionally, a query end condition and / or a list identifier. After the user enters relevant information on the query page, the query control can be triggered to initiate a query instruction, and accordingly, the query terminal receives the query instruction initiated by the user, and the query instruction can carry the relevant information entered by the user on the query page.

[0148] The screening conditions may include any one or more of a preset time range, a preset change type, and a preset column value, and the query end condition may include a preset number of data items and / or a preset timeout period.

[0149] See also Figure 4 , Figure 4 It is a schematic diagram of a query page of a Binlog query platform provided in an embodiment of the present application. The query page includes a library input box, a table input box, a time range input box, an event type input box, a limit number of entries (Limit) input box and a timeout (TimeOut) input box. The user can enter relevant information in the above input box, corresponding to the database identifier, list identifier, preset time range, preset change type, preset number of data entries and preset timeout time in the previous embodiment. Based on this, white screen process operation can be realized, which is more standardized and conducive to reducing the risk of misoperation.

[0150] Optionally, the user can also view the Binlog file list (for example, including file name, file size), Binlog related parameter list, Binlog start and end time, earliest Binlog time, etc. on the Binlog query platform.

[0151] S302, sending a query request to a query server, wherein the query request includes a database identifier and a filter condition, and is used to request to obtain a target data set that meets the filter condition from a binary log file in a target database, wherein the target database is a database corresponding to the database identifier.

[0152] In response to the query instruction, the query terminal sends a query request to the query server, which may include relevant information entered by the user on the query page, such as a database identifier and filter conditions, and optionally, a query end condition and / or a list identifier.

[0153] The screening conditions may include any one or more of a preset time range, a preset change type, and a preset column value, and the query end condition may include a preset number of data items and / or a preset timeout period.

[0154] In response to the query request, the query server obtains the target data set that meets the screening condition from the binary log file in the target database, and returns the target data set to the query terminal.

[0155] S303, display the target data set.

[0156] After receiving the target data set returned by the query server, the query terminal can display the target data set for the user to view. Optionally, the query server can also encapsulate the target data set using the table structure information and return the encapsulated target data set to the query terminal, which displays the encapsulated target data set.

[0157] It should be understood that for the contents not specifically described in the above steps S301 to S303, reference can be made to the relevant descriptions in the previous embodiments, and they will not be repeated here.

[0158] Through the above embodiment, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to input the database identifier and the filtering condition through the query terminal and initiate the query instruction. The query terminal can obtain and display the change data that meets the filtering condition in the target database corresponding to the database identifier, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0159] See also Figure 5 , Figure 5 is a flow chart of another data query method provided in an embodiment of the present application. The data query method is described by taking the interaction between the query terminal, the query server and the target database as an example. For example, the query terminal may be Figure 1 The query terminal 101 in the query server may be Figure 1 The query server 102 in the target database may be Figure 1 The database 103 in. Figure 5 As shown, the data query method includes the following steps S501 to S516.

[0160] S501, the query terminal sends a query request to the query server, and correspondingly, the query server receives the query request from the query terminal.

[0161] The query request includes a database identifier, a filter condition and a query end condition. The filter condition includes a preset time range, and optionally, the filter condition also includes a preset change type and / or a preset column value. The query end condition includes a preset number of data items and / or a preset timeout period.

[0162] S502: query the server to determine the target database.

[0163] After receiving the query request from the query terminal, the query server may obtain a database identifier from the query request and determine the database corresponding to the database identifier as the target database.

[0164] S503, the query server sends a connection request to the target database, and correspondingly, the target database receives the connection request from the query server.

[0165] After the query server determines the target database, it can further determine the connection parameters of the target database (referred to as target connection parameters), which are used to establish a connection with the target database. Specifically, the query server can pre-store the correspondence between the database identifier and the connection parameters, and the query server can obtain the target connection parameters corresponding to the target database based on the correspondence and the identifier of the target database.

[0166] The connection request sent by the query server to the target database may include the target connection parameters for establishing a connection with the target database. Specifically, the target connection parameters may include the IP address and port of the target database, and the user name and password information for connecting to the target database.

[0167] S504, the target database sends confirmation information to the query server, and correspondingly, the query server receives the confirmation information from the target database.

[0168] After receiving the connection request from the query server, the target database may verify the target connection parameters in the connection request. If the verification passes, a confirmation message may be sent to the query server, so that the query server is successfully connected to the target database.

[0169] S505, the query server sends a request for obtaining a binary log file name list to the target database, and correspondingly, the target database receives the request for obtaining a binary log file name list from the query server.

[0170] After the query server successfully connects to the target database, it can request the target database to obtain a list of binary log file names. Optionally, the query request sent by the query terminal to the query server also includes a list identifier. After receiving the query request from the query terminal, the query server can also obtain the list identifier from the query request and request the target database to obtain a list of binary log file names indicated by the list identifier.

[0171] S506, the target database returns a binary log file name list to the query server, and correspondingly, the query server receives the binary log file name list from the target database.

[0172] After receiving the request for obtaining the binary log file name list from the query server, the target database may return the binary log file name list to the query server.

[0173] S507: The query server selects the current binary log file name from the binary log file name list.

[0174] After the query server obtains the binary log file name list from the target database, the current binary log file name can be selected from the binary log file name list. The current binary log file name refers to the latest binary log file name among the binary log file names that have not been selected in the binary log file name list. The latest binary log file name can be understood as the latest generated binary log file name.

[0175] For example, the binary log file name list includes n binary log file names. The n binary log file names in the binary log file name list can be sorted in time order from recent to far. The more recent the binary log file name is, the earlier it is in the binary log file name list. The n binary log file names sorted in time order from recent to far are binary log file name D1, binary log file name D2, ..., binary log file name D n .

[0176] Assume that the query server selects the current binary log file name from the binary log file name list for the first time, then the binary log file names that are not selected at this time include binary log file names D1 to D n , the current binary log file name is binary log file name D1; suppose the query server selects the current binary log file name from the binary log file name list for the second time, since binary log file name D1 has been selected, the binary log file names that have not been selected at this time include binary log file names D2~D n, the current binary log file name at this time is binary log file name D2. And so on, the current binary log file name selected each time can be determined.

[0177] S508, the query server sends a request for obtaining the current binary log file to the target database, and correspondingly, the target database receives the request for obtaining the current binary log file from the query server.

[0178] The current binary log file refers to the binary log file corresponding to the current binary log file name. After the query server selects the current binary log file name, it can request the target database to obtain the binary log file corresponding to the current binary log file name, that is, request to obtain the current binary log file.

[0179] S509: The target database returns the current binary log file to the query server, and correspondingly, the query server receives the current binary log file from the target database.

[0180] After receiving the request for obtaining the current binary log file from the query server, the target database may return the current binary log file to the query server.

[0181] S510, the query server parses the current binary log file to obtain the recording time of the current binary log file.

[0182] After the query server obtains the current binary log file from the target database, it can perform a preliminary analysis on the current binary log file, for example, analyzing the header content in the current binary log file to obtain the recording time of the current binary log file. The recording time of the current binary log file can be the most recent recording time of the current binary log file, that is, the recording time of the most recent change data.

[0183] S511: When the query server determines that the recording time of the current binary log file meets the preset time range, the current binary log file is determined as the current target binary log file.

[0184] After the query server obtains the recording time of the current binary log file, it determines whether the recording time of the current binary log file meets the preset time range. Optionally, if the query server determines that the recording time of the current binary log file meets the preset time range, the current binary log file is determined as a current target binary log file. Optionally, if the query server determines that the recording time of the current binary log file does not meet the preset time range, the query is stopped.

[0185] S512, the query server reads the current change data from the current target binary log file.

[0186] After the query server determines the current target binary log file, it can parse the current target binary log file, for example, parse the main content of the current target binary log file, so as to read the change data in the current target binary log file in sequence. The current change data refers to the latest change data in the change data that has not been read in the current target binary log file, and the latest change data can be understood as the latest generated change data.

[0187] For example, the current target binary log file contains m change data, which are change data J1, change data J2, ..., change data J1, in order from recent to old. m The query server parses the current target binary log file and reads the change data J1, change data J2, ..., change data J in sequence. m .

[0188] Assume that the query server reads the current change data from the current target binary log file for the first time. The change data that has not been read at this time includes change data J1 to J m , the current changed data at this time is changed data J1; assuming that the query server reads the current changed data from the current target binary log file for the second time, since the changed data J1 has been read, the unread changed data at this time includes changed data J2~J m , the current changed data at this time is the changed data J2. Similarly, the current changed data read each time can be determined.

[0189] S513: When the query server determines that the current changed data meets the screening condition, the current changed data is determined as the target data.

[0190] After the query server reads the current change data, it determines whether the current change data meets the screening condition. Optionally, if the query server determines whether the current change data meets the screening condition, the current change data is determined as a target data. Optionally, if the query server determines that the current change data does not meet the screening condition, it returns to step S512 and loops through steps S512 to S513.

[0191] Optionally, if the query end condition is not met when all the change data in the current target binary log file is read, the process returns to step S507, and steps S507 to S513 are executed in a loop until the query end condition is met and the query is stopped. Optionally, if the query end condition is met before all the change data in the current target binary log file is read, the query is stopped when the query end condition is met.

[0192] S514: The query server uses the determined set of target data as a target data set.

[0193] After the query server determines all the target data, it can use the collection of all the target data as the target data set, that is, obtain the query result.

[0194] S515, the query server returns the target data set to the query terminal, and correspondingly, the query terminal receives the target data set from the query server.

[0195] After the query server obtains the target data set, it can return the target data set to the query terminal for the user to view.

[0196] S516, the query terminal displays the target data set.

[0197] After receiving the target data set from the query server, the query terminal can display the target data set for the user to view. Optionally, the query server can also encapsulate the target data set using the table structure information and return the encapsulated target data set to the query terminal, which can display the encapsulated target data set.

[0198] It should be understood that for the contents not specifically described in the above steps S501 to S516, reference can be made to the relevant descriptions in the previous embodiments, and they will not be repeated here.

[0199] Through the above embodiment, the filtering function is supported in the binary log file query, which is more flexible and convenient for users to use. The user only needs to input the database identifier, the filtering condition and the query end condition through the query terminal and initiate the query instruction. The query server can obtain the change data that meets the filtering condition from the target database corresponding to the database identifier, and end the query when the query end condition is met, and return the change data that meets the filtering condition to the query terminal. The query terminal can obtain and display the change data that meets the filtering condition, which simplifies the query operation, reduces the redundant information in the query results, and helps to improve the query efficiency.

[0200] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0201] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0202] See also Figure 6 , Figure 6 6 is a schematic diagram of a data query device provided in an embodiment of the present application. The data query device 600 includes: a receiving unit 601, an acquiring unit 602 and a query unit 603, wherein:

[0203] The receiving unit 601 is used to receive a query request, wherein the query request includes a database identifier and a screening condition;

[0204] An acquisition unit 602 is used to determine the database corresponding to the database identifier as a target database, and acquire a target binary log file from the target database;

[0205] The query unit 603 is used to query the change data recorded in the target binary log file according to the screening condition to obtain the target data set that meets the screening condition.

[0206] In some possible implementations, the screening condition includes a preset time range; when the acquisition unit 602 acquires the target binary log file from the target database, it is specifically used to: acquire a binary log file name list from the target database; select binary log file names one by one from the binary log file name list in chronological order, and acquire corresponding binary log files one by one from the target database according to the selected binary log file names; each time a binary log file is acquired, the binary log file is parsed to obtain a recording time of the binary log file, and when the recording time meets the preset time range, the binary log file is determined as a target binary log file.

[0207] In some possible implementations, the query request also includes a query end condition; when the query unit 603 queries the change data recorded in the target binary log file according to the filtering condition to obtain the target data set that meets the filtering condition, it is specifically used to: parse the target binary log file one by one to obtain the change data recorded in the target binary log file; each time a change data that meets the filtering condition is obtained, the change data that meets the filtering condition is determined as a target data, and when the query end condition is met, the parsing is stopped, and the set of target data is used as the target data set.

[0208] In some possible implementations, the query end condition includes a preset number of data items; the query unit 603 is further configured to: when the number of target data items reaches the preset number of data items, determine that the query end condition is satisfied.

[0209] In some possible implementations, the query termination condition includes a preset timeout period; the query unit 603 is further configured to: when the query time reaches the preset timeout period, determine that the query termination condition is satisfied.

[0210] In some possible implementations, the screening condition includes a preset change type and / or a preset column value.

[0211] In some possible implementations, the query unit 603 is further configured to: obtain table structure information corresponding to the query request; and encapsulate the target data set according to the table structure information.

[0212] See also Figure 7 , Figure 7 is a schematic diagram of the structure of another data query device provided in an embodiment of the present application. The data query device 700 includes: a receiving unit 701, a sending unit 702 and a display unit 703, wherein:

[0213] The receiving unit 701 is used to receive a query instruction, wherein the query instruction includes a database identifier and a screening condition;

[0214] A sending unit 702 is used to send a query request to the query platform server, wherein the query request includes a database identifier and a filtering condition, and is used to request to obtain a target data set that meets the filtering condition from a binary log file in a target database, wherein the target database is a database corresponding to the database identifier;

[0215] The display unit 703 is used to display the target data set.

[0216] For the specific definition of the data query device, please refer to the definition of the data query method above, which will not be repeated here. Each unit in the above-mentioned data query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned units can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned units.

[0217] See also Figure 8 , Figure 8 800 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 800 includes a memory 801 and a processor 802. Optionally, the electronic device 800 also includes a communication interface 803 and a bus 804. The memory 801, the processor 802 and the communication interface 803 are connected to each other through the bus 804. The memory 801 stores a computer program, and the processor 802 is used to execute the computer program stored in the memory 801 to implement the methods in the above-mentioned method embodiments.

[0218] In a possible design, the electronic device 800 may correspond to the query server in the above method embodiment, and the electronic device 800 may include a component for executing the operation performed by the query server in the above method embodiment, and each component in the electronic device 800 is respectively to implement the operation performed by the query server in the above method embodiment, and the processor 802 calls the computer program stored in the memory 801 to execute the above data query method, which may be specifically as follows:

[0219] A query request is received, wherein the query request includes a database identifier and a filtering condition; a database corresponding to the database identifier is determined as a target database, and a target binary log file is obtained from the target database; and change data recorded in the target binary log file is queried according to the filtering condition to obtain a target data set that meets the filtering condition.

[0220] In a possible implementation, the screening condition includes a preset time range; obtaining a target binary log file from a target database includes: obtaining a binary log file name list from the target database; selecting binary log file names one by one from the binary log file name list in chronological order, and obtaining corresponding binary log files one by one from the target database according to the selected binary log file names; each time a binary log file is obtained, the binary log file is parsed to obtain a recording time of the binary log file, and when the recording time meets the preset time range, the binary log file is determined as a target binary log file.

[0221] In a possible implementation, the query request also includes a query end condition; querying the change data recorded in the target binary log file according to the filtering condition to obtain a target data set that meets the filtering condition, including: parsing the target binary log files one by one to obtain the change data recorded in the target binary log file; each time a change data that meets the filtering condition is obtained, the change data that meets the filtering condition is determined as a target data, and when the query end condition is met, parsing is stopped, and the set of target data is used as the target data set.

[0222] In a possible implementation, the query end condition includes a preset number of data items; the method further includes: when the number of target data items reaches the preset number of data items, determining that the query end condition is satisfied.

[0223] In a possible implementation, the query termination condition includes a preset timeout period; the method further includes: when the query time reaches the preset timeout period, determining that the query termination condition is satisfied.

[0224] In a possible implementation, the screening condition includes a preset change type and / or a preset column value.

[0225] In a possible implementation, the method further includes: acquiring table structure information corresponding to the query request; and encapsulating the target data set according to the table structure information.

[0226] In another possible design, the electronic device 800 may correspond to the query terminal in the above method embodiment, and the electronic device 800 may include a component for executing the operation performed by the query terminal in the above method embodiment, and each component in the electronic device 800 is respectively to implement the operation performed by the query terminal in the above method embodiment, and the processor 802 calls the computer program stored in the memory 801 to execute the above data query method, which may be specifically as follows:

[0227] Receive a query instruction, which includes a database identifier and a filter condition; send a query request to a query server, which includes a database identifier and a filter condition, and is used to request to obtain a target data set that meets the filter condition from a binary log file in a target database, where the target database is a database corresponding to the database identifier; and display the target data set.

[0228] In a possible implementation, the screening condition includes a preset time range.

[0229] In a possible implementation manner, the query instruction further includes a query end condition, and the query request further includes a query end condition.

[0230] In a possible implementation, the query end condition includes a preset number of data items and / or a preset timeout period.

[0231] In a possible implementation, the screening condition includes a preset change type and / or a preset column value.

[0232] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the methods in the above-mentioned method embodiments are implemented.

[0233] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the method in the above-mentioned method embodiments is implemented.

[0234] It should be understood that the memory / readable storage medium in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a hard disk drive (HDD), a solid-state drive (SSD), a read-only memory (ROM) or a flash memory, etc. The volatile memory may be a random access memory (RAM) or an external cache memory. As an illustration and not limitation, RAM may be in various forms, such as a static random access memory (SRAM) or a dynamic random access memory (DRAM), etc.

[0235] The processor in the embodiments of the present application may be a combination of one or more processing modules such as a central processing unit (CPU), a graphics processing unit (GPU) or a microprocessor (MPU), and may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0236] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0237] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.

Claims

1. A data query method, characterized in that: The method comprises: Receiving a query request, wherein the query request includes a database identifier, a list identifier, and a screening condition; Determine the database corresponding to the database identifier as the target database, and obtain a target binary log file from the target database; Query the change data recorded in the target binary log file according to the screening condition to obtain a target data set that meets the screening condition; The screening condition includes a preset time range; and obtaining a target binary log file from the target database includes: A binary log file name list indicated by the list identifier is obtained from the target database, wherein the multiple binary log file names in the binary log file name list are sorted in a time sequence from recent to distant, and the later the binary log file name is generated, the higher the ranking is in the binary log file name list, and each binary log file name corresponds to a binary log file, and the binary log file is a file for recording change operations of the target database, and each change operation corresponds to a change data. The multiple change data recorded in the binary log file are sorted in a time sequence from recent to distant, and the later the change data is generated, the higher the ranking is in the binary log file; Selecting binary log file names one by one from the binary log file name list in chronological order from recent to distant, and acquiring corresponding binary log files one by one from the target database according to the selected binary log file names; Each time a binary log file is obtained, the binary log file is parsed to obtain the recording time of the most recent change data in the binary log file; when the recording time is within the preset time range, the binary log file is determined as the target binary log file; when the recording time is earlier than the earliest time in the preset time range, the binary log file name is stopped from being selected from the binary log file name list and the corresponding binary log file is stopped from being obtained from the target database; The querying of the change data recorded in the target binary log file according to the screening condition to obtain the target data set that meets the screening condition includes: Read the change data one by one from the target binary log file in time order from recent to far, determine whether the change data meets the filtering condition, and each time a change data meeting the filtering condition is determined, determine the change data meeting the filtering condition as a target data, and the target data set includes the target data.

2. The method according to claim 1, characterized in that The query request also includes a query end condition; the querying of the change data recorded in the target binary log file according to the screening condition to obtain a target data set that meets the screening condition also includes: Parsing the target binary log files one by one to obtain the change data recorded in the target binary log files; When the query end condition is met, parsing is stopped and the set of target data is used as the target data set.

3. The method according to claim 2, characterized in that The query end condition includes a preset number of data items; the method further includes: When the number of target data items reaches the preset number of data items, it is determined that the query end condition is met.

4. The method according to claim 2, characterized in that: The query end condition includes a preset timeout period; the method further includes: When the query time reaches the preset timeout time, it is determined that the query end condition is met.

5. The method according to any one of claims 1 to 4, characterized in that The screening condition includes a preset change type and / or a preset column value.

6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Obtaining table structure information corresponding to the query request; The target data set is encapsulated according to the table structure information.

7. A data query method, characterized in that: The method comprises: Receiving a query instruction, wherein the query instruction includes a database identifier, a list identifier, and a screening condition; Sending a query request to a query server, wherein the query request includes the database identifier, the list identifier, and the screening condition, and is used to request obtaining a target data set that meets the screening condition from a target binary log file in a target database, wherein the target database is a database corresponding to the database identifier; displaying the target data set; The screening condition includes a preset time range; the target binary log file is obtained in the following manner: A binary log file name list indicated by the list identifier is obtained from the target database, wherein the multiple binary log file names in the binary log file name list are sorted in a time sequence from recent to distant, and the later the binary log file name is generated, the higher the ranking is in the binary log file name list, and each binary log file name corresponds to a binary log file, and the binary log file is a file for recording change operations of the target database, and each change operation corresponds to a change data. The multiple change data recorded in the binary log file are sorted in a time sequence from recent to distant, and the later the change data is generated, the higher the ranking is in the binary log file; Selecting binary log file names one by one from the binary log file name list in chronological order from recent to distant, and acquiring corresponding binary log files one by one from the target database according to the selected binary log file names; Each time a binary log file is obtained, the binary log file is parsed to obtain the recording time of the most recent change data in the binary log file; when the recording time is within the preset time range, the binary log file is determined as the target binary log file; when the recording time is earlier than the earliest time in the preset time range, the binary log file name is stopped from being selected from the binary log file name list and the corresponding binary log file is stopped from being obtained from the target database; The method for acquiring the target data set includes: reading change data one by one from the target binary log file in time order from recent to far, determining whether the change data meets the screening condition, and each time a change data meeting the screening condition is determined, determining the change data meeting the screening condition as a target data, and the target data set includes the target data.

8. A data query device, characterized in that: The device comprises: A receiving unit, configured to receive a query request, wherein the query request includes a database identifier, a list identifier, and a screening condition; an acquiring unit, configured to determine the database corresponding to the database identifier as a target database, obtain target connection parameters corresponding to the target database according to the database identifier and a pre-stored correspondence between the database identifier and the connection parameters, establish a connection with the target database according to the target connection parameters, and acquire a target binary log file from the target database; A query unit, configured to query the change data recorded in the target binary log file according to the screening condition to obtain a target data set that meets the screening condition; Wherein, the screening condition includes a preset time range; when the acquisition unit acquires the target binary log file from the target database, it is specifically used to: A binary log file name list indicated by the list identifier is obtained from the target database, wherein the multiple binary log file names in the binary log file name list are sorted in a time sequence from recent to distant, and the later the binary log file name is generated, the higher the ranking is in the binary log file name list, and each binary log file name corresponds to a binary log file, and the binary log file is a file for recording change operations of the target database, and each change operation corresponds to a change data. The multiple change data recorded in the binary log file are sorted in a time sequence from recent to distant, and the later the change data is generated, the higher the ranking is in the binary log file; Selecting binary log file names one by one from the binary log file name list in chronological order from recent to distant, and acquiring corresponding binary log files one by one from the target database according to the selected binary log file names; Each time a binary log file is obtained, the binary log file is parsed to obtain the recording time of the most recent change data in the binary log file; when the recording time is within the preset time range, the binary log file is determined as the target binary log file; when the recording time is earlier than the earliest time in the preset time range, the binary log file name is stopped from being selected from the binary log file name list and the corresponding binary log file is stopped from being obtained from the target database; The query unit queries the change data recorded in the target binary log file according to the screening condition, and when obtaining the target data set that meets the screening condition, is specifically used to: Read the change data one by one from the target binary log file in time order from recent to far, determine whether the change data meets the filtering condition, and each time a change data meeting the filtering condition is determined, determine the change data meeting the filtering condition as a target data, and the target data set includes the target data.

9. A data query device, characterized in that: The device comprises: A receiving unit, configured to receive a query instruction, wherein the query instruction includes a database identifier, a list identifier, and a screening condition; A sending unit, configured to send a query request to a query platform server, wherein the query request includes the database identifier, the list identifier, and the screening condition, and is configured to request to obtain a target data set that meets the screening condition from a target binary log file in a target database, wherein the target database is a database corresponding to the database identifier; A display unit, used for displaying the target data set; The screening condition includes a preset time range; the target binary log file is obtained in the following manner: A binary log file name list indicated by the list identifier is obtained from the target database, wherein the multiple binary log file names in the binary log file name list are sorted in a time sequence from recent to distant, and the later the binary log file name is generated, the higher the ranking is in the binary log file name list, and each binary log file name corresponds to a binary log file, and the binary log file is a file for recording change operations of the target database, and each change operation corresponds to a change data. The multiple change data recorded in the binary log file are sorted in a time sequence from recent to distant, and the later the change data is generated, the higher the ranking is in the binary log file; Selecting binary log file names one by one from the binary log file name list in chronological order from recent to distant, and acquiring corresponding binary log files one by one from the target database according to the selected binary log file names; Each time a binary log file is obtained, the binary log file is parsed to obtain the recording time of the most recent change data in the binary log file; when the recording time is within the preset time range, the binary log file is determined as the target binary log file; when the recording time is earlier than the earliest time in the preset time range, the binary log file name is stopped from being selected from the binary log file name list and the corresponding binary log file is stopped from being obtained from the target database; The method for acquiring the target data set includes: reading change data one by one from the target binary log file in time order from recent to far, determining whether the change data meets the screening condition, and each time a change data meeting the screening condition is determined, determining the change data meeting the screening condition as a target data, and the target data set includes the target data.

10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

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

12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Data inquiry method and data inquiry system

    CN104516920A

  • Big data query method, system, computer and storage medium

    CN108009236A

  • Log query method and device, equipment and storage medium

    CN115658998A

  • Log retrieval method, log retrieval device, equipment and storage medium

    CN116795974A