Data comparison method, device and equipment
Through automated data comparison methods and devices, the inefficiency and error problems of data comparison under a multi-level, complex-associated multi-source heterogeneous database architecture are solved, and the automatic execution of data comparison plans is realized, which improves the efficiency of data synchronization and migration.
Patent Information
- Application Number
- CN202311451965.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2043-11-02
AI Technical Summary
Under a multi-level, complex association multi-source heterogeneous database architecture, data comparison is inefficient and error-prone, and the existing technology relies on manual operations to lead to inefficiency.
Provide a data comparison method and device, by obtaining the data comparison plan, automatically execute the parent node and child node query statements, and realize the automated execution of the data comparison plan, including obtaining the parent node data and child node data until the comparison result of the preset vertical tree structure is completed.
It improves the efficiency of data comparison, avoids frequent query statement writing in manual operations, and improves the efficiency of work scenarios such as data synchronization, data migration, system reconstruction and business verification testing.
Smart Images

Figure CN117271526B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data comparison method, device and equipment. Background Art
[0002] Currently, multi-source heterogeneous database architecture is gradually becoming a new trend. Under this architecture, the formats of different database products vary significantly, and even the data table structures are inconsistent. Multiple levels are involved, and the relationships between data are complex. Therefore, scenarios that require data comparison, such as data synchronization, data migration, and parallel operation of old and new systems, are cumbersome and prone to errors.
[0003] Currently, multi-level and complexly associated data comparisons can only rely on manual writing of subsequent query statements based on the results of previous steps, which greatly reduces work efficiency and is prone to errors. Summary of the Invention
[0004] In view of this, the present invention provides a data comparison method, device and equipment, which can solve the technical problems of low efficiency and easy error in multi-level and complex associated data comparison.
[0005] According to a first aspect of the present invention, a data comparison method is provided, the method comprising:
[0006] Obtaining a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases;
[0007] Execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a set of parent node data, wherein the parent node query statements include database names, table names, and field names, and compare the parent node data in the same group;
[0008] Obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and query parameters to be input, execute the second-level child node query statement, obtain a group of second-level child node data, compare the same group of second-level child node data, until the data comparison plan is executed and the comparison result of the preset vertical tree structure data is obtained.
[0009] Preferably, before obtaining the data comparison plan, the method further includes:
[0010] Receive configuration of database parameters;
[0011] After obtaining the data comparison plan, it also includes:
[0012] obtaining the database parameters from the data comparison plan;
[0013] The databases to be queried and compared are connected according to the database parameters.
[0014] Preferably, before obtaining the data comparison plan, the method further includes:
[0015] Receiving selection of a preset vertical tree structure to be queried and compared;
[0016] After obtaining the data comparison plan, it also includes:
[0017] The parent node query statement and child node query statement template corresponding to the preset vertical tree structure are filtered.
[0018] Preferably, the method further comprises:
[0019] Filtering the comparison results for first different field values that exist in the database but are different, and obtaining first field names corresponding to the first different field values;
[0020] Obtain the correspondence between the pre-set field name and the difference permission rule, determine the first different field value with the correspondence as the target first different field value, judge whether the difference between the target first different field values satisfies the difference permission rule corresponding to the target field name, and update and filter the second different field value in the comparison result according to the judgment result.
[0021] Preferably, updating and filtering the second different field value in the comparison result according to the judgment result includes:
[0022] Converting the first different field values that satisfy the difference permission rule into the same field value;
[0023] The first different field value that does not satisfy the difference permission rule and the first different field value that does not have the corresponding relationship are determined as the second different field value in the comparison result.
[0024] Preferably, the method further comprises:
[0025] The comparison results are displayed according to their categories.
[0026] According to a second aspect of the present invention, there is provided a data comparison device, comprising:
[0027] An acquisition module, configured to acquire a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases;
[0028] a parent node execution module, configured to execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan, obtain a set of parent node data, wherein the parent node query statements include database names, table names, and field names, and compare the parent node data in the same group;
[0029] The child node execution module is used to obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and query parameters to be input, execute the second-level child node query statement, obtain a group of second-level child node data, compare the same group of second-level child node data, until the data comparison plan is executed and the comparison result of the preset vertical tree structure data is obtained.
[0030] Preferably, the method further comprises: a screening module for screening first different field values that exist in the comparison result but are different in the database, and obtaining first field names corresponding to the first different field values;
[0031] Obtain the correspondence between the pre-set field name and the difference permission rule, determine the first different field value with the correspondence as the target first different field value, judge whether the difference between the target first different field values satisfies the difference permission rule corresponding to the target field name, and update and filter the second different field value in the comparison result according to the judgment result.
[0032] According to a third aspect of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned data comparison method is implemented.
[0033] According to the fourth aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned data comparison method when executing the program.
[0034] By means of the above technical solution, the present invention provides a data comparison method, device and equipment, which can first obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; then execute a group of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a group of parent node data, wherein the parent node query statement includes the database name, table name and field name, and compares the same group of parent node data; further obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and the query parameter to be input, execute the second-level child node query statement, obtain a group of second-level child node data, and compare the same group of second-level child node data until the data comparison plan is completed and the comparison result of the preset vertical tree structure data is obtained. Through the technical solution of the present invention, the tree structure includes a first-level parent node, a second-level child node,...an n-th-level child node. By automatically inputting the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, the first-level parent node and the second-level child node are automatically connected. Similarly, the entire tree structure is automatically connected, that is, the entire data comparison plan can be automatically executed and completed, without the need for manual writing of subsequent query statements based on the previous query results, thereby improving the efficiency of data comparison.
[0035] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation on the local application. In the drawings:
[0037] Figure 1 A schematic diagram of a data comparison method according to an embodiment of the present invention is shown;
[0038] Figure 2 A schematic diagram showing a flow chart of another data comparison method provided by an embodiment of the present invention is shown;
[0039] Figure 3 A schematic structural diagram of a data comparison device provided by an embodiment of the present invention is shown;
[0040] Figure 4A schematic structural diagram of another data comparison device provided by an embodiment of the present invention is shown;
[0041] Figure 5 A schematic diagram of a vertical tree structure of two databases provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0042] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other.
[0043] This embodiment provides a data comparison method, such as Figure 1 As shown, the method includes:
[0044] 101. Obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases.
[0045] It should be noted that the database targeted by this embodiment is: data is distributed in a tree structure, wherein the tree structure includes multiple vertical and multi-layers, the vertical corresponds to the table name, each vertical tree structure is composed of nodes, each node corresponds to the field name, specifically, the first layer of each vertical tree structure has at least one first-layer parent node, the second layer is branched from the first-layer parent node into at least one second-layer child node, the third layer continues to branch from the second-layer child node that can continue to branch, until the n-th layer child node can no longer branch, thus ending.
[0046] like Figure 5 The figure shows a schematic diagram of a vertical tree structure for two databases (database 1 and database 2). Database 1 has one first-level parent node. The second level branches out from the first-level parent node into three second-level child nodes. The third level branches out from each second-level child node into a third-level child node. The third-level child nodes cannot branch out further. Database 2 has one first-level parent node. The second level branches out from the first-level parent node into four second-level child nodes. The third level branches out from each second-level child node into a third-level child node. The third-level child nodes cannot branch out further.
[0047] The data comparison plan is pre-defined. Its purpose is to perform data queries and comparisons on data in a pre-set vertical tree structure between at least two databases. The first-level parent node corresponds to a parent node query statement, the second-level child node corresponds to a second-level child node query statement template, and so on. The nth-level child node corresponds to an nth-level child node query statement template. Whether it's a query statement or a query statement template, the data comparison plan's target is represented by including the database name, the table name corresponding to the vertical tree, and the field name corresponding to the node.
[0048] 102. Execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a set of parent node data, wherein the parent node query statements include a database name, a table name, and a field name, and compare the parent node data in the same group.
[0049] For this embodiment, if there are two databases to be queried and compared, then there are two parent node query statements, which represent queries on the two databases respectively. If there are three databases to be queried and compared, then there are three parent node query statements, which represent queries on the three databases respectively. Taking the case of two databases to be queried and compared as an example, the first-level parent node includes at least one. Taking the case of one first-level parent node as an example, Figure 5 As shown, a set of parent node query statements corresponding to this first-level parent node are: Query statement 1 for database 1: query database 1, income table, and field a (the reason for querying field a in the income table is because the first-level parent node in the income table of database 1 has and only has field a), and obtain the field value corresponding to field a, which is the parent node data a corresponding to database 1; Query statement 2 for database 2: query database 2, income table, and field a (the reason for querying field a in the income table is because the first-level parent node in the income table of database 2 has and only has field a), and obtain the field value corresponding to field a, which is the parent node data a corresponding to database 2.
[0050] The query obtains the parent node data of the same group: the parent node data a corresponding to database 1 and the parent node data a corresponding to database 2. When comparing, the parent node data a corresponding to database 1 and the parent node data a corresponding to database 2 are compared to determine whether they are the same or different.
[0051] 103. Obtain a set of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and query parameters to be input, execute the second-level child node query statement, obtain a set of second-level child node data, compare the same set of second-level child node data, until the data comparison plan is executed and completed, and obtain the comparison result of the preset vertical tree structure data.
[0052] It should be noted that the second-level child node query statement template is a statement structure, which contains parameter positions (the position of the database name, the position of the table name, the position of the field name and the position of the query parameters to be entered) and partial parameter values (database name, table name, field name), while the position of the query parameters to be entered does not have a parameter value. After the parent node data is queried, the parent node data is input as a query parameter to the position of the query parameter to be entered. At this time, the second-level child node query statement is obtained.
[0053] like Figure 5 As shown, there are three second-level child nodes of the first-level parent node branch of database 1, namely fields b, c, and d. The three second-level child nodes correspond to the second-level child node query statement templates 1, 2, and 3 of database 1 respectively. The parent node data a corresponding to database 1 is input into the second-level child node query statement templates 1, 2, and 3 of database 1 as a query parameter, and the second-level child node query statements 1 (including: database 1, income table, field b, parent node data a of database 1), 2 (including: database 1, income table, field c, parent node data a of database 1), and 3 (including: database 1, income table, field d, parent node data a of database 1) of database 1 are obtained respectively. After execution, the field values, i.e., the second-level child node data of database 1, are obtained respectively.
[0054] Similarly, there are four second-level child nodes in the first-level parent node branch of database 2, namely fields b, c, d, and e. The four second-level child nodes correspond to the second-level child node query statement templates 1, 2, 3, and 4 of database 2, respectively. The parent node data a corresponding to database 2 is input as a query parameter into the second-level child node query statement templates 1, 2, 3, and 4 of database 2, and the second-level child node query statements 1 (including: database 2, income table, field b, parent node data a of database 2), 2 (including: database 2, income table, field c, parent node data a of database 2), 3 (including: database 2, income table, field d, parent node data a of database 2), and 4 (including: database 2, income table, field e, parent node data a of database 2) of database 2 are obtained respectively. After execution, the field values, namely the second-level child node data of database 2, are obtained respectively.
[0055] The query obtains the same group of second-level child node data: the second-level child node data b, second-level child node data c, second-level child node data d corresponding to database 1 and the second-level child node data b, second-level child node data c, second-level child node data d, second-level child node data e corresponding to database 2. When comparing, the second-level child node data b corresponding to database 1 is compared with the second-level child node data b corresponding to database 2; the second-level child node data c corresponding to database 1 is compared with the second-level child node data c corresponding to database 2; and the second-level child node data d corresponding to database 1 is compared with the second-level child node data d corresponding to database 2. After the above comparisons, it is determined whether they are the same or different. The parent node data e corresponding to database 2 does not exist in database 1, so there is no need for comparison and a different conclusion is directly drawn. Until the data comparison plan is executed, the comparison result of the preset vertical tree structure data is obtained, where the comparison result can be that it exists in database 1 but not in database 2, or does not exist in database 1 but exists in database 2, or exists in both databases 1 and 2 but the data is different, or exists in both databases 1 and 2 and the data is the same.
[0056] The present invention provides a data comparison method, device and equipment. The present invention can first obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; then execute a group of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a group of parent node data, wherein the parent node query statement includes the database name, table name and field name, and compares the same group of parent node data; further obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and the query parameter to be input, execute the second-level child node query statement, obtain a group of second-level child node data, and compare the same group of second-level child node data until the data comparison plan is completed and the comparison result of the preset vertical tree structure data is obtained. Through the technical solution of the present invention, the tree structure includes a first-level parent node, a second-level child node,...an n-th-level child node. By automatically inputting the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, the first-level parent node and the second-level child node are automatically connected. Similarly, the entire tree structure is automatically connected, that is, the entire data comparison plan can be automatically executed and completed, without the need for manual writing of subsequent query statements based on the previous query results, thereby improving the efficiency of data comparison.
[0057] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another data comparison method is provided, such as Figure 2As shown, the method includes:
[0058] 201. Obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases.
[0059] For this embodiment, the specific implementation is the same as step 101 in the embodiment, and will not be repeated here.
[0060] It should be noted that before obtaining the data comparison plan, configuration and selection are received. Preferably, configuration and selection are received through a visual page. The process is simple to operate and reduces the threshold. Specifically, it includes:
[0061] 1. Receive the configuration of database parameters, where the database parameters may include addresses, accounts, paths, etc.; in this way, after obtaining the data comparison plan, the database parameters can be obtained from the data comparison plan; the databases to be queried and compared are connected according to the database parameters, so that the databases can be queried and compared. 2. Receive the selection of the preset vertical tree structure to be queried and compared; in this way, after obtaining the data comparison plan, the parent node query statement and child node query statement template corresponding to the preset vertical tree structure are screened. Preferably, the parent node query statement and child node query statement template corresponding to each vertical of the tree structure (including the second-level child nodes to the nth-level child nodes) can be pre-written. Each time the selection of the preset vertical tree structure to be queried and compared is received, the user can select which vertical tree structure to be queried and compared, thereby improving the efficiency of data comparison. For example, by receiving the selection of the income vertical tree structure, it can be known that the income vertical tree structure to be queried and compared is.
[0062] 202. Execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a set of parent node data, wherein the parent node query statement includes a database name, a table name, and a field name, and compare the parent node data in the same group.
[0063] 203. Obtain a set of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and query parameters to be input, execute the second-level child node query statement, obtain a set of second-level child node data, compare the same set of second-level child node data, until the data comparison plan is executed and completed, and obtain the comparison result of the preset vertical tree structure data.
[0064] For example steps 202 and 203, the specific implementation methods are the same as for example steps 102 and 103, and will not be repeated here. For example steps 201-203, it is possible to solve the multi-level and complex association problems caused by data comparison under the current multi-source heterogeneous database architecture when there are significant differences in the formats of different database products and even inconsistent data table structures. It avoids frequent manual interactions caused by the complexity of business data structures and relationships, and the entire comparison process is more automated, which can effectively improve the efficiency of work scenarios such as data synchronization, data migration, system reconstruction, and business verification testing.
[0065] It should be noted that before obtaining the data comparison plan, the receiving configuration also includes: the configuration of the execution order of the receiving plan. Specifically, the comparison can be done after all node data are queried, or the comparison can be done while one node data is queried. There is no limitation here. When querying node data, you can query all node data of the same layer horizontally and then query the node data of the next layer, or you can query all layers of one branch vertically and then query the next branch, until the last layer. Figure 5 As shown, one branch is: a first-layer parent node, any one of the second-layer child nodes, and a third-layer child node branched from the selected second-layer child node.
[0066] Before obtaining a data comparison plan, the configuration also includes receiving the plan execution method. Specifically, the execution methods include depth-first and self-guided. Depth-first is suitable for batch execution of a complete plan at once, such as daily routine inspections. Self-guided is suitable for instant user queries, allowing users to drill down on demand. After obtaining the data comparison plan, the plan can be executed according to the execution order and execution method. Optimally, the query results can be executed on the target database and recorded. By fine-tuning the comparison method, key points of the data comparison can be highlighted.
[0067] Preferably, after obtaining the comparison results, the comparison results can be displayed according to the categories of the comparison results. It should be noted that the categories of the comparison results can be Category 1: exists in database 1 but does not exist in database 2, or does not exist in database 1 but exists in database 2, Category 2: exists in both databases 1 and 2, but the data is different, Category 3: exists in both databases 1 and 2, and the data is the same. Preferably, since the data comparison is to determine whether there is a difference in the same table data between databases in scenarios such as data synchronization, data migration, system reconstruction, and business verification testing, Category 3 in the comparison results can be hidden, and only Category 1 and Category 2 in the comparison results can be displayed. In order to facilitate different processing methods for different categories, the comparison results are displayed according to the categories of the comparison results. As an implementation method, different colors can be marked to distinguish the categories.
[0068] 204. Filter the comparison results for first different field values that exist in the database but are different, and obtain the first field name corresponding to the first different field value.
[0069] Among them, the different field values in the comparison result refer to three types: existing in database 1 but not in database 2, or not existing in database 1 but existing in database 2, or existing in both databases 1 and 2 but the data are different. The first different field value in the comparison result refers to the type that exists in both databases 1 and 2 but the data are different.
[0070] 205. Obtain the correspondence between the preset field name and the difference permission rule, determine the first different field value with the corresponding relationship as the target first different field value, judge whether the difference between the target first different field values satisfies the difference permission rule corresponding to the target field name, and update the second different field value in the screening comparison result according to the judgment result.
[0071] For steps 204 and 205 of the embodiment, since some field names may have a certain range of errors, the corresponding relationship between the field name and the difference permission rule is pre-set. The first different field values include two types: the first different field value with a corresponding relationship, that is, the target first different field value, and the first different field value without a corresponding relationship. For the target first different field value, it is necessary to continue to judge whether the difference between them meets the difference permission rule corresponding to the target field name. The judgment results include two types: the first different field value that meets the difference permission rule and the first different field value that does not meet the difference permission rule. Specifically, the second different field value in the screening comparison result is updated according to the judgment result, including: converting the first different field value that meets the difference permission rule into the same field value; determining the first different field value that does not meet the difference permission rule and the first different field value that does not have a corresponding relationship as the second different field value in the comparison result.
[0072] In summary: without filtering by the difference-allowed rule, the different field values in the comparison result include: a first different field value that exists in database 1 but not in database 2, or does not exist in database 1 but exists in database 2, or exists in both databases 1 and 2 but the data is different. After filtering by the difference-allowed rule, the different field values in the comparison result include: a second different field value that exists in database 1 but not in database 2, or does not exist in database 1 but exists in database 2, or exists in both databases 1 and 2 but the data is different.
[0073] The present invention provides a data comparison method, device and equipment. The present invention can first obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; then execute a group of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a group of parent node data, wherein the parent node query statement includes the database name, table name and field name, and compares the same group of parent node data; further obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and the query parameter to be input, execute the second-level child node query statement, obtain a group of second-level child node data, and compare the same group of second-level child node data until the data comparison plan is completed and the comparison result of the preset vertical tree structure data is obtained. Through the technical solution of the present invention, the tree structure includes a first-level parent node, a second-level child node,...an n-th-level child node. By automatically inputting the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, the first-level parent node and the second-level child node are automatically connected. Similarly, the entire tree structure is automatically connected, that is, the entire data comparison plan can be automatically executed and completed, without the need for manual writing of subsequent query statements based on the previous query results, thereby improving the efficiency of data comparison.
[0074] Further, as Figure 1 and Figure 2 The embodiment of the present invention provides a data comparison device, such as Figure 3 As shown, the device includes: an acquisition module 31, a parent node execution module 32, and a child node execution module 33;
[0075] An acquisition module 31 is configured to acquire a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases;
[0076] A parent node execution module 32 is configured to execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a set of parent node data, wherein the parent node query statements include database names, table names, and field names, and compare the parent node data in the same group;
[0077] The child node execution module 33 is used to obtain a group of second-level child node query statement templates corresponding to each second-level child node, and input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and query parameters to be input, execute the second-level child node query statement, obtain a group of second-level child node data, and compare the same group of second-level child node data until the data comparison plan is executed and the comparison result of the preset vertical tree structure data is obtained.
[0078] In specific application scenarios, such as Figure 4 As shown, a data comparison device further includes: a configuration module 34, which can be used to receive configuration of database parameters.
[0079] Correspondingly, such as Figure 4 As shown, a data comparison device further includes: a connection module 35, which can be used to obtain the database parameters from the data comparison plan; and connect the database to be queried and the database to be compared according to the database parameters.
[0080] The configuration module 34 may be further configured to receive a selection of a preset vertical tree structure to be queried and compared.
[0081] Correspondingly, the connection module 35 can also be used to filter the parent node query statement and child node query statement templates corresponding to the preset vertical tree structure.
[0082] In specific application scenarios, such as Figure 4 As shown, a data comparison device further includes: a screening module 36, which can be specifically used to screen the first different field values that exist in the comparison results but are different in the database, and obtain the first field name corresponding to the first different field value; obtain the correspondence between the preset field name and the difference permission rule, determine the first different field value with the correspondence as the target first different field value, judge whether the difference between the target first different field values meets the difference permission rule corresponding to the target field name, and update and filter the second different field value in the comparison result according to the judgment result.
[0083] Correspondingly, in order to update and filter the second different field value in the comparison result according to the judgment result, the filtering module 36 can also be used to convert the first different field value that meets the difference permission rule into the same field value; and determine the first different field value that does not meet the difference permission rule and the first different field value that does not have the corresponding relationship as the second different field value in the comparison result.
[0084] In specific application scenarios, such as Figure 4 As shown, a data comparison device further includes: a display module 37, which can be used to display the comparison results according to the categories of the comparison results.
[0085] It should be noted that for other corresponding descriptions of the functional units involved in the data comparison device provided in this embodiment, please refer to Figures 1 to 2 The corresponding description will not be repeated here.
[0086] Based on the above Figures 1 to 2 The method shown in FIG. 1 is a method for performing the above-mentioned operations. Accordingly, this embodiment further provides a storage medium, which may be volatile or non-volatile, and stores a computer program thereon. When the program is executed by a processor, the above-mentioned operations are performed. Figures 1 to 2 The data comparison method shown.
[0087] Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present invention.
[0088] Based on the above Figures 1 to 2 The method shown and Figure 3 、 Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the virtual device shown in the figure further provides a computer device, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 2 The data comparison method shown.
[0089] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and may optionally include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Wi-Fi interface), etc.
[0090] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0091] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the computer device and supports the execution of information processing programs and other software and / or programs. The network communication module is used to facilitate communication between components within the storage medium and with other hardware and software within the information processing device.
[0092] Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform, or by hardware.
[0093] The present invention provides a data comparison method, device and equipment. The present invention can first obtain a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; then execute a group of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a group of parent node data, wherein the parent node query statement includes the database name, table name and field name, and compares the same group of parent node data; further obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name and the query parameter to be input, execute the second-level child node query statement, obtain a group of second-level child node data, and compare the same group of second-level child node data until the data comparison plan is completed and the comparison result of the preset vertical tree structure data is obtained. Through the technical solution of the present invention, the tree structure includes a first-level parent node, a second-level child node,...an n-th-level child node. By automatically inputting the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, the first-level parent node and the second-level child node are automatically connected. Similarly, the entire tree structure is automatically connected, that is, the entire data comparison plan can be automatically executed and completed, without the need for manual writing of subsequent query statements based on the previous query results, thereby improving the efficiency of data comparison.
[0094] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and that the modules or processes in the accompanying drawings are not necessarily required for the implementation of the present invention. Those skilled in the art will appreciate that the modules in the devices in the implementation scenarios can be distributed in the devices of the implementation scenarios according to the implementation scenario descriptions, or can be modified accordingly and located in one or more devices different from the implementation scenarios. The modules in the above-mentioned implementation scenarios can be combined into one module, or can be further split into multiple submodules.
[0095] The serial numbers of the present invention are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosures are only a few specific implementation scenarios of the present invention, but the present invention is not limited to them. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present invention.
Claims
1. A data comparison method, characterized in that: The method comprises: Obtaining a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; Execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan to obtain a set of parent node data, wherein the parent node query statements include database names, table names, and field names, and compare the parent node data in the same group; Obtain a group of second-level child node query statement templates corresponding to each second-level child node, input the parent node data as a query parameter into the second-level child node query statement template corresponding to the same database name, wherein the second-level child node query statement template includes the database name, table name, field name, and query parameters to be input, execute the second-level child node query statement to obtain a group of second-level child node data, and compare the second-level child node data in the same group until the data comparison plan is completed to obtain a comparison result of the preset vertical tree structure data; The method further comprises: Filtering the comparison results for first different field values that exist in the database but are different, and obtaining first field names corresponding to the first different field values; Obtain the correspondence between the pre-set field name and the difference permission rule, determine the first different field value with the correspondence as the target first different field value, judge whether the difference between the target first different field values satisfies the difference permission rule corresponding to the target field name, and update and filter the second different field value in the comparison result according to the judgment result.
2. The method according to claim 1, characterized in that Before obtaining the data comparison plan, it also includes: Receive configuration of database parameters; After obtaining the data comparison plan, it also includes: obtaining the database parameters from the data comparison plan; The databases to be queried and compared are connected according to the database parameters.
3. The method according to claim 1 or 2, characterized in that Before obtaining the data comparison plan, it also includes: Receiving selection of a preset vertical tree structure to be queried and compared; After obtaining the data comparison plan, it also includes: The parent node query statement and child node query statement template corresponding to the preset vertical tree structure are filtered.
4. The method according to claim 1, wherein The updating and filtering of the second different field value in the comparison result according to the judgment result includes: Converting the first different field values that satisfy the difference permission rule into the same field value; The first different field value that does not satisfy the difference permission rule and the first different field value that does not have the corresponding relationship are determined as the second different field value in the comparison result.
5. The method according to claim 1, wherein The method further comprises: The comparison results are displayed according to their categories.
6. A data comparison device, characterized in that: The device comprises: An acquisition module, configured to acquire a data comparison plan, wherein the data comparison plan includes querying and comparing preset vertical tree structure data between at least two databases; a parent node execution module, configured to execute a set of parent node query statements corresponding to each first-level parent node in the data comparison plan, obtain a set of parent node data, wherein the parent node query statements include database names, table names, and field names, and compare the parent node data in the same group; a child node execution module, configured to obtain a set of second-layer child node query statement templates corresponding to each second-layer child node, input the parent node data as query parameters into the second-layer child node query statement template corresponding to the same database name, wherein the second-layer child node query statement template includes the database name, table name, field name, and query parameters to be input, execute the second-layer child node query statement to obtain a set of second-layer child node data, and compare the same set of second-layer child node data until the data comparison plan is executed to obtain a comparison result of the preset vertical tree structure data; A screening module, configured to screen the comparison results for first different field values that exist in the database but are different, and obtain first field names corresponding to the first different field values; Obtain the correspondence between the pre-set field name and the difference permission rule, determine the first different field value with the correspondence as the target first different field value, judge whether the difference between the target first different field values satisfies the difference permission rule corresponding to the target field name, and update and filter the second different field value in the comparison result according to the judgment result.
7. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data comparison method according to any one of claims 1 to 5 is implemented.
8. A computer device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein: When the processor executes the computer program, the data comparison method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Data batch comparison method and device, equipment and storage medium
CN114238326A
Hierarchical query method and device
WO2023000994A1