Data consistency verification method and device, equipment, storage medium and program product

By converting the data to be verified and the target data into intermediate types corresponding to the respective data formats and performing consistency verification, the problem of high complexity of the data consistency verification method in the prior art is solved, and a simplified verification process and improved efficiency are achieved.

CN120123328APending Publication Date: 2025-06-10CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510193112.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The data consistency verification method in the prior art is highly complex, mainly because the data of any source database needs to be converted into the data format of any target database.

Method used

By converting the data to be checked and the target data to be checked into intermediate types corresponding to the respective data formats and performing consistency verification, the complexity of the data consistency verification method is reduced.

Benefits of technology

The data consistency verification process is simplified, the method is complex and the efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123328A_ABST
    Figure CN120123328A_ABST
Patent Text Reader

Abstract

The invention provides a data consistency verification method and device, equipment, a storage medium and a program product. The method comprises the steps that to-be-verified data is obtained from any source end database, target data is obtained from a target database corresponding to the source end database, the data type of the to-be-verified data is a first data type, and the data type of the target data is a second data type; converting the data format of the to-be-verified data into a data format of a first intermediate type corresponding to the first data type to obtain first data, and converting the data format of the target data into a data format of a second intermediate type corresponding to the second data type to obtain second data; and performing consistency verification on the first data and the second data, and determining an obtained verification result as a consistency verification result of the to-be-verified data and the target data. According to the method provided by the invention, the complexity of the data consistency verification method is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technologies, and in particular, to a data consistency verification method, apparatus, device, storage medium, and program product. Background Art

[0002] When performing heterogeneous database data consistency verification, data to be verified can be obtained from a source database, and through a parsing method, it can be converted into the data format of a target database. Further, the parsed data to be verified is compared with the data in the target database to obtain a verification result.

[0003] In related methods, before performing heterogeneous database data consistency verification, a parsing method for converting data in any source database into the corresponding data format of any target database is preset, so that during the process of performing data consistency verification, the data to be verified can be converted into the data format of the target database. Due to the diversity of data formats, the parsing method is highly complex, and the coupling between the parsing method and the data format of the database is relatively high, resulting in a high complexity of the data consistency verification method. Summary of the Invention

[0004] This application provides a data consistency verification method, apparatus, device, storage medium, and program product to solve the problem of high complexity of the data consistency verification method in the prior art.

[0005] In a first aspect, this application provides a data consistency verification method, including:

[0006] Obtain data to be verified from any source database, and obtain target data from the target database corresponding to the source database. The data type of the data to be verified is a first data type, and the data type of the target data is a second data type;

[0007] Convert the data format of the data to be verified into the data format of a first intermediate type corresponding to the first data type to obtain first data, and convert the data format of the target data into the data format of a second intermediate type corresponding to the second data type to obtain second data. The first intermediate type and the second intermediate type are both one of a plurality of preset intermediate types, and each of the plurality of intermediate types corresponds to a different data format;

[0008] Perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0009] Optionally, performing consistency verification on the first data and the second data, and determining the obtained verification result as the consistency verification result of the data to be verified and the target data includes:

[0010] If the first intermediate type is the same as the second intermediate type, comparing whether the first data is the same as the second data, and determining the obtained verification result as the consistency verification result of the data to be verified and the target data;

[0011] If the first intermediate type is different from the second intermediate type, converting the data type of the first data into the second intermediate type to obtain third data, and comparing whether the third data is the same as the second data, and determining the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0012] Optionally, converting the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain first data, and converting the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain second data includes:

[0013] According to the preset mapping relationship between the data type and the intermediate type, determining the first intermediate type corresponding to the first data type, and converting the data format of the data to be verified into the data format of the first intermediate type to obtain the first data;

[0014] According to the mapping relationship, determining the second intermediate type corresponding to the second data type, and converting the data format of the target data into the data format of the second intermediate type to obtain the second data.

[0015] Optionally, converting the data type of the first data into the second intermediate type to obtain third data includes:

[0016] Converting the data type of the first data into the second intermediate type according to the preset data conversion method between the multiple intermediate types to obtain the third data.

[0017] Optionally, the method further includes:

[0018] In response to a mapping relationship update instruction for the third data type, updating the intermediate type corresponding to the third data type in the mapping relationship from the third intermediate type to the fourth intermediate type, where the third intermediate type is the intermediate type corresponding to the third data type before responding to the update instruction, and the fourth intermediate type is the intermediate type carried in the mapping relationship update instruction.

[0019] Optionally, the method further includes:

[0020] In response to a mapping relationship addition instruction, adding a correspondence between a fourth data type and a fifth intermediate type in the mapping relationship, where the fourth data type is the data type carried in the mapping relationship addition instruction, and the fifth intermediate type is the intermediate type carried in the mapping relationship addition instruction.

[0021] In a second aspect, the present application provides a data consistency verification device, including:

[0022] An acquisition module, configured to acquire data to be verified from any source database, and acquire target data from a target database corresponding to the source database, where the data type of the data to be verified is a first data type, and the data type of the target data is a second data type;

[0023] A conversion module, configured to convert the data format of the data to be verified into the data format of a first intermediate type corresponding to the first data type to obtain first data, and convert the data format of the target data into the data format of a second intermediate type corresponding to the second data type to obtain second data, where the first intermediate type and the second intermediate type are both one of a plurality of preset intermediate types, and each of the plurality of intermediate types corresponds to a different data format;

[0024] A verification module, configured to perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0025] In a third aspect, the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0026] The memory stores computer-executable instructions;

[0027] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect and various possible designs of the first aspect as above.

[0028] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect as above is implemented.

[0029] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method described in the first aspect and various possible designs of the first aspect as above is implemented.

[0030] The data consistency verification method, device, equipment, storage medium and program product provided by this application obtain the data to be verified from any source database, and obtain the target data from the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type; convert the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and convert the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data; perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data. Compared with the method in the prior art that needs to convert the data in any source database into the data format corresponding to any target database, the method of this application converts the data format of any data to be verified and the data format of any target data into the intermediate types corresponding to their respective data formats, reducing the complexity of the data consistency verification method. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0032] Figure 1 is a flowchart of a data consistency verification method provided by an embodiment of the present application Figure 1 ;

[0033] Figure 2 is a flowchart of a data consistency verification method provided by an embodiment of the present application Figure 2 ;

[0034] Figure 3 is a schematic structural diagram of a data consistency verification device provided by an embodiment of the present application;

[0035] Figure 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

[0036] Through the above-mentioned accompanying drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and text descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0037] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0038] After migrating or synchronizing data in a heterogeneous database, it is often necessary to execute a heterogeneous database data consistency verification method to ensure that the data in the two databases is consistent. The complexity of existing data consistency verification methods is high.

[0039] In view of this, the present application proposes a data consistency verification method, which converts the data to be verified in any source database into a data format of an intermediate type corresponding to its data type, and converts the target data in the target database into a data format of an intermediate type corresponding to its data type, and performs consistency verification on the converted data to be verified and the converted target data, so as to determine the verification result as the consistency verification result of the data to be verified and the target data. Compared with the method in the prior art that needs to convert the data in any source database into the data format corresponding to any target database, the method of the present application converts the data format of any data to be verified and the data format of any target data into the intermediate types corresponding to their respective data formats, reducing the complexity of the data consistency verification method.

[0040] It should be understood that the data consistency verification method of the embodiments of the present application can be used in any scenario of heterogeneous database data consistency verification. The execution subject of the embodiments of the present application can be any device for data verification. This device is not limited to a specific implementation manner and can be implemented by software and / or hardware. Specifically, this device can be, for example, an electronic device or a processor. The following will be described by taking the execution subject as a data verification device as an example.

[0041] The following will specifically describe the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0042] Figure 1 Schematic flow of a data consistency verification method provided for an embodiment of the present application Figure 1 . As Figure 1 shown in, the data consistency verification method may include the following steps, for example:

[0043] S101. Obtain the data to be verified from any source database, and obtain the target data from the target database corresponding to the source database.

[0044] During data migration, data synchronization, or data backup, the source database is the original database serving as the data source, and the target database is the database storing the data extracted from the source database. Taking data migration as an example, data can be migrated from the source database to be stored in the target database, and this target database is the target database corresponding to the source database. The source database or the target database can be any type of database. For example, the source database can be a MySQL-type database, and the target database can be an Oracle-type database.

[0045] The data to be verified is the data in the source database to be subjected to consistency verification, and the target data is the data corresponding to the data to be verified in the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type. Among them, the data type is a classification defined according to the storage method of the data. For example, character type, numerical type, and date and time type, etc.

[0046] One implementable way is that the data verification device can determine any source database among multiple source databases to perform data consistency verification, connect to the source database through a database connection tool or programming interface in related technologies, query and obtain the data to be verified from the source database, and determine the target database corresponding to the source database, connect to the target database through a database connection tool or programming interface in related technologies, and query and obtain the target data corresponding to the data to be verified from the target database.

[0047] S102. Convert the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and convert the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data.

[0048] Both the first intermediate type and the second intermediate type are one of a preset variety of intermediate types, and each of the variety of intermediate types corresponds to a different data format. The data format refers to the representation method of data storage. Taking the date and time type as an example, the data format can be "year - date - time". Among them, the first intermediate type and the second intermediate type can be the same or different.

[0049] In an implementable manner, the data verification device can determine multiple data types from the data types as intermediate types, and preset the intermediate type corresponding to each data type. In this way, according to the data type of the data to be verified, the intermediate type corresponding to the data type of the data to be verified, that is, the first intermediate type, is determined. The data format of the data to be verified is converted into the data format of the first intermediate type corresponding to the first data type to obtain the first data. According to the data type of the target data, the intermediate type corresponding to the data type of the target data, that is, the second intermediate type, is determined. The data format of the target data is converted into the data format of the second intermediate type corresponding to the second data type to obtain the second data.

[0050] Taking the data type of the data to be verified as the date type and the preset intermediate type corresponding to the date and time type as DATE as an example, the first intermediate type is determined to be DATE, and according to the preset data format of DATE as "YYYY-MM-DD", where YYYY represents the four-digit year, MM represents the two-digit month, and DD represents the two-digit date, the data format of the data to be verified is converted into the data format of DATE "year-date-time" to obtain the first data.

[0051] S103. Perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0052] Perform consistency verification on the first data and the second data to obtain a verification result, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0053] In an implementable manner, the data verification device can utilize a data comparison tool in related technologies. The data comparison tool can output a verification result indicating whether the first data and the second data are consistent. By comparing whether the first data and the second data are the same using the data comparison tool, if the first data and the second data are the same, that is, the verification result is consistent, then it is determined that the consistency verification result of the data to be verified and the target data is consistent; if the first data and the second data are different, that is, the verification result is inconsistent, then it is determined that the consistency verification result of the data to be verified and the target data is inconsistent.

[0054] A feasible way is that the data verification device can compare whether the first data and the second data are the same when the first intermediate type and the second intermediate type are consistent, that is, when the data formats of the first data and the second data are the same. For example, when the first intermediate type and the second intermediate type are of the same data type, the data formats of the first data and the second data are the same. In this case, when performing consistency verification on the first data and the second data, it can directly compare whether the first data and the second data are the same. If the first data and the second data are the same, the verification result is consistent, and it is determined that the consistency verification result of the data to be verified and the target data is consistent.

[0055] In this way, when the first intermediate type and the second intermediate type are inconsistent, that is, when the data formats of the first data and the second data are inconsistent, the data verification device can unify the data formats of the first data and the second data, and then compare whether the first data and the second data are the same. For example, it can convert the data format of the second data to the data format of the first data.

[0056] The data consistency verification method of this application obtains the data to be verified from any source database and obtains the target data from the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type; it converts the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and converts the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data; it performs consistency verification on the first data and the second data, and determines the obtained verification result as the consistency verification result of the data to be verified and the target data. Compared with the method in the prior art that needs to convert the data in any source database into the data format corresponding to any target database, the method of this application converts the data formats of any data to be verified and any target data into the intermediate types corresponding to their respective data formats, reducing the complexity of the data consistency verification method.

[0057] Next, in the data consistency verification method of this application, how to perform consistency verification on the first data and the second data and determine the obtained verification result as the consistency verification result of the data to be verified and the target data will be described.

[0058] Optionally, if the first intermediate type is the same as the second intermediate type, compare whether the first data is the same as the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data; if the first intermediate type is different from the second intermediate type, convert the data type of the first data to the second intermediate type to obtain the third data, and compare whether the third data is the same as the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0059] Figure 2 Schematic flow of a data consistency verification method provided by an embodiment of the present application Figure 2 As Figure 2 In the above implementation manner, the data consistency verification method of the present application may include the following steps:

[0060] S201. Obtain the data to be verified from any source database, and obtain the target data from the target database corresponding to the source database.

[0061] S202. Convert the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data.

[0062] Optionally, convert the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data. A feasible implementation manner is to determine the first intermediate type corresponding to the first data type according to the preset mapping relationship between the data type and the intermediate type, and convert the data format of the data to be verified into the data format of the first intermediate type to obtain the first data.

[0063] S203. Convert the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data.

[0064] Optionally, convert the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data. A feasible implementation manner is to determine the second intermediate type corresponding to the second data type according to the preset mapping relationship between the data type and the intermediate type, and convert the data format of the target data into the data format of the second intermediate type to obtain the second data.

[0065] S204. Determine whether the first intermediate type is the same as the second intermediate type.

[0066] If so, execute step S205;

[0067] If not, execute step S206.

[0068] S205. Compare whether the first data is the same as the second data.

[0069] If so, execute step S208;

[0070] If not, execute step S209.

[0071] If the first intermediate type is the same as the second intermediate type, compare whether the first data and the second data are the same, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0072] S206. Convert the data type of the first data into the second intermediate type to obtain the third data.

[0073] If the first intermediate type is different from the second intermediate type, convert the data type of the first data into the second intermediate type to obtain the third data, and compare whether the third data and the second data are the same, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0074] Taking the first intermediate type as the character (CHAR) type and the second intermediate type as the text (TEXT) type as an example, the data format of the first data is the data format of the CHAR type, and the format of the second data is the TEXT type. The first data can be converted into the data format of the TEXT type to obtain the third data.

[0075] S207. Compare whether the third data and the second data are the same.

[0076] If so, execute step S208;

[0077] If not, execute step S209.

[0078] S208. Determine that the data to be verified and the target data are consistent.

[0079] S209. Determine that the data to be verified and the target data are inconsistent.

[0080] Taking the example of obtaining the first data and the second data according to the mapping relationship between the preset data type and the intermediate type, Table 1 shows the description of an example of the mapping relationship between the preset data type and the intermediate type. According to the mapping relationship between the preset data type and the intermediate type shown in Table 1, the first intermediate type corresponding to the first data type can be determined, and the data format of the data to be verified can be converted into the data format of the first intermediate type to obtain the first data. According to the mapping relationship shown in Table 1, the second intermediate type corresponding to the second data type can be determined, and the data format of the target data can be converted into the data format of the second intermediate type to obtain the second data. For example, if the data type of the data to be verified is a fixed-length character type, then according to the mapping relationship shown in Table 1, the first intermediate type can be determined as the CHAR type, and further convert the data to be verified into the CHAR type. A feasible way is to configure the mapping relationship shown in Table 1 in a configuration file. In this implementation, the first intermediate type and the second intermediate type can be determined through the configuration file.

[0081] Table 1

[0082]

[0083]

[0084] Optionally, converting the data type of the first data into the second intermediate type to obtain the third data. The data type of the first data can be converted into the second intermediate type according to the data conversion method between multiple preset intermediate types to obtain the third data. Taking the mapping relationship shown in Table 1 as an example, if the first intermediate type is the CHAR type and the second intermediate type is the TEXT type, then the data format of the first data can be converted from the CHAR type data format to the TEXT type data format.

[0085] It should be understood that the data types of the data to be verified and the target data can be the same or different data types. Taking the mapping relationship shown in Table 1 as an example, the data types of the data to be verified and the target data can both be numerical types. In another preset mapping relationship, the data type can be further divided into integer numerical types or floating-point numerical types. In this way, the data type of the data to be verified can be an integer numerical type, and the data type of the target data can be a floating-point numerical type.

[0086] The data consistency verification method of the present application obtains the data to be verified from any source database, and obtains the target data from the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type; the data format of the data to be verified is converted into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and the data format of the target data is converted into the data format of the second intermediate type corresponding to the second data type to obtain the second data; the first data and the second data are subjected to consistency verification, and the obtained verification result is determined as the consistency verification result of the data to be verified and the target data. Compared with the method in the prior art that needs to convert the data in any source database into the data format corresponding to any target database, the method of the present application converts the data format of any data to be verified and the data format of any target data into the intermediate types corresponding to their respective data formats, reducing the complexity of the data consistency verification method.

[0087] Optionally, the data consistency verification method of the present application can also respond to the mapping relationship update instruction for the third data type, and update the intermediate type corresponding to the third data type in the mapping relationship from the third intermediate type to the fourth intermediate type.

[0088] Wherein, the third intermediate type is the intermediate type corresponding to the third data type before responding to the update instruction, and the fourth intermediate type is the intermediate type carried in the mapping relationship update instruction.

[0089] Taking the configuration of the mapping relationship between the data type and the intermediate type in the configuration file as an example, after receiving the mapping relationship update instruction for the third data type, in response to the mapping relationship update instruction, the intermediate type corresponding to the third data type in the configuration file is updated from the third intermediate type to the fourth intermediate type. In this way, during the process of data consistency verification, it can be determined through the configuration file that the intermediate type corresponding to the third data type is the fourth intermediate type.

[0090] Through the above method of responding to the mapping relationship update instruction, the mapping relationship between the data type and the intermediate type can be quickly updated. In the case of the structure update of the source database or the target database, the data consistency verification method of the present application can be quickly updated to adapt to the consistency verification of the data to be verified in the updated source database and the target data in the target database.

[0091] Optionally, the data consistency verification method of the present application can also respond to the mapping relationship addition instruction, and add the corresponding relationship between the fourth data type and the fifth intermediate type in the mapping relationship.

[0092] Among them, the fourth data type is the data type carried in the mapping relationship addition instruction, and the fifth intermediate type is the intermediate type carried in the mapping relationship addition instruction.

[0093] Taking the configuration of the mapping relationship between the data type and the intermediate type in the configuration file as an example, after receiving the mapping relationship addition instruction, in response to this mapping relationship addition instruction, the corresponding relationship between the fourth data type and the fifth intermediate type is added to the configuration file. In this way, during the process of data consistency verification, it can be determined through the configuration file that the intermediate type corresponding to the fourth data type is the fifth intermediate type. It should be understood that the fifth intermediate type can be one of the intermediate types already included in the configuration file or a newly added intermediate type.

[0094] Through the above method of responding to the mapping relationship addition instruction, the mapping relationship between the data type and the intermediate type can be quickly added. In the case of changes in the structure of the source database or the target database, the data consistency verification method of this application can be quickly updated to adapt to the consistency verification of the data to be verified in the source database and the target data in the target database after the structure change.

[0095] In the above embodiment, through the mapping relationship between the data type and the intermediate type, the data format of the data to be verified is converted into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and the data format of the target data is converted into the data format of the second intermediate type corresponding to the second data type to obtain the second data, and the first data and the second data are subjected to consistency verification, and the obtained verification result is determined as the consistency verification result of the data to be verified and the target data, reducing the complexity of the data consistency verification method. Through the update and addition of the mapping relationship, the scalability and maintainability of the data consistency verification method are improved.

[0096] The data consistency verification method of this application obtains the data to be verified from any source database and obtains the target data from the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type; the data format of the data to be verified is converted into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and the data format of the target data is converted into the data format of the second intermediate type corresponding to the second data type to obtain the second data; the first data and the second data are subjected to consistency verification, and the obtained verification result is determined as the consistency verification result of the data to be verified and the target data. Compared with the method in the prior art that needs to convert the data in any source database into the data format corresponding to any target database, the method of this application converts the data format of any data to be verified and the data format of any target data into the intermediate types corresponding to their respective data formats, reducing the complexity of the data consistency verification method.

[0097] The above is the description of the method embodiment of this application. Next, the device provided by the embodiment of this application will be described.

[0098] Figure 3 It is a schematic structural diagram of a data consistency verification device provided by an embodiment of this application. As Figure 3 shown, a data consistency verification device 300 may include, for example: an acquisition module 301, a conversion module 302, and a verification module 303. Optionally, a configuration module may also be included.

[0099] The acquisition module 301 is configured to acquire data to be verified from any source database, and acquire target data from the target database corresponding to the source database. The data type of the data to be verified is the first data type, and the data type of the target data is the second data type;

[0100] The conversion module 302 is configured to convert the data format of the data to be verified into the data format of the first intermediate type corresponding to the first data type to obtain the first data, and convert the data format of the target data into the data format of the second intermediate type corresponding to the second data type to obtain the second data. The first intermediate type and the second intermediate type are both one of a plurality of preset intermediate types, and each of the plurality of intermediate types corresponds to a different data format;

[0101] The verification module 303 is configured to perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0102] In a possible implementation manner, the verification module 303 is specifically configured to, if the first intermediate type is the same as the second intermediate type, compare whether the first data and the second data are the same, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data; if the first intermediate type is different from the second intermediate type, convert the data type of the first data into the second intermediate type to obtain the third data, and compare whether the third data and the second data are the same, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

[0103] Correspondingly, the verification module 303 is specifically configured to convert the data type of the first data into the second intermediate type according to the data conversion method between the plurality of preset intermediate types to obtain the third data.

[0104] In a possible implementation, the conversion module 302 is specifically configured to determine a first intermediate type corresponding to the first data type according to a preset mapping relationship between the data type and the intermediate type, and convert the data format of the data to be verified into the data format of the first intermediate type to obtain a first data; determine a second intermediate type corresponding to the second data type according to the mapping relationship, and convert the data format of the target data into the data format of the second intermediate type to obtain a second data.

[0105] In a possible implementation, the configuration module is specifically configured to, in response to a mapping relationship update instruction for a third data type, update the intermediate type corresponding to the third data type in the mapping relationship from a third intermediate type to a fourth intermediate type, where the third intermediate type is the intermediate type corresponding to the third data type before responding to the update instruction, and the fourth intermediate type is the intermediate type carried in the mapping relationship update instruction.

[0106] In a possible implementation, the configuration module is specifically configured to, in response to a mapping relationship addition instruction, add a correspondence between a fourth data type and a fifth intermediate type in the mapping relationship, where the fourth data type is the data type carried in the mapping relationship addition instruction, and the fifth intermediate type is the intermediate type carried in the mapping relationship addition instruction.

[0107] The device provided in the embodiments of the present application can execute the above method embodiments, and its implementation principle and technical effects are similar, which will not be elaborated here.

[0108] It should be understood that the above device embodiments are illustrative, and the devices of the present application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0109] Figure 4 This is a schematic structural diagram of an electronic device provided in the embodiments of the present application. As Figure 4 shown, the electronic device may include: at least one processor 401 and a memory 402.

[0110] The memory 402 is used to store a program. Specifically, the program may include program code, and the program code includes computer operation instructions.

[0111] The memory 402 may include a high-speed RAM memory, and may also include a non-volatile memory.

[0112] The processor 401 is used to execute the computer-executable instructions stored in the memory 402 to implement the methods of the foregoing method embodiments. Among them, the processor 401 may be a central processing unit (CPU for short), or an application specific integrated circuit (ASIC for short), or one or more integrated circuits configured to implement the embodiments of the present application.

[0113] Optionally, the electronic device may further include a communication interface 403. In a specific implementation, if the communication interface 403, the memory 402, and the processor 401 are independently implemented, the communication interface 403, the memory 402, and the processor 401 may be interconnected through a bus and communicate with each other.

[0114] Optionally, in a specific implementation, if the communication interface 403, the memory 402, and the processor 401 are integrated on a single chip, the communication interface 403, the memory 402, and the processor 401 may communicate through an internal interface.

[0115] The present application also provides a computer-readable storage medium, which may include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), etc. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used to implement the actions of the foregoing method embodiments.

[0116] The present application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the actions of the foregoing method embodiments.

[0117] In addition, unless otherwise specified, in each embodiment of the present application, each functional unit / module may be integrated into one unit / module, or each unit / module may exist physically alone, or two or more units / modules may be integrated together. The above integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0118] When the integrated unit / module is implemented in the form of hardware, the hardware can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0119] When the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), and a mobile hard disk.

[0120] In the above embodiments, the descriptions of the various embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, 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, it should be considered to be within the scope described in this specification.

[0121] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes various media such as ROM, RAM, etc. that can store program codes.

Claims

1. A data consistency verification method, characterized in that: include: Acquire the data to be verified from any source database, and acquire the target data from the target database corresponding to the source database, wherein the data type of the data to be verified is the first data type, and the data type of the target data is the second data type; Converting the data format of the to-be-verified data into a data format of a first intermediate type corresponding to the first data type to obtain first data, and converting the data format of the target data into a data format of a second intermediate type corresponding to the second data type to obtain second data, wherein the first intermediate type and the second intermediate type are both one of a plurality of preset intermediate types, and each of the plurality of intermediate types corresponds to a different data format; A consistency check is performed on the first data and the second data, and an obtained check result is determined as a consistency check result of the data to be checked and the target data.

2. The method according to claim 1, characterized in that The performing consistency check on the first data and the second data, and determining the obtained check result as the consistency check result of the data to be checked and the target data, includes: If the first intermediate type is the same as the second intermediate type, comparing whether the first data is the same as the second data, and determining the obtained verification result as the consistency verification result of the to-be-verified data and the target data; If the first intermediate type is different from the second intermediate type, the data type of the first data is converted into the second intermediate type to obtain third data, and the third data is compared with the second data to see whether they are the same, and the obtained verification result is determined as the consistency verification result of the data to be verified and the target data.

3. The method according to claim 1, characterized in that The converting the data format of the to-be-verified data into a data format of a first intermediate type corresponding to the first data type to obtain first data, and converting the data format of the target data into a data format of a second intermediate type corresponding to the second data type to obtain second data, comprises: Determine, according to a preset mapping relationship between data types and intermediate types, a first intermediate type corresponding to the first data type, and convert the data format of the data to be verified into the data format of the first intermediate type to obtain the first data; According to the mapping relationship, a second intermediate type corresponding to the second data type is determined, and the data format of the target data is converted into the data format of the second intermediate type to obtain the second data.

4. The method according to claim 2, characterized in that: The converting the data type of the first data into the second intermediate type to obtain third data includes: According to the preset data conversion method between the plurality of intermediate types, the data type of the first data is converted into the second intermediate type to obtain the third data.

5. The method according to claim 3, characterized in that: The method further comprises: In response to a mapping relationship update instruction for a third data type, the intermediate type corresponding to the third data type in the mapping relationship is updated from the third intermediate type to a fourth intermediate type, wherein the third intermediate type is the intermediate type corresponding to the third data type before responding to the update instruction, and the fourth intermediate type is the intermediate type carried in the mapping relationship update instruction.

6. The method according to claim 3, characterized in that The method further comprises: In response to a newly added mapping relationship instruction, a correspondence between a fourth data type and a fifth intermediate type is added to the mapping relationship, the fourth data type is the data type carried in the newly added mapping relationship instruction, and the fifth intermediate type is the intermediate type carried in the newly added mapping relationship instruction.

7. A data consistency verification device, characterized in that: include: an acquisition module, used to acquire the data to be verified from any source database, and acquire the target data from a target database corresponding to the source database, wherein the data type of the data to be verified is a first data type, and the data type of the target data is a second data type; a conversion module, configured to convert the data format of the to-be-verified data into a data format of a first intermediate type corresponding to the first data type to obtain first data, and to convert the data format of the target data into a data format of a second intermediate type corresponding to the second data type to obtain second data, wherein the first intermediate type and the second intermediate type are both one of a plurality of preset intermediate types, and each of the plurality of intermediate types corresponds to a different data format; A verification module is used to perform consistency verification on the first data and the second data, and determine the obtained verification result as the consistency verification result of the data to be verified and the target data.

8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Cited By

  • Database type conversion method and device

    CN120578707A