WO2025256533A1 - 一种数据稽核方法、装置及相关设备 - Google Patents

一种数据稽核方法、装置及相关设备

Info

Publication number
WO2025256533A1
WO2025256533A1 PCT/CN2025/100272 CN2025100272W WO2025256533A1 WO 2025256533 A1 WO2025256533 A1 WO 2025256533A1 CN 2025100272 W CN2025100272 W CN 2025100272W WO 2025256533 A1 WO2025256533 A1 WO 2025256533A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
value
comparison
column
data table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2025/100272
Other languages
English (en)
French (fr)
Inventor
叶强
金蕙风
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of WO2025256533A1 publication Critical patent/WO2025256533A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Definitions

  • This application relates to the field of computer technology, and in particular to the design of a data auditing method, apparatus and related equipment.
  • Data auditing is a crucial tool for data quality control, and a primary objective is to ensure data consistency across different databases.
  • Database field comparison is a common data auditing technique that compares data row-by-row across tables in different databases to determine data consistency.
  • row-by-row comparison is inefficient for scenarios involving large datasets, such as when comparing tables containing tens of millions of rows. Therefore, providing a highly efficient and accurate data auditing method to perform full data verification and ensure data quality is of paramount importance.
  • This application provides a data auditing method, apparatus, and related equipment, which can improve the efficiency of data auditing of data tables.
  • this application provides a data auditing method, comprising: a data comparison system acquiring a data comparison request, the data comparison request including a data table name, a first database name, and a second database name; the data comparison system acquiring a first data table from the first database and a second data table from the second database according to the data comparison request; then determining a first comparison value corresponding to a first data column in the first data table and a second comparison value corresponding to a second data column in the second data table through a hash algorithm; and determining that the data in the first data column of the first data table is the same as the data in the second data column of the second data table if the first comparison value and the second comparison value are the same.
  • first and second data tables have the same table name.
  • the first data table is obtained by processing business data from the first database
  • the second data table is obtained by processing the same business data from the second database. Therefore, the first and second data tables contain the same fields.
  • auditing data to determine whether the data in the two tables is consistent the data in the two columns with the same field names in each data table are compared to determine whether the data corresponding to each field is consistent, thereby determining whether the data in the two tables is consistent.
  • the data comparison system uses a hash algorithm to determine the comparison values for two columns with the same data names in both tables. If the comparison values are the same, the two columns are considered identical; otherwise, they are considered different. This method allows for the determination of whether two columns with the same field names are identical, thus improving the efficiency of data auditing. Furthermore, if the data in the first table is accurate, the column-level comparison method can identify the columns containing inconsistent data in the second table. Since data in the same column within a table typically originates from the same source table, the system can trace the source of any discrepancies when a column in the second table is found to be inconsistent with data in the first table.
  • the data comparison system determines the first alignment value corresponding to the first data column in the first data table through a hash algorithm, including: the data comparison system determines the alignment value corresponding to each of the multiple field values included in the first data column through a hash algorithm and logical operations, and determines the first alignment value corresponding to the first data column based on the alignment value corresponding to each field value.
  • the above logical operations are XOR or NAND operations.
  • the alignment value for each field value in that column is first determined using hash algorithms and logical operations. Then, the alignment value for the entire column is determined based on the alignment values for each field value. For example, the alignment values for each field value are summed to obtain the alignment value for the entire column.
  • the data comparison system determines the comparison value corresponding to each field value among multiple field values included in the first data column through hash algorithms and logical operations. This includes: the data comparison system converting the first field value into a first hash value using a hash algorithm; wherein the first field value is one of multiple field values, and the first hash value includes m characters; the data comparison system extracts n consecutive characters from the first hash value and divides these n characters into i groups of strings; wherein n is less than or equal to m; then, the j-th string in the i-th group of strings is compared with the (j-2)-th check value using the aforementioned logical operation to obtain the (j-1)-th check value; finally, the (i-1)-th check value is determined as the comparison value corresponding to the first field value.
  • j is greater than or equal to 2 and less than or equal to i; when j equals 2, the (j-2)-th check value is the first group of strings.
  • the comparison value corresponding to each field value is first determined using the above method. Then, based on the comparison values corresponding to the multiple field values included in the column, the comparison value corresponding to the column is determined. For two columns of data in two tables to be compared, after determining the two comparison values corresponding to the two columns of data using the above method, whether the two columns of data are the same can be determined by whether the two comparison values are the same.
  • the above method can convert different types of data into strings of the same length through hash algorithms, enabling the comparison of different types of data. Furthermore, in the process of comparing two columns of data, the purpose of comparing whether the two columns of data are the same can be achieved through simple operations such as hash algorithms and logical operations. The operation speed is fast, which can improve the efficiency of data auditing.
  • the data comparison system determines the comparison value corresponding to each field value among multiple field values included in the first data column through hash algorithms and logical operations. This includes: the data comparison system obtaining the row identifier of the row to which the first field value belongs; wherein, the row identifier corresponding to each row in the multiple rows of data included in the first data table is different, and the first field value is one of multiple field values; the data comparison system concatenates the row identifier corresponding to the first field value with the first field value to obtain a first concatenated value; then, it converts the first concatenated value into a second hash value using a hash algorithm, the second hash value including m characters; then, it extracts n consecutive characters from the second string and divides these n characters into i groups of strings; wherein n is less than or equal to m; finally, it performs the above logical operation between the j-th string in the i-th group and the (j-2)-th check value to obtain the (j
  • the first comparison value calculated by the data comparison system for the first data column and the second comparison value for the second data column will be the same.
  • the data comparison system will determine that the data in the first and second data columns are consistent, but the data in the first and second rows of both columns are not consistent, thus leading to a misjudgment.
  • the method described above for determining whether two data columns are consistent based on concatenated values can avoid the aforementioned misjudgment. For example, if the first row of the first data column in the first data table contains 1000 and the second row contains 1549; and the first row of the second data column in the second data table contains 1549 and the second row contains 1000, and the data in the other rows of the first and second data columns are the same, then the concatenated value corresponding to the first row of the first data column is 00011000, and the concatenated value corresponding to the first row of the first data column is 00021549; the concatenated value corresponding to the first row of the second data column is 00011549, and the concatenated value corresponding to the second row of the second data column is 00021000. In this way, the comparison value calculated by the data comparison system for the first and second data columns will not be the same, thus avoiding the aforementioned misjudgment.
  • this application provides a data auditing device, including a communication module, an acquisition module, and a processing module.
  • the communication module receives a data comparison request, which includes a data table name, a first database name, and a second database name.
  • the acquisition module retrieves a first data table from the first database and a second data table from the second database according to the data comparison request; wherein the data table names of the first and second data tables are the same.
  • the processing module determines a first comparison value corresponding to a first data column in the first data table and a second comparison value corresponding to a second data column in the second data table using a hash algorithm. When the first comparison value and the second comparison value are the same, it determines that the data in the first data column of the first data table is the same as the data in the second data column of the second data table.
  • the above processing module determines the first comparison value corresponding to the first data column in the first data table through a hash algorithm, it is specifically used to: determine the comparison value corresponding to each of the multiple field values included in the first data column through a hash algorithm, and determine the first comparison value corresponding to the first data column based on the comparison value corresponding to each field value.
  • the aforementioned processing module is specifically used to: determine the comparison value corresponding to each field value among the multiple field values included in the first data column through a hash algorithm and logical operations, including: the data comparison system converts the first field value into a first hash value through a hash algorithm; wherein the first field value is one of multiple field values, and the first hash value includes m characters; the data comparison system extracts n consecutive characters from the first hash value and divides these n characters into i groups of strings; wherein n is less than or equal to m; then the j-th string in the i-th group of strings is compared with the (j-2)-th check value to obtain the (j-1)-th check value; finally, the (i-1)-th check value is determined as the comparison value corresponding to the first field value. Where j is greater than or equal to 2 and less than or equal to i; when j equals 2, the (j-2)-th check value is the first group of strings; the aforementioned logical operations
  • the aforementioned processing module is specifically used to: determine the comparison value corresponding to each field value among the multiple field values included in the first data column through hash algorithms and logical operations, including: the data comparison system obtaining the row identifier of the row to which the first field value belongs; wherein, the row identifier corresponding to each row in the multiple rows of data included in the first data table is different, and the first field value is one of the multiple field values; the data comparison system concatenates the row identifier corresponding to the first field value with the first field value to obtain a first concatenated value; then, the first concatenated value is converted into a second hash value through a hash algorithm, the second hash value including m characters; then, n consecutive characters are extracted from the second string, and these n characters are divided into i groups of strings; wherein, n is less than or equal to m; finally, the j-th string in the i-th group of strings is subjected to the above logical operation with the (j-
  • this application provides a computing device including a processor and a memory, the memory being used to store instructions, and the processor being used to execute the instructions stored in the memory to implement the method as described in the first aspect or any possible implementation thereof.
  • this application provides a computing device cluster, which includes at least one computing device, each computing device including a processor and a memory, wherein the processor of each computing device is used to execute instructions stored in the memory to enable the computing device cluster to implement the method as described in the first aspect or any possible implementation thereof.
  • this application provides a computer-readable storage medium including computer program instructions that, when executed by a cluster of computing devices, cause the computing devices to implement the method described in the first aspect or any possible implementation thereof.
  • this application provides a computer program product, which includes a computer program that, when run by a cluster of computing devices, implements the method described in the first aspect or any possible implementation of the first aspect.
  • Figure 1 is a schematic diagram of a data management system provided in this application.
  • FIG. 2 is a flowchart illustrating a data auditing method provided in this application
  • Figure 3 is a schematic diagram of a table relationship configuration interface provided in this application.
  • Figure 4 is a schematic diagram of a method for determining a comparison value provided in this application.
  • Figure 5 is a schematic diagram of a splicing value provided in this application.
  • Figure 6 is a schematic diagram of a comparison task interface provided in this application.
  • FIG. 7 is a schematic diagram of a data management system provided in this application.
  • Figure 8 is a schematic diagram of a computing device provided in this application.
  • Figure 9 is a schematic diagram of the network connection between two computing devices provided in this application.
  • Data auditing refers to the review and verification of data to ensure its accuracy, completeness, and consistency.
  • data auditing is a crucial means of data quality control, with significant applications in many scenarios.
  • data warehouses or simply data warehouses
  • enterprises typically iterate and upgrade their products based on the latest data warehouse offerings to meet evolving business needs.
  • two data warehouse systems, one old and one new will run concurrently for a period.
  • Business data generated during these operations will be sent to both databases for processing and stored. Therefore, during the iterative upgrade of data warehouse products, it is necessary to compare the data obtained after processing business data in different databases to ensure data consistency across the different databases.
  • Data auditing is a method for verifying data consistency.
  • Database field comparison is a common data auditing technique that compares rows one by one between tables in different databases to determine whether the data in two tables is consistent.
  • row-by-row comparison is not effective for scenarios involving large amounts of data, such as when the two tables to be compared each contain tens of millions of rows. Therefore, providing an efficient and accurate data auditing method to perform full data verification and ensure data quality is of great importance.
  • this application provides a data auditing method.
  • the comparison is performed column-by-column.
  • the first data column For example, for two columns of data with the same field name in a first and second data table, the column in the first data table is referred to as the first data column, and the column in the second data table is referred to as the second data column.
  • the first field value is first converted into a hash value containing m characters using a hash function. Then, n consecutive characters are extracted from the hash value to obtain a first string, where n is less than or equal to m.
  • the first string After obtaining the first string, it is divided into i groups of strings with the same number of digits, for example, each group contains k digits, where i is an integer greater than or equal to 2, and n is an integer multiple of i.
  • the comparison value corresponding to the first field value is then determined based on the aforementioned i groups of strings. For other field values in the first data column, the comparison values corresponding to each of the other field values are obtained using the same method described above. For example, if the first data table contains t1 rows of data, that is, the first data column contains t1 field values, then t1 comparison values are obtained according to the above method. These t1 comparison values are added together to obtain the first comparison value corresponding to the first data column.
  • the comparison value corresponding to each field value is obtained using the same method described above.
  • the comparison values corresponding to each field value are then added together to obtain the second comparison value for the second data column. If the first comparison value and the second comparison value are the same, it means that the data in the first data column and the second data column are consistent; if the first comparison value and the second comparison value are different, it means that the data in the first data column and the second data column are inconsistent.
  • the above method can determine whether each column of data in the second data table is consistent with the corresponding column of data in the first data table, thereby determining whether the data in the second data table is consistent with the data in the first data table.
  • This method uses a hash algorithm to convert different types of data into fixed-length strings, enabling comparison of different data types. Furthermore, in the process of comparing two columns of data, simple operations such as hashing can achieve the purpose of comparing whether the two columns of data are the same, resulting in fast processing speed and improved efficiency in data auditing.
  • first and second data tables are two tables obtained by processing the same business data in two different databases. That is, the first data table is obtained by processing the business data in the first database, and the second data table is obtained by processing the same business data in the second database.
  • the first and second databases can be different databases; for example, the first database could be an Oracle database, and the second database could be a Gaussian database. Alternatively, the first and second databases could be different versions of the same database.
  • FIG 1 is a schematic diagram of a data management system provided in this application.
  • the data management system includes a client 100 and a data comparison system 200.
  • the client 100 and the data comparison system 200 are connected by a communication link.
  • the client 100 that establishes the communication link with the data comparison system 200 can be one or more, and this application does not impose any specific limitations.
  • the data comparison system 200 can be deployed on a single computing device or in a cluster of computing devices, which can be servers, virtual machines, containers, or edge computing devices.
  • a virtual machine refers to a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computer can also be performed in a virtual machine.
  • a portion of the physical machine's hard drive and memory capacity is used as the virtual machine's hard drive and memory capacity.
  • Each virtual machine has an independent basic input/output system, hard drive, and operating system, and can be operated like a physical machine.
  • a container is a portable software unit that can combine an application and all its dependencies into a single software package.
  • Edge computing devices refer to devices that are closer to the data source and end users, featuring low latency and high bandwidth, such as intelligent routers and edge servers.
  • a computing device cluster can include multiple of the above-mentioned computing devices; this application does not specifically limit this.
  • the aforementioned computing devices can be computing devices in cloud data centers, edge servers, or local servers in enterprise local data centers; this application does not impose any specific limitations.
  • Client 100 is deployed on a terminal device to enable human-computer interaction.
  • Client 100 can be software or an application running on the terminal device, such as a client for a personal computer (PC), a browser-based client or browser plugin, an application (APP) running on a mobile terminal, or a console for a cloud platform; this application does not specifically limit its scope.
  • Terminal devices include personal computers, smartphones, wearable devices, handheld processing devices, tablets, mobile laptops, augmented reality (AR) devices, virtual reality (VR) devices, smart conferencing devices, etc., and are not specifically limited here.
  • client 100 is a cloud platform client provided by a cloud service provider, used to offer various cloud services to users. Users can purchase or rent cloud services through client 100.
  • the data auditing method provided in this application can be one of these cloud services.
  • the aforementioned data comparison system 200 is deployed on computing equipment in a cloud data center to provide users with cloud services for data auditing. Users can use the data auditing cloud service through client 100.
  • the data comparison system 200 is deployed on a server in the enterprise's local data center.
  • the data comparison system 200 is a solution provided by the enterprise itself or a third party for data auditing.
  • Client devices are deployed on user terminals within the enterprise, such as desktops and laptops. Users can use the cloud services provided by the data comparison system 200 through the client 100 to compare data in the database.
  • the data comparison system 200 and the client 100 can also be deployed on a computing device, which can be a user-used terminal device, such as a tablet or laptop.
  • the storage system includes databases for different data warehouse products.
  • the data comparison system 200 retrieves the data tables to be compared from the different databases of the storage system.
  • the storage system includes storage devices, which can be hard disk drives (HDDs), solid-state drives (SSDs), mechanical hard disk drives (HDDs), USB flash drives, flash memory, SD cards, etc., and this application does not impose specific limitations.
  • the storage array can be a redundant array of independent disks (RAID), network attached storage (NAS), storage area network (SAN), etc., and this application does not impose specific limitations.
  • Figure 2 is a flowchart of a data auditing method provided in this application, which includes the following steps S201 to S203.
  • the client obtains the data table name, generates a data comparison request, and sends the data comparison request to the data comparison system.
  • FIG. 3 is a schematic diagram of a table relationship configuration interface provided in this application.
  • the table relationship configuration interface includes the table name and the table source.
  • the table name indicates that the user should enter the names of the two tables to be compared
  • the table source indicates that the user should enter the database to which the two tables to be compared belong. It should be understood that the two tables have the same name, but they originate from different databases.
  • the user can enter the name of the table to be compared in the input box corresponding to the table name, and enter the database to which the two tables to be compared belong in the input box corresponding to the table source.
  • the table names of the two tables to be compared are profit and loss tables
  • the table sources are Oracle database and Gauss database, respectively.
  • the client 100 After the user enters the above information in the table relationship configuration interface, the client 100 performs a confirmation operation. After detecting the confirmation operation triggered by the user, the client 100 obtains the data table name and data table source information entered by the user, generates a data comparison request, and sends the data comparison request to the data comparison system.
  • the data comparison request includes the above data table name and data table source information.
  • the data table source information includes the name of the first database and the name of the second database.
  • the data comparison system receives a data comparison request and retrieves the first and second data tables to be compared from different databases according to the data table names.
  • data comparison system 200 After receiving a data comparison request from client 100, data comparison system 200 retrieves a first data table from a first database and a second data table from a second database based on the table name and source information in the request.
  • the first and second databases can be different databases; for example, the first database could be an Oracle database and the second database a Gauss database.
  • the first and second databases can be different versions of the same database, such as different versions of a data warehouse product developed by the enterprise.
  • the first and second data tables are two tables obtained by processing the same business data in the two databases; that is, the first data table is obtained by processing business data in the first database, and the second data table is obtained by processing the same business data in the second database.
  • the first and second data tables have the same table names and include the same fields.
  • the data comparison system compares the data in the first data column of the first data table and the second data column of the second data table to determine whether the data in the first data column and the second data column are consistent, and obtains the comparison result.
  • the data comparison system 200 can determine whether the data in the first data column and the second data column are consistent using the following four methods. The four methods for determining whether the data in the first data column and the second data column are consistent are described below.
  • the first method involves comparing the data in the first and second data columns.
  • the data comparison system 200 For the first field value of the first data column in the first data table (which can be any field value in the first data column), the data comparison system 200 first converts the first field value into a fixed-length hash value using a hash algorithm. This hash value is then used as the comparison value corresponding to the first field value.
  • the same method is used to obtain the comparison values corresponding to each of the other field values. For example, if the first data table contains t1 rows of data, meaning the first data column contains t1 field values, then t1 comparison values are obtained using the above method. These t1 comparison values are then added together to obtain the first comparison value corresponding to the first data column.
  • the comparison value corresponding to each field value is obtained using the same method described above.
  • the comparison values corresponding to each field value are then added together to obtain the second comparison value for the second data column. If the first comparison value and the second comparison value are the same, it means that the data in the first data column and the second data column are consistent; if the first comparison value and the second comparison value are different, it means that the data in the first data column and the second data column are inconsistent.
  • the above method allows for the comparison of each column of data in two data tables. If the data in the first data table is correct, the above method can determine if there are data columns in the second data table that are inconsistent with the data in the first data table.
  • the hash algorithm in this application can be a message digest (MD) algorithm, such as the MD5 algorithm, or a secure hash algorithm (SHA), such as SHA-1, SHA-2, SHA-224, SHA-256, SHA-512, etc.
  • MD5 algorithm such as the MD5 algorithm
  • SHA secure hash algorithm
  • This application does not make any specific limitation.
  • the data comparison system uses a hash algorithm to determine the comparison values for two columns with the same data names in both tables. If the comparison values are the same, the two columns are considered identical; otherwise, they are considered different. This method allows for the determination of whether two columns with the same field names are identical, thus improving the efficiency of data auditing. Furthermore, if the data in the first table is accurate, the column-level comparison method can identify the columns containing inconsistent data in the second table. Since data in the same column within a table typically originates from the same source table, the system can trace the source of any discrepancies when a column in the second table is found to be inconsistent with data in the first table.
  • the second method involves comparing the data in the first and second data columns.
  • the data comparison system 200 For the first field value of the first data column in the first data table (which can be any field value in the first data column), the data comparison system 200 first converts the first field value into a fixed-length hash value using a hash algorithm. Then, it performs a logical operation between this hash value and the check value to obtain the comparison value corresponding to the first field value.
  • the same method is used to obtain the comparison values corresponding to each of the other field values. For example, if the first data table contains t1 rows of data, meaning the first data column contains t1 field values, then t1 comparison values are obtained using the above method. These t1 comparison values are then added together to obtain the first comparison value corresponding to the first data column.
  • the above verification values are different.
  • the verification value is a string converted from the field name of the data column to be verified.
  • the verification value corresponding to the first data column is a string converted from the field name of the first data column.
  • the comparison value corresponding to each field value is obtained using the same method described above.
  • the comparison values corresponding to each field value are then added together to obtain the second comparison value for the second data column. If the first comparison value and the second comparison value are the same, it means that the data in the first data column and the second data column are consistent; if the first comparison value and the second comparison value are different, it means that the data in the first data column and the second data column are inconsistent.
  • the third method involves comparing the data in the first and second data columns.
  • the data comparison system 200 For the first field value of the first data column in the first data table (which can be any field value in the first data column), the data comparison system 200 first converts the first field value into a fixed-length hash value using a hash algorithm. If this hash value contains m characters, the data comparison system 200 extracts n consecutive characters from the m-bit hash value to obtain the first string. Here, n is less than or equal to m. After obtaining the first string, it is divided into i groups of strings with the same number of digits, for example, each group contains k digits, where i is an integer greater than or equal to 2, and n is an integer multiple of i. Then, based on the above i groups of strings, the comparison value corresponding to the first field value is determined. The method for determining the comparison value corresponding to the first field value based on the above i groups of strings will be introduced later and will not be described here.
  • the comparison value corresponding to each field value is obtained using the same method described above.
  • the comparison values corresponding to each field value are then added together to obtain the second comparison value for the second data column. If the first comparison value and the second comparison value are the same, it means that the data in the first data column and the second data column are consistent; if the first comparison value and the second comparison value are different, it means that the data in the first data column and the second data column are inconsistent.
  • the following describes a method for determining the alignment value corresponding to the first field value based on the aforementioned i sets of strings. For the aforementioned i sets of strings, a logical operation is performed between the second set of strings and the first set of strings to obtain the first checksum; then, a logical operation is performed between the third set of strings and the first checksum to obtain the second checksum; then, a logical operation is performed between the fourth set of strings and the second checksum to obtain the third checksum; and so on.
  • a logical operation is then performed between the j-th set of strings and the (j-2)-th checksum to obtain the (j-1)-th checksum, until the i-th set of strings and the (i-2)-th checksum are performed to obtain the (i-1)-th checksum.
  • the (i-1)-th checksum is used as the alignment value corresponding to the first field value.
  • the logical operation described above can be an XOR operation or a XNOR operation; this application does not impose any specific limitations.
  • the field value is first converted into a hash value including a 32-bit string using the MD5 algorithm. Then, this 32-bit hash value is used as the first string, divided into groups of 8 bits each, resulting in 4 groups of strings.
  • the first group of strings A and the second group of strings B are XORed to obtain the first checksum; then, the first checksum is XORed with the third group of strings to obtain the second checksum; finally, the second checksum is XORed with the fourth group of strings to obtain the third checksum; the third checksum is used as the comparison value corresponding to the first field value.
  • the above method allows for the comparison of each column of data in two data tables. If the data in the first data table is correct, the above method can determine if there are data columns in the second data table that are inconsistent with the data in the first data table.
  • the comparison value corresponding to each field value is first determined using the above method. Then, based on the comparison values corresponding to the multiple field values included in the column, the comparison value corresponding to the column is determined. For two columns of data in two tables to be compared, after determining the two comparison values corresponding to the two columns of data using the above method, whether the two columns of data are the same can be determined by whether the two comparison values are the same.
  • the above method can convert different types of data into fixed-length strings through hash algorithms, enabling the comparison of different types of data. Furthermore, in the process of comparing two columns of data, the purpose of comparing whether the two columns of data are the same can be achieved through simple operations such as hash algorithms and logical operations. The operation speed is fast, which can improve the efficiency of data auditing.
  • the fourth method involves comparing the data in the first and second data columns.
  • the data comparison system 200 For the first field value of the first data column in the first data table (where the first field value can be any field value in the first data column), the data comparison system 200 first converts the first field value into a fixed-length hash value using a hash algorithm. If this hash value contains m characters, the data comparison system 200 extracts n consecutive characters from the m-bit hash value to obtain the first string. Here, n is less than or equal to m. After obtaining the first string, it is divided into i groups of strings with the same number of digits, for example, each group contains k digits, where i is an integer greater than or equal to 2, and n is an integer multiple of i.
  • the comparison value corresponding to the first field value is determined.
  • the method for determining the comparison value corresponding to the first field value based on the i groups of strings and the initial check value will be described later and will not be explained here.
  • Figure 4 is a schematic diagram of a method for determining the comparison value provided in this application
  • first the first string A is logically operated on with the initial check value to obtain the first check value
  • second string B is logically operated on with the first check value to obtain the second check value
  • third string C is logically operated on with the second check value to obtain the third check value
  • i-th string I is logically operated on with the (i-1)-th check value to obtain the i-th check value, which is then used as the comparison value corresponding to the first field value.
  • the i-th check value is converted into a set of numbers of a preset length through a function, and the set of numbers of the preset length is used as the first comparison value corresponding to the first field value.
  • the field value is first converted into a hash value including a 32-bit string using the MD5 algorithm. This 32-bit hash value is then used as the first string.
  • the first string is divided into groups of 8 bits, resulting in 4 groups of strings.
  • the first group string A is XORed with the initial checksum to obtain the first checksum; then the second group string B is XORed with the first checksum to obtain the second checksum; then the third group string C is XORed with the second checksum to obtain the third checksum; finally, the fourth group string D is XORed with the third checksum to obtain the fourth checksum.
  • the fourth checksum is used as the comparison value corresponding to the first field value.
  • the fourth check value is converted into a set of 64-bit numbers using a function, and the 64-bit numbers are used as the comparison value corresponding to the first field value.
  • the initial validation values are different for different data columns in the same data table.
  • the initial validation value is a string converted from the field name of the data column to be validated.
  • the initial validation value corresponding to the first data column is a string converted from the field name of the first data column.
  • the above method allows for the comparison of each column of data in two data tables. If the data in the first data table is correct, the above method can determine if there are data columns in the second data table that are inconsistent with the data in the first data table.
  • the comparison value corresponding to each field value is first determined using the above method. Then, based on the comparison values corresponding to the multiple field values included in the column, the comparison value corresponding to the column is determined. For two columns of data in two tables to be compared, after determining the two comparison values corresponding to the two columns of data using the above method, whether the two columns of data are the same can be determined by whether the two comparison values are the same.
  • the above method can convert different types of data into fixed-length strings through hash algorithms, enabling the comparison of different types of data. Furthermore, in the process of comparing two columns of data, the purpose of comparing whether the two columns of data are the same can be achieved through simple operations such as hash algorithms and logical operations. The operation speed is fast, which can improve the efficiency of data auditing.
  • the current row-by-row comparison method while able to identify the rows containing inconsistent data in the second data table, suffers from the limitation that a single row contains multiple fields, each with values originating from different sources. Therefore, after identifying the row containing inconsistent data, it's impossible to trace the source of that data to determine the cause of the inconsistency.
  • the column-level comparison method in this application can identify the columns containing inconsistent data in the second data table. Data in the same column within a data table typically originates from the same source table; that is, the data in the same column is derived from the same source table through processing. Therefore, when a column in the second data table is found to be inconsistent with data in the first data table, the source of that column's data can be traced to determine the cause of the inconsistency.
  • the fifth method involves the data comparison system 200, after acquiring the first and second data tables, inserting an identical identifier column into both tables.
  • the column inserted into the first table is identical to the column inserted into the second table, and the value of the identifier column in the s-th row of the first table is identical to the value of the identifier column in the s-th row of the second table.
  • the field value of each row in the identifier column is called a row identifier.
  • Different rows in the identifier column have different row identifiers, and each row identifier uniquely identifies a row of data in the data table.
  • each field value included in the first data column is concatenated with the row identifier of the same row to obtain the concatenated value corresponding to the first data column. That is, the row identifier of the identifier column in the j-th row of the first data table is concatenated with the field value of the first data column in the j-th row of the first data table to obtain the j-th concatenated value, which is the concatenated value corresponding to the j-th field value in the first data column.
  • the first data table includes a field called "Amount". If the "Amount" column is the first data column mentioned above, and the field value of the first data column in the first row is 1000, and the row identifier of the first row is 0001, then the concatenated value corresponding to the first row is 00011000; if the field value of the first data column in the second row is 1549, and the row identifier of the second row is 0002, then the concatenated value corresponding to the second row is 00021549, and so on, to obtain the concatenated value corresponding to the first data column.
  • the data comparison system 200 After obtaining the concatenated value corresponding to the first data column, the data comparison system 200, when determining whether the first data column in the first data table and the second data column in the second data table are consistent, first converts the first concatenated value corresponding to the first field value into a fixed-length second hash value using a hash algorithm. If the second hash value includes m characters, the data comparison system 200 extracts n consecutive characters from the m-character second hash value to obtain the second string.
  • the second string After obtaining the second string, it divides it into i groups of strings with the same number of characters, for example, each group includes k characters, where i is an integer greater than or equal to 2, and n is an integer multiple of i; then, based on the above i groups of strings, it determines the comparison value corresponding to the first concatenated value.
  • the method for determining the comparison value corresponding to the first concatenated value based on the above i groups of strings can refer to the method in the third method described above, which will not be repeated here.
  • the comparison value corresponding to the first concatenated value is also the comparison value corresponding to the first field value.
  • the comparison values corresponding to each other concatenated value are obtained using the same method described above. For example, if the first data table includes t1 rows of data, that is, the first data column includes t1 field values, then t1 comparison values are obtained using the method described above. These t1 comparison values are added together to obtain the first comparison value corresponding to the first data column.
  • the concatenated value corresponding to the second data column is obtained using the same method described above. Then, the comparison value corresponding to each concatenated value is obtained. The comparison values corresponding to each concatenated value are added together to obtain the second comparison value corresponding to the second data column. If the first comparison value and the second comparison value are the same, it means that the data in the first data column and the second data column are consistent; if the first comparison value and the second comparison value are different, it means that the data in the first data column and the second data column are inconsistent.
  • the above method allows for the comparison of each column of data in two data tables. If the data in the first data table is correct, the above method can determine if there are data columns in the second data table that are inconsistent with the data in the first data table.
  • the concatenation value corresponding to each column of data is first obtained using the above method. Then, based on the concatenation value, the comparison value corresponding to each concatenation value is determined. The comparison value corresponding to that column of data is determined based on the comparison values corresponding to multiple concatenation values. For two columns of data in two tables to be compared, after determining the two comparison values corresponding to the two columns of data using the above method, whether the two columns of data are the same can be determined by whether the two comparison values are the same.
  • This method uses a hash algorithm to convert different types of data into fixed-length strings, enabling the comparison of different types of data. Furthermore, in the process of comparing two columns of data, the purpose of comparing whether the two columns of data are the same can be achieved through simple operations such as hash algorithms and logical operations. The operation speed is fast, which can improve the efficiency of data auditing.
  • the system can determine whether the data in two data columns are consistent based on the concatenated value corresponding to the data column. This avoids the situation where two data columns contain the same data but in different orders, leading to incorrect judgments.
  • the data comparison system 200 will determine that the data in the first data column and the second data column are consistent. However, the data in the first row and the second row of the first and second data columns are not consistent, thus leading to the aforementioned misjudgment.
  • the fifth method described above which determines whether the data in two columns are consistent based on concatenated values, avoids the aforementioned misjudgment. For example, if the first row of the first column in the first data table contains 1000 and the second row contains 1549; and the first row of the second column in the second data table contains 1549 and the second row contains 1000, and the data in the other rows of the first and second columns are identical, then using the above method, the concatenated value corresponding to the first row of the first data column is 00011000, and the concatenated value corresponding to the first row of the first data column is 00021549; the concatenated value corresponding to the first row of the second data column is 00011549, and the concatenated value corresponding to the second row of the second data column is 00021000. Therefore, when determining whether the data in the two columns are consistent using the above method, the aforementioned misjudgment can be avoided.
  • the comparison task interface includes fields such as sequence number, table identifier (identity, ID), audit task ID, first data table, second data table, task status, and comparison result.
  • the table ID is the ID of the two data tables being compared
  • the audit task ID represents a comparison task
  • the first and second data tables are the names of the two data tables being compared
  • the task status indicates the execution status of the audit task, including not executed, executing, executed successfully, and executed unsuccessfully.
  • the comparison result includes consistent and inconsistent results.
  • Consistency indicates that the data columns compared in the two data tables are consistent, while inconsistency indicates that the data in the two data tables are inconsistent.
  • the comparison result is inconsistent, the user can trigger the comparison result.
  • the client After detecting the operation that triggers the comparison result, the client generates an application request to obtain the fields in the first and second data tables where the data is inconsistent from the data comparison system 200.
  • Users can add multiple audit tasks to the comparison task interface through the table relationship configuration interface. Then, they can select one or more audit tasks by checking the checkboxes after the serial number on the comparison task interface, and then trigger the start verification control on the comparison task interface. After the client 100 detects that the user has triggered the start verification control, it generates the above data comparison request.
  • this audit task created by the user in Figure 3 involves comparing two data tables, both named "Profit and Loss Table.”
  • the task number is 2, the table IDs of both tables are 12796, the task ID is 14319, and the task status is "Not Executed.”
  • the client 100 obtains the names of the two data tables corresponding to the audit task and the databases to which they belong, generating the aforementioned data comparison request.
  • the comparison task interface may also include one or more fields such as the number of rows in the first data table, the number of rows in the second data table, the creator, the comparison start time, and the comparison end time.
  • the data comparison system 200 When comparing whether the data in two data tables are consistent, it is not necessary to compare all the fields included in the two data tables; comparing only some fields is sufficient. For example, the date field in the two data tables does not need to be compared. Therefore, in this application, after obtaining the first and second data tables, the data comparison system 200 first needs to determine the multiple fields in the two data tables that need to be compared. In one possible implementation, after obtaining the two data tables from the two databases, the data comparison system 200 extracts the field names of all fields included in one of the data tables and sends them to the client 100. The client 100 displays the obtained multiple field names on the table relationship configuration interface for the user to select the fields to be compared.
  • the client 100 After the user selects one or more fields to be compared, the client 100 obtains these one or more fields and sends them to the data comparison system 200.
  • the data comparison system 200 receives the one or more fields sent by the client 100 and compares these one or more fields in the two data tables respectively.
  • the data comparison system 200 can identify the fields in the two data tables that need to be compared. For example, fields such as dates in the data tables may not need to be compared.
  • the data comparison system 200 can determine the fields that need to be compared based on business needs. For example, in the financial field, fields related to amount are more important, such as cost, unit price, and profit, and need to be compared to ensure that the data in the two databases is consistent.
  • the data comparison system 200 can identify the amount-related fields included in the data tables through the semantic information of the field names, and use these identified fields as the fields to be compared.
  • the data management system includes a client 100, a data comparison system 200, and a storage system 300.
  • the deployment methods of the client 100 and the data comparison system 200 can be found in the relevant description in Figure 1, and will not be repeated here.
  • Client 100 is used to obtain the data table name, the name of the first database, and the name of the second database input by the user, generate a data comparison request, and send the data comparison request to data comparison system 200 so that data comparison system 200 can determine whether the data in the two data tables are consistent based on the data comparison request.
  • the operation implemented by client 100 can refer to the operation implemented by client 100 in the method embodiment corresponding to Figures 2-6 above.
  • the method implemented by data comparison system 200 to compare the data in the two data tables can refer to the operation implemented by data comparison system 200 in the method embodiment corresponding to Figures 2-6 above, and will not be described again here.
  • Storage system 300 includes the first database and the second database mentioned above, such as the Oracle database and the Gauss database mentioned above, for storing data generated during business operations.
  • the aforementioned data comparison system 200 includes a data auditing device, which comprises a communication module 210, a processing module 220, and an acquisition module 230.
  • the communication module 210 acquires a data comparison request sent by the client 100.
  • the acquisition module 230 retrieves a first data table indicated by the data table name from a first database and a second data table indicated by the data table name from a second database, based on the data table name in the data comparison request.
  • the processing module 220 compares the two data tables to determine whether the data in the two data tables is consistent.
  • the method by which the processing module 220 compares the data in the two data tables can be referred to the operation of the data comparison system 200 comparing two data tables in the method embodiments corresponding to Figures 2-6 above, and will not be described again here.
  • the communication module 210, processing module 220, and acquisition module 230 described above can all be implemented in software or in hardware.
  • processing module 220 will be described below; other implementation methods can refer to the implementation method of processing module 220.
  • Processing module 220 includes code running on a computing instance.
  • the computing instance includes at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance can be one or more.
  • processing module 220 may include code running on multiple hosts/virtual machines/containers. It should be noted that the multiple hosts/virtual machines/containers used to run the code can be distributed in the same region or in different regions. Further, the multiple hosts/virtual machines/containers used to run the code can be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically proximate data centers. A region may include multiple AZs.
  • AZ availability zone
  • VPC Virtual Private Cloud
  • multiple hosts/virtual machines/containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs.
  • VPC Virtual Private Cloud
  • a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
  • processing module 220 may include at least one computing device, such as a server.
  • processing module 220 may be implemented using a central processing unit (CPU), an application-specific integrated circuit (ASIC), or a programmable logic device (PLD).
  • the PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a neural network processing unit (NPU), a system-on-chip (SoC), an offload card, an accelerator card, or any combination thereof.
  • CPLD complex programmable logical device
  • FPGA field-programmable gate array
  • GAL generic array logic
  • DPU data processing unit
  • NPU neural network processing unit
  • SoC system-on-chip
  • the processing module 220 includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the processing module 220 can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the processing module 220 can be distributed within the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.
  • AZ Availability Zone
  • VPC Virtual Private Cloud
  • the processing module 220 can be used to execute the operations performed by any of the above modules or interfaces.
  • the operations that each module or interface is responsible for can be specified as needed. Through the cooperation of each module, all the functions implemented by the data comparison system 200 can be realized.
  • Storage system 300 may include volatile memory, such as random access memory (RAM).
  • Storage system 300 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD).
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid-state drive
  • storage system 300 may also be implemented using storage class memory (SCM), phase change memory (PCM), or other types of storage media.
  • SCM storage class memory
  • PCM phase change memory
  • the computing device 700 includes a bus 702, a processor 704, a memory 706, and a communication interface 708.
  • the processor 704, the memory 706, and the communication interface 708 communicate with each other via the bus 702.
  • the computing device 700 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 700.
  • the computing device can be a server, such as a central server, an edge server, or a local server in a local data center.
  • the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
  • Bus 702 can be a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (Ubus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), etc.
  • PCIe Peripheral Component Interconnect Express
  • EISA Extended Industry Standard Architecture
  • Ubus or UB Unified Bus
  • CXL Compute Express Link
  • Cache Coherent Interconnect for Accelerators Cache Coherent Interconnect for Accelerators
  • Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one line is used in Figure 8, but this does not indicate that there is only one bus or one type of bus.
  • Bus 702 can include pathways for transmitting information between various components of computing device 700 (e.g., memory 706, processor 704, communication interface 708).
  • the Unified Bus can also be called a Lingqu Bus.
  • the processor 704 may include any one or more of the following computing devices: central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP) or digital signal processor (DSP), ASIC, FPGA, CPLD, NPU, SoC, offload card, accelerator card, etc.
  • CPU central processing unit
  • GPU graphics processing unit
  • MP microprocessor
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • Memory 706 may include volatile memory, such as random access memory (RAM).
  • Processor 704 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid state drive
  • memory 706 may also be implemented using storage class memory (SCM), phase change memory (PCM), or other types of storage media.
  • SCM storage class memory
  • PCM phase change memory
  • the memory 706 stores executable program code, which the processor 704 executes to implement the functions of the data comparison system. That is, the memory 706 stores instructions for executing the data auditing method implemented by the data comparison system in the embodiment corresponding to FIG2.
  • the communication interface 708 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 700 and other devices or communication networks.
  • transceiver modules such as, but not limited to, network interface cards and transceivers
  • the computing device 700 provided according to this application can correspond to the modules included in the data comparison system 200 provided in FIG1 of this application, and can correspond to the corresponding subject in executing the method provided in FIG2 to FIG6 of this application.
  • the above and other operations and/or functions of each module in the computing device 700 are respectively for implementing the corresponding process of the method described in the embodiments corresponding to FIG2 to FIG6. For the sake of brevity, they will not be described in detail here.
  • the computing device 700 may also include a chip system, which includes a processor and a power supply circuit.
  • the power supply circuit supplies power to the processor, and the processor executes the operation steps corresponding to the credit management method.
  • the processor can be implemented using a CPU, or it can be implemented using computing devices or AI chips such as GPUs, DPUs, NPUs, XPUs, SoCs, offloading cards, or accelerator cards.
  • the computing device 700 may include multiple types of processors 704, meaning the computing device 700 is a heterogeneous device.
  • the computing device 700 may include a CPU and a GPU, and the operation steps corresponding to the data audit method can be executed by at least one of the processors 704.
  • the processors 704. For the sake of brevity, further details will not be provided here.
  • the computing device cluster includes at least one computing device as shown in FIG8.
  • the memory 706 of one or more computing devices 700 in the computing device cluster may store the same instructions for executing the data comparison system 200 implemented in the embodiments corresponding to FIG2 to FIG6.
  • the memory 706 of one or more computing devices 700 in the computing device cluster may also store partial instructions for executing the data auditing method.
  • a combination of one or more computing devices 700 can jointly execute instructions for implementing the data auditing method.
  • the memory 706 in different computing devices 700 within the computing device cluster can store different instructions, each used to implement a portion of the functions of the data comparison system 200. That is, the instructions stored in the memory 706 of different computing devices 700 can implement the functions of one or more modules among the communication module 210, processing module 220, and acquisition module 230.
  • one or more computing devices in a computing device cluster can be connected via a network.
  • This network can be a wide area network (WAN) or a local area network (LAN).
  • Figure 9 is a schematic diagram of a network connection between two computing devices provided in this application, illustrating one possible implementation. As shown in Figure 9, two computing devices 700A and 700B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device.
  • the memory 706 in computing device 700A stores instructions for executing the functions of processing module 220. Simultaneously, the memory 706 in computing device 700B stores instructions for executing the functions of acquisition module 230.
  • computing device 700A shown in Figure 9 can also be performed by multiple computing devices 700.
  • computing device 700B can also be performed by multiple computing devices 700.
  • This application also provides a computer program product containing instructions, which may be a software or program product containing instructions capable of running on a computing device or stored on any available medium.
  • the computer program product When the computer program product is run on at least one computing device, the at least one computing device performs the method implemented by the data comparison system in the embodiments corresponding to Figures 2 to 6 above.
  • This application also provides a computer-readable storage medium, which can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media.
  • the available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (e.g., a solid-state drive).
  • the computer-readable storage medium includes instructions that instruct a computing device to execute the method implemented by the data comparison system in the embodiments corresponding to Figures 2 to 6 above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供一种数据稽核方法、装置及相关设备,该方法包括:数据对比系统获取数据对比请求,数据对比请求包括数据表名称、第一数据库的名称和第二数据库的名称;根据数据对比请求从第一数据库中获取第一数据表,从第二数据库中获取第二数据表;然后通过散列算法确定第一数据表中第一数据列对应的第一比对值以及第二数据表中第二数据列对应的第二比对值;如果第一比对值和第二比对值相同,则确定第一数据列的数据与第二数据列的数据相同。通过上述数据稽核方法,通过散列算法确定两个数据表中两列数据对应的比对值,如果两列数据对应的比对值相同则表示两列数据也相同,该方法能够提高数据稽核的效率。

Description

一种数据稽核方法、装置及相关设备
本申请要求于2024年06月14日提交中国国家知识产权局、申请号为202410774083.3、申请名称为“一种数据稽核方法、装置及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其设计一种数据稽核方法、装置及相关设备。
背景技术
数据稽核是数据质量管控的一种重要手段,数据稽核的一个主要目的是确定不同数据库中数据的一致性。数据库字段对比技术是一种通用的数据稽核技术,通过对不同数据库中的表包括的数据进行逐行比对,以确定不同数据库中两个表之间的数据是否一致。但是逐行比对的方法对于大量数据的比对场景无法有效支撑,例如需要对比的两个表均包括千万行数据,逐行对比的效率较低。因此,提供一种高效准确的数据稽核方法,对数据进行全量校验,确保数据质量具有重要意义。
发明内容
本申请提供一种数据稽核方法、装置及相关设备,能够提高对数据表进行数据稽核的效率。
第一方面,本申请提供一种数据稽核方法,包括:数据对比系统获取数据对比请求,该数据对比请求包括数据表名称、第一数据库的名称和第二数据库的名称;数据对比系统根据数据对比请求从第一数据库中获取第一数据表,从第二数据库中获取第二数据表;然后通过散列算法确定第一数据表中第一数据列对应的第一比对值,以及第二数据表中第二数据列对应的第二比对值;在第一比对值和第二比对值相同的情况下,确定第一数据表中第一数据列的数据与第二数据表中第二数据列的数据相同。
应理解,第一数据表和第二数据表的数据表名称相同,第一数据表是第一数据库根据业务数据进行加工处理后得到的,第二数据表是第二数据库根据相同的业务数据进行加工处理后得到的。因此第一数据表和第二数据表中包括的字段相同,在进行数据稽核以确定两个数据表中的数据是否一致时,分别将数据表中具有相同字段名称的两列数据进行对比,确定每个字段对应的数据是否一致,进而确定两个数据表中的数据是否一致。
在需要对比两个数据库中两个数据表的数据是否相同时,数据对比系统在获取到两个数据表之后,对于第一数据表中的和第二数据表中具有相同数据名称的两列数据,通过散列算法确定两个数据表中两列数据对应的比对值,如果两列数据对应的比对值相同,则确定两个数据表中的这两列数据相同,如果两列数据对应的比对值不相同,则确定两个数据表中的这两列数据不相同。通过相同的方法能够依次确定两个数据表中具有相同字段名称的两列数据是否相同,进而确定两个数据表中的数据是否相同,提高数据稽核的效率。进一步的,如果第一数据表中的数据是准确的,上述以列为粒度的对比方法,能够确定第二数据表中不一致的数据所在的列,一个数据表中同一列的数据的来源通常是相同的,即同一列的数据是基于相同的源表通过加工后得到的,在确定第二数据表中的一个数据列的数据与第一数据表中的不一致时,能够对该列数据进行溯源以确定导致不一致的原因。
在一种可能的实现方式中,数据对比系统通过散列算法确定第一数据表中第一数据列对应的第一比对值,包括:数据对比系统通过散列算法和逻辑运算确定第一数据列包括的多个字段值中每个字段值对应的比对值,根据每个字段值对应的比对值确定第一数据列对应的第一比对值。上述逻辑运算为异或运算或同或运算。
在确定数据表中一列数据对应的比对值时,先根据散列算法和逻辑运算分别确定这一列数据所包括的多个字段值中每个字段值对应的比对值,然后根据每个字段值对应的比对值确定这一列数据对应的比对值。例如将每个字段值对应的比对值相加,得到这一列数据对应的比对值。
在一种可能的实现方式中,数据对比系统通过散列算法和逻辑运算确定第一数据列包括的多个字段值中每个字段值对应的比对值,包括:数据对比系统通过散列算法将第一字段值转换为第一散列值;其中,第一字段值是多个字段值中的一个,第一散列值包括m个字符;数据对比系统从第一散列值中提取连续的n个字符,将这n个字符划分为i组字符串;其中,n小于或等于m;然后将i组字符串中的第j组字符串与第j-2校验值进行上述逻辑运算,得到第j-1校验值;最后将第i-1校验值确定为所述第一字段值对应的比对值。其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串。
上述方法中,在需要对比一个数据表中的一列数据与另一个数据表中的一列数据是否相同时,对于一列数据中的每个字段值,先通过上述方法确定每个字段值对应的比对值,进而根据该列数据包括的多个字段值对应的比对值确定该列数据对应的比对值。对于需要比对的两个数据表中的两列数据,通过上述方法确定两列数据对应的两个比对值之后,根据两个比对值是否相同即可确定两列数据是否相同。上述方法通过散列算法能够将不同类型的数据转化为相同长度的字符串,能够实现不同类型的数据的对比,并且在对比两列数据的过程中,通过散列算法以及逻辑运算等简单的运算就能够实现对比两列数据是否相同的目的,运算速度快,能够提高数据稽核的效率。
在一种可能的实现方式中,数据对比系统通过散列算法和逻辑运算确定第一数据列包括的多个字段值中每个字段值对应的比对值,包括:数据对比系统获取第一字段值所属的行的行标识;其中,第一数据表包括的多行数据中每一行对应的行标识各不相同,第一字段值是多个字段值中的一个;数据对比系统将第一字段值对应的行标识与第一字段值进行拼接,得到第一拼接值;然后通过散列算法将第一拼接值转换为第二散列值,该第二散列值包括m个字符;再从第二字符串中提取出连续的n个字符,将这n个字符划分为i组字符串;其中,n小于或等于m;最后将i组字符串中的第j组字符串与第j-2校验值进行上述逻辑运算,得到第j-1校验值;并最终将第i-1校验值确定为第一字段值对应的比对值。其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串。
通过增加标识列,能够避免两个数据列包括的数据相同但是顺序不同导致判断错误的情况。例如,如果第一数据表的第一数据列的第1行数据是1000,第一数据列的第2行的数据是1549;第二数据表的第二数据列的第1行的数据是1549,第二数据列的第1行的数据是1000,第一数据表的第一数据列和第二数据表的第二数据列的其他行的数据都相同,如果不增加行标识组成上述拼接值,数据对比系统计算得到的第一数据列对应的第一比对值和第二数据列对应的第二比对值会是相同的,数据对比系统确定第一数据列和第二数据列的数据一致,但第一数据列和第二数据列的第1行的数据和第2行的数据并不一致,因此会出现误判的情况。
上述基于拼接值确定两个数据列的数据是否一致的方法能够避免上述误判情况。例如,如果第一数据表的第一数据列的第1行数据是1000,第一数据列的第2行的数据是1549;第二数据表的第二数据列的第1行的数据是1549,第二数据列的第2行的数据是1000,第一数据表的第一数据列和第二数据表的第二数据列的其他行的数据都相同。则第一数据列的第1行数据对应的拼接值是00011000,第一数据列的第1行数据对应的拼接值是00021549;第二数据列的第1行数据对应的拼接值是00011549,第二数据列的第2行数据对应的拼接值是00021000,这样数据对比系统计算得到的第一数据列对应的比对值和第二数据列对应的比对值就不会相同,能够避免上述误判情况的发生。
第二方面,本申请提供一种数据稽核装置,包括通信模块、获取模块和处理模块,其中,通信模块用于接收数据对比请求,该数据对比请求包括数据表名称、第一数据库的名称和第二数据库的名称;获取模块用于根据数据对比请求从第一数据库中获取第一数据表,从第二数据库中获取第二数据表;其中,第一数据表和第二数据表的数据表名称相同;处理模块,用于通过散列算法确定第一数据表中第一数据列对应的第一比对值,以及第二数据表中第二数据列对应的第二比对值;在第一比对值和第二比对值相同时,确定第一数据表中第一数据列的数据与第二数据表中第二数据列的数据相同。
在一种可能的实现方式中,上述处理模块通过散列算法确定第一数据表中第一数据列对应的第一比对值时,具体用于:对第一数据列包括的多个字段值,通过散列算法确定多个字段值中每个字段值对应的比对值,根据每个字段值对应的比对值确定第一数据列对应的第一比对值。
在一种可能的实现方式中,上述处理模块具体用于:通过散列算法和逻辑运算确定第一数据列包括的多个字段值中每个字段值对应的比对值,包括:数据对比系统通过散列算法将第一字段值转换为第一散列值;其中,第一字段值是多个字段值中的一个,第一散列值包括m个字符;数据对比系统从第一散列值中提取连续的n个字符,将这n个字符划分为i组字符串;其中,n小于或等于m;然后将i组字符串中的第j组字符串与第j-2校验值进行上述逻辑运算,得到第j-1校验值;最后将第i-1校验值确定为所述第一字段值对应的比对值。其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串;上述逻辑运算为异或运算或同或运算。
在一种可能的实现方式中,上述处理模块具体用于:通过散列算法和逻辑运算确定第一数据列包括的多个字段值中每个字段值对应的比对值,包括:数据对比系统获取第一字段值所属的行的行标识;其中,第一数据表包括的多行数据中每一行对应的行标识各不相同,第一字段值是多个字段值中的一个;数据对比系统将第一字段值对应的行标识与第一字段值进行拼接,得到第一拼接值;然后通过散列算法将第一拼接值转换为第二散列值,该第二散列值包括m个字符;再从第二字符串中提取出连续的n个字符,将这n个字符划分为i组字符串;其中,n小于或等于m;最后将i组字符串中的第j组字符串与第j-2校验值进行上述逻辑运算,得到第j-1校验值;并最终将第i-1校验值确定为第一字段值对应的比对值。其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串。
第三方面,本申请提供一种计算设备,该计算设备包括处理器和存储器,所述存储器用于存储指令,所述处理器用于执行所述存储器中存储的指令,实现如上述第一方面或第一方面任意可能的实现方式中所述的方法。
第四方面,本申请提供一种计算设备集群,计算设备集群包括至少一个计算设备,每个计算设备包括处理器和存储器,其中,每个计算设备的处理器用于执行存储器中存储的指令,以使所述计算设备集群实现如上述第一方面或第一方面任意可能的实现方式中所述的方法。
第五方面,本申请一种计算机可读存储介质,包括计算机程序指令,当所述计算机程序指令被计算设备集群执行时,使得所述计算设备实现如上述第一方面或第一方面任意可能的实现方式中所述的方法。
第六方面,本申请提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序被计算设备集群运行时,实现如第一方面或第一方面任一种可能实现方式描述的方法。
本申请在上述各方面提供的实现方式的基础上,还可以进行进一步组合以提供更多实现方式。
附图说明
图1是本申请提供的一种数据管理系统的示意图;
图2是本申请提供的一种数据稽核方法的流程示意图;
图3是本申请提供的一种表关系配置界面的示意图;
图4是本申请提供的一种确定对比值的示意图;
图5是本申请提供的一种拼接值的示意图;
图6是本申请提供的一种比对任务界面的示意图;
图7是本申请提供的一种数据管理系统的示意图;
图8是本申请提供的一种计算设备的示意图;
图9是本申请提供的两个计算设备之间通过网络连接的示意图。
具体实施方式
下面结合附图对本申请提供的数据稽核方法进行介绍。
数据稽核是指对数据进行审查和验证,以确保数据的准确性、完整性和一致性等。在数据管理和数据分析中,数据稽核是数据质量管控的一种重要手段,在很多场景具有重要的应用。例如,随着数据仓库(简称数仓)的发展,企业的业务通常会基于最新的数仓产品进行产品的迭代升级,以满足业务发展的需要。在进行数仓产品的平行替代的过程中,会在一段时间内并行运行新旧两个数据仓库系统,业务在运行过程中产生的业务数据会被发送到两个数据库中进行加工处理,使用两个数据库存储数据,因此在数仓产品的迭代升级过程中,需要对比不同数据库对业务数据进行处理后得到的数据,以确保不同数据库中的数据的一致性。
数据稽核是一种验证数据一致性的方法,数据库字段对比技术是一种通用的数据稽核技术,通过对不同数据库中的表进行逐行比对,以确定不同数据库中两个表之间的数据是否一致。但是逐行比对的方法对于大量数据的比对场景无法有效支撑,例如需要对比的两个表均包括千万行数据,逐行对比的效率较低。因此,提供一种高效准确的数据稽核方法,对数据进行全量校验,确保数据质量具有重要意义。
为了解决上述问题,本申请提供一种数据稽核方法,在需要对比两个数据表中的数据是否一致时,以列为单位进行对比,例如,对于第一数据表和第二数据表中具有相同字段名称的两列数据,将第一数据表中的该列称为第一数据列,将第二数据表中的该列数据称为第二数据列。在进行对比时,对于第一数据列中的任意一个字段值,例如第一字段值,首先通过散列函数将第一字段值转换成包括m个字符的散列值,然后从散列值中提取n个连续的字符得到第一字符串,其中,n是小于或等于m。在得到第一字符串之后,将第一字符串划分为i组具有相同位数的字符串,例如每组字符串包括k位,其中,i为大于或等于2的整数,n为i的整数倍;再基于上述i组字符串确定该第一字段值对应的比对值。对于第一数据列中的其他字段值,根据上述相同的方法,得到其他各个字段值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到每个字段值对应的比对值,将各个字段值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
通过上述方法,能够确定第二数据表中的每列数据是否与第一数据表中对应列的数据是否一致,进而确定第二数据表中的数据与第一数据表中的数据是否一致。上述方法通过散列算法能够将不同类型的数据转化为固定长度的字符串,实现不同类型的数据的对比,并且在对比两列数据的过程中,通过散列算法等简单的运算就能够实现对比两列数据是否相同的目的,运算速度快,能够提高数据稽核的效率。
需要说明的是,第一数据表和第二数据表是两个数据库根据相同的业务数据进行加工处理得到的两个数据表,即第一数据表是第一数据库对业务数据进行加工处理得到的,第二数据表是第二数据库对相同的业务数据进行加工得到的。第一数据库和第二数据库是不同的数据库,例如第一数据库是oracle数据库,第二数据库是高斯数据库;第一数据库和第二数据库也可以是相同数据库的不同版本。
下面结合图1对本申请提供的应用上述数据稽核方法的数据管理系统进行介绍。
图1是本申请提供的一种数据管理系统的示意图,该数据管理系统包括客户端100和数据对比系统200。其中,客户端100和数据对比系统200之间通信连接,与数据对比系统200建立通信连接的客户端100可以是一个或多个,本申请不做具体限定。
数据对比系统200可以部署于单个计算设备或部署于包括多个计算设备的计算设备集群,计算设备可以是服务器、虚拟机、容器或者边缘计算设备。虚拟机指的是通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。在实体计算机中能够完成的工作在虚拟机中都能够实现。在计算设备中创建虚拟机时,需要将实体机的部分硬盘和内存容量作为虚拟机的硬盘和内存容量。每个虚拟机都有独立的基础输入/输出系统、硬盘和操作系统,能够像使用实体机一样对虚拟机进行操作;容器是一种便携式软件单元,可以将应用及其所有依赖项合并为一个软件包,该软件包不受底层主机操作系统的限制,这样无需再构建复杂的环境,简化了应用开发到部署的过程;边缘计算设备是指更加接近数据源和终端用户,具有低延迟、高带宽特点的设备,比如智能路由、边缘服务器等等。计算设备集群可包括多个上述计算设备,本申请不作具体限定。
上述计算设备可以是云数据中心的计算设备,也可以是边缘服务器,还可以是企业本地数据中心中的本地服务器,本申请不作具体限定。
客户端100部署于终端设备,用于实现人机交互。客户端100可以是终端设备运行的软件或者应用程序,比如个人电脑(personal computer,PC)的客户端,也可以是基于浏览器访问的客户端,或者浏览器的插件,还可以是在移动终端上运行的应用(application,APP),还可以是云平台的控制台(console),本申请不作具体限定。终端设备包括个人电脑、智能手机、可穿戴设备、掌上处理设备、平板电脑、移动笔记本、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、智能会议设备等等,在此不作具体限定。
在一种可能的实现方式中,客户端100是云服务提供商提供的云平台客户端,用于向用户提供各种云服务,用户能够通过客户端100购买或者租用云服务,本申请提供的数据稽核方法可以是其中的一项云服务,上述数据对比系统200部署于云数据中心的计算设备,用于向用户提供数据稽核的云服务。用户能够通过客户端100使用数据稽核云服务。
在另一种可能的实现方式中,数据对比系统200部署于企业本地数据中心的服务器,数据对比系统200是企业自身或者第三方提供的用于实现数据稽核的解决方案,客户端部署于企业内部用户使用终端设备,例如台式机、笔记本电脑等。用户能够通过客户端100使用数据对比系统200提供的云服务,对数据库中的数据进行对比。
在另一种可能的实现方式中,数据对比系统200和客户端100也可以部署在一个计算设备,此时计算设备可以用户使用的终端设备,例如平板电脑、笔记本电脑。
存储系统包括不同的数仓产品的数据库,数据对比系统200从存储系统的不同数据库中获取需要对比的数据表。存储系统包括存储设备,存储设备可以是硬盘驱动器(hard disk drive,HDD)、固态硬盘(solid state disk,SSD)、机械硬盘(mechanical hard disk,HDD)、U盘(universal serial bus,USB)、闪存(flash)、SD卡(secure digital memory Card,SD card)等,本申请不作具体限定。存储阵列可以是冗余独立磁盘阵列(redundant array of independent disks,RAID)、网络附加存储(network attached storage,NAS)、存储区域网络(storage area network,SAN)等,本申请不作具体限定。
应理解,上述部署方式仅用于举例,客户端100、数据对比系统200以及存储系统可以根据实际的业务需求进行灵活部署,本申请不做具体限定。
下面结合附图详细介绍本申请提供的数据稽核方法,参见图2,图2是本申请提供的一种数据稽核方法的流程示意图,该数据稽核方法包括如下S201~S203。
S201.客户端获取数据表名称,生成数据对比请求,向数据对比系统发送数据对比请求。
本申请中,用户在需要对两个表中的字段进行对比,客户端100能够向用户提供表关系配置界面,如图3所示,图3是本申请提供的一种表关系配置界面的示意图。表关系配置界面包括数据表名称以及数据表来源。数据表名称指示用户输入需要对比的两个数据表的名称,数据表来源用于指示用户输入进行对比的两个数据表所属的数据库。应理解,两个数据表的名称是相同的,两个数据表来源于不同的数据库。用户能够在数据表名称对应的输入框中输入需要对比的数据表名称,并在数据表来源对应的输入框中输入需要对比的两个表所属的数据库。如图3中所示,需要对比的两个数据表的表名称是损益表,数据表来源分别为Oracle数据库和Gauss数据库。
用户在表关系配置界面输入上述信息之后,进行确认操作,客户端100在检测到用户触发的确认操作之后,获取用户输入的数据表名称和数据表来源信息,生成数据对比请求,并向数据对比系统发送数据对比请求,该数据对比请求包括上述数据表名称和数据表来源信息,数据表来源信息包括第一数据库的名称和第二数据库的名称。
S202.数据对比系统接收数据对比请求,根据数据表名称分别从不同的数据库中获取需要对比的第一数据表和第二数据表。
数据对比系统200在接收到客户端100发送的数据对比请求之后,根据数据对比请求中的数据表名称和数据表来源信息,从第一数据库中获取第一数据表,从第二数据库中获取第二数据表。其中,第一数据库和第二数据库是不同的数据库,例如第一数据库是Oracle数据库,第二数据库是Gauss数据库;第一数据库和第二数据库也可以是相同数据库的不同版本,例如企业自行研发的数仓产品的不同版本的数据库。第一数据表和第二数据表是两个数据库根据相同的业务数据进行加工处理得到的两个数据表,即第一数据表是第一数据库对业务数据进行加工处理得到的,第二数据表是第二数据库对相同的业务数据进行加工处理得到的,第一数据表和第二数据表的表名称相同,第一数据表和第二数据表包括的字段相同。
S203.数据对比系统对第一数据表的第一数据列和第二数据表的第二数据列的数据进行对比,确定第一数据列和第二数据列的数据是否一致,得到对比结果。
数据对比系统200在获取第一数据库中的第一数据表和第二数据库中的第二数据表之后,以列为粒度对两个数据表的数据进行对比,即数据对比系统200先对比第一数据表和第二数据表中具有相同字段名称的两列数据是否一致,然后再对比第一数据表和第二数据表中具有相同数据名称的另外两列数据是否一致。应理解,数据对比系统200对比两个数据表中具有相同字段名称的任意两列数据的方法均相同,本申请中以数据对比系统200对比第一数据表中的第一数据列和第二数据表中的第二数据列为例,介绍本申请提供的数据稽核方法,上述第一数据列和第二数据列是第一数据表和第二数据表中需要进行数据对比的两个列。应理解,在对两个数据表的数据进行对比时,通常是对两个字段名称相同的列进行对比,即第一数据列和第二数据列的字段名称相同。
本申请中,数据对比系统200能够通过以下四种方法确定第一数据列和第二数据列中的数据是否一致。下面分别介绍确定第一数据列和第二数据列中的数据是否一致的四种方法。
第一种方法,在对比第一数据列和第二数据列的数据是否一致时,对于第一数据表中第一数据列的第一字段值,第一字段值是第一数据列中的任意一个字段值,数据对比系统200首先将第一字段值通过散列算法转换为固定长度的散列值,将该散列值作为第一字段值对应的比对值。对于第一数据列中的其他字段值,根据上述相同的方法,得到其他各个字段值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到每个字段值对应的比对值,将各个字段值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
通过上述方法,能够对两个数据表中的每一列数据进行对比,如果第一数据表中的数据是正确的数据表,通过上述方法能够确定第二数据表中与第一数据表存在数据不一致的数据列。
需要说明的是,本申请中的散列算法可以是消息摘要(message digest,MD)算法,例如MD5算法,也可以是安全哈希算法(secure hash algorithm,SHA),例如SHA-1、SHA-2、SHA-224、SHA-256、SHA-512等算法,本申请不做具体限定。
在需要对比两个数据库中两个数据表的数据是否相同时,数据对比系统在获取到两个数据表之后,对于第一数据表中的和第二数据表中具有相同数据名称的两列数据,通过散列算法确定两个数据表中两列数据对应的比对值,如果两列数据对应的比对值相同,则确定两个数据表中的这两列数据相同,如果两列数据对应的比对值不相同,则确定两个数据表中的这两列数据不相同。通过相同的方法能够依次确定两个数据表中具有相同字段名称的两列数据是否相同,进而确定两个数据表中的数据是否相同,提高数据稽核的效率。进一步的,如果第一数据表中的数据是准确的,上述以列为粒度的对比方法,能够确定第二数据表中不一致的数据所在的列,一个数据表中同一列的数据的来源通常是相同的,即同一列的数据是基于相同的源表通过加工后得到的,在确定第二数据表中的一个数据列的数据与第一数据表中的不一致时,能够对该列数据进行溯源以确定导致不一致的原因。
第二种方法,在对比第一数据列和第二数据列的数据是否一致时,对于第一数据表中第一数据列的第一字段值,第一字段值是第一数据列中的任意一个字段值,数据对比系统200首先将第一字段值通过散列算法转换为固定长度的散列值,然后将该散列值与校验值进行逻辑运算,得到第一字段值对应的比对值。对于第一数据列中的其他字段值,根据上述相同的方法,得到其他各个字段值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
其中,对于同一个数据表的不同的数据列,上述校验值不相同,例如校验值是根据待校验数据列的字段名称转换得到的一个字符串,上述第一数据列对应的校验值是根据第一数据列的字段名称转换得到的字符串。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到每个字段值对应的比对值,将各个字段值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
通过上述方法,能够对两个数据表中的每一列数据进行对比,如果第一数据表中的数据是正确的数据表,通过上述方法能够确定第二数据表中与第一数据表存在数据不一致的数据列。
第三种方法,在对比第一数据列和第二数据列的数据是否一致时,对于第一数据表中第一数据列的第一字段值,第一字段值是第一数据列中的任意一个字段值,数据对比系统200首先将第一字段值通过散列算法转换为固定长度的散列值。如果该散列值包括m个字符,数据对比系统200从m位的散列值中提取出连续的n位字符,得到第一字符串。其中,n小于或等于m。在得到第一字符串之后,将第一字符串划分为i组相同位数的字符串,例如每组字符串包括k位,其中,i为大于或等于2的整数,n为i的整数倍;再基于上述i组字符串确定该第一字段值对应的比对值。其中,根据上述i组字符串确定第一字段值对应的比对值的方法在后文进行介绍,在此不再说明。
对于第一数据列中的其他字段值,根据上述相同的方法,得到其他各个字段值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到每个字段值对应的比对值,将各个字段值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
下面介绍根据上述i组字符串确定第一字段值对应的比对值的方法。对于上述i组字符串,将第二组字符串与第一组字符串进行逻辑运算,得到第一校验值;然后将第三组字符串与第一校验值进行逻辑运算,得到第二校验值;再将第四组字符串与第二校验值进行逻辑运算,得到第三校验值;依次类推,再将第j组字符串与第j-2校验值进行逻辑运算,得到第j-1校验值,直至将第i组字符串与第i-2校验值进行上述逻辑运算,得到第i-1校验值,将第i-1校验值作为第一字段值对应的比对值。其中,本申请上述逻辑运算可以是异或运算或者是同或运算,本申请不做具体限定。
可选的,在得到第i-1校验值之后,将第i-1校验值通过函数转换为预设长度的一组数字,将该预设长度的一组数字作为第一字段值对应的第一比对值。
示例性的,以散列算法是MD5算法,逻辑运算为异或运算为例,对于第一数据列中的一个字段值,首先通过MD5算法将该字段值转换为包括32位字符串的散列值。然后将这32位的散列值作为第一字符串,按照8位一组进行划分,得到4组字符串。在得到上述4组字符串之后,将第一组字符串A和第二组字符串B进行异或运算,得到第一校验值;再将第一校验值和第三组字符串进行异或运算,得到第二校验值;再将第二校验值与第四组字符串进行异或运算,得到第三校验值;将第三校验值作为第一字段值对应的比对值。
可选的,在得到第三校验值之后,将第三校验值通过函数转换为一组64位的数字,将该64位的数字作为第一字段值对应的比对值。
通过上述方法,能够对两个数据表中的每一列数据进行对比,如果第一数据表中的数据是正确的数据表,通过上述方法能够确定第二数据表中与第一数据表存在数据不一致的数据列。
上述方法中,在需要对比一个数据表中的一列数据与另一个数据表中的一列数据是否相同时,对于一列数据中的每个字段值,先通过上述方法确定每个字段值对应的比对值,进而根据该列数据包括的多个字段值对应的比对值确定该列数据对应的比对值。对于需要比对的两个数据表中的两列数据,通过上述方法确定两列数据对应的两个比对值之后,根据两个比对值是否相同即可确定两列数据是否相同。上述方法通过散列算法能够将不同类型的数据转化为固定长度的字符串,能够实现不同类型的数据的对比,并且在对比两列数据的过程中,通过散列算法以及逻辑运算等简单的运算就能够实现对比两列数据是否相同的目的,运算速度快,能够提高数据稽核的效率。
进一步的,对于上述第一数据表和第二数据表,如果将第一数据表中的数据作为正确的数据,当前逐行对比的方法虽然能够确定第二数据表中不一致的数据所在的行,但是一行数据包括多个字段,每个字段的字段值的来源是不同,因此在确定不一致的数据所在的行之后,无法对该行数据进行溯源以确定导致数据不一致的原因。本申请中以列为粒度的对比方法,能够确定第二数据表中不一致的数据所在的列,一个数据表中同一列的数据的来源通常是相同的,即同一列的数据是基于相同的源表通过加工后得到的,在确定第二数据表中的一个数据列的数据与第一数据表中的不一致时,能够对该列数据进行溯源以确定导致不一致的原因。
第四种方法,在对比第一数据列和第二数据列的数据是否一致时,对于第一数据表中第一数据列的第一字段值,第一字段值是第一数据列中的任意一个字段值,数据对比系统200首先将第一字段值通过散列算法转换为固定长度的第一散列值。如果该第一散列值包括m位字符,数据对比系统200从m位的第一散列值中提取出连续n位字符,得到第一字符串。其中,n小于或等于m。在得到第一字符串之后,将第一字符串划分为i组相同位数的字符串,例如每组字符串包括k位,其中,i为大于或等于2的整数,n为i的整数倍;再基于上述i组字符串和初始校验值确定该第一字段值对应的比对值。其中,根据上述i组字符串和初始校验值确定第一字段值对应的比对值的方法在后文进行介绍,在此不再说明。
对于第一数据列中的其他字段值,根据上述相同的方法,得到其他各个字段值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到每个字段值对应的比对值,将各个字段值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
下面介绍根据上述i组字符串和初始校验值确定第一字段值对应的比对值的方法。如图4所示,图4是本申请提供的一种确定对比值的示意图。对于上述i组字符串,先将第一组字符串A与初始校验值进行逻辑运算,得到第一校验值;再将第二组字符串B与第一校验值进行相同的逻辑运算,得到第二校验值;再将第三组字符串C与第二校验值进行相同的逻辑运算,得到第三校验值;依此类推,直至将第i组字符串I与第i-1校验值进行上述逻辑运算,得到第i校验值,将第i校验值作为第一字段值对应的比对值。
可选的,在得到第i校验值之后,将第i校验值通过函数转换为预设长度的一组数字,将该预设长度的一组数字作为第一字段值对应的第一比对值。
示例性的,以散列算法是MD5算法,逻辑运算为异或运算为例,对于第一数据列中的一个字段值,首先通过MD5算法将该字段值转换为包括32位字符串的散列值。然后将这32位的散列值作为第一字符串。将第一字符串按照8位一组进行划分,得到4组字符串。在得到上述4组字符串之后,将第一组字符串A和初始校验值进行异或运算,得到第一校验值;再将第二组字符串B与第一校验值进行异或运算,得到第二校验值;再将第三组字符串C与第二校验值进行异或运算,得到第三校验值;再将第四组字符串D与第三校验值进行异或运算,得到第四校验值,将第四校验值作为第一字段值对应的比对值。
可选的,在得到第四校验值之后,将第四校验值通过函数转换为一组64位的数字,将该64位的数字作为第一字段值对应的比对值。
需要说明的是,对于同一个数据表的不同的数据列,上述初始校验值不相同,例如初始校验值是根据待校验数据列的字段名称转换得到的一个字符串,上述第一数据列对应的初始校验值是根据第一数据列的字段名称转换得到的字符串。
通过上述方法,能够对两个数据表中的每一列数据进行对比,如果第一数据表中的数据是正确的数据表,通过上述方法能够确定第二数据表中与第一数据表存在数据不一致的数据列。
上述方法中,在需要对比一个数据表中的一列数据与另一个数据表中的一列数据是否相同时,对于一列数据中的每个字段值,先通过上述方法确定每个字段值对应的比对值,进而根据该列数据包括的多个字段值对应的比对值确定该列数据对应的比对值。对于需要比对的两个数据表中的两列数据,通过上述方法确定两列数据对应的两个比对值之后,根据两个比对值是否相同即可确定两列数据是否相同。上述方法通过散列算法能够将不同类型的数据转化为固定长度的字符串,能够实现不同类型的数据的对比,并且在对比两列数据的过程中,通过散列算法以及逻辑运算等简单的运算就能够实现对比两列数据是否相同的目的,运算速度快,能够提高数据稽核的效率。
进一步的,对于上述第一数据表和第二数据表,如果将第一数据表中的数据作为正确的数据,当前逐行对比的方法虽然能够确定第二数据表中不一致的数据所在的行,但是一行数据包括多个字段,每个字段的字段值的来源是不同,因此在确定不一致的数据所在的行之后,无法对该行数据进行溯源以确定导致数据不一致的原因。本申请中以列为粒度的对比方法,能够确定第二数据表中不一致的数据所在的列,一个数据表中同一列的数据的来源通常是相同的,即同一列的数据是基于相同的源表通过加工后得到的,在确定第二数据表中的一个数据列的数据与第一数据表中的不一致时,能够对该列数据进行溯源以确定导致不一致的原因。
第五种方法,数据对比系统200在获取第一数据表和第二数据表之后,分别在第一数据表和第二数据表中插入一列相同的标识列,即在第一数据表中插入的一列数据和在第二数据表中插入的一列数据相同,第一数据表的第s行数据中标识列的值与第二数据表的第s行数据中标识列的值相同。本申请中,将标识列中每一行的字段值称为行标识,标识列中的不同行的行标识各不相同,每个行标识用于唯一的标识数据表中的一行数据。
在第一数据表和第二数据表中插入标识列之后,在确定第一数据表中第一数据列和第二数据表中第二数据列是否一致时,对于第一数据表中第一数据列的数据,将第一数据列包括的每个字段值与同一行的行标识进行拼接,得到第一数据列对应的拼接值。即,将第一数据表中第j行数据中的标识列的行标识与第j行数据中的第一数据列的字段值进行拼接,得到第j个拼接值,第j个拼接值就是第一数据列中第j个字段值对应的拼接值。
示例性的,如图5所示,图5是本申请提供的一种拼接值的示意图。图5中,第一数据表中包括的金额这一字段,如果金额这一列为上述第一数据列,第一行的第一数据列的字段值是1000,第一行的行标识是0001,则第一行对应的拼接值是00011000;如果第二行的第一数据列的字段值是1549,第二行的行标识是0002,则第二行对应的拼接值是00021549,依次类推,得到第一数据列对应的拼接值。
数据对比系统200在得到第一数据列对应的拼接值之后,在确定第一数据表中第一数据列和第二数据表中第二数据列是否一致时,对于第一字段值对应的第一拼接值,数据对比系统200首先将第一拼接值通过散列算法转换为固定长度的第二散列值。如果该第二散列值包括m位字符,数据对比系统200从m位的第二散列值中提取出连续的n位,得到第二字符串。在得到第二字符串之后,将第二字符串划分为i组相同位数的字符串,例如每组字符串包括k位,其中,i为大于或等于2的整数,n为i的整数倍;再基于上述i组字符串确定该第一拼接值对应的比对值。其中,根据上述i组字符串确定第一拼接值对应的比对值的方法,可以参照上述第三种方法中,根据i组字符串确定第一拼接值对应的比对值的方法,在此不再赘述。其中,第一拼接值对应的比对值也就是第一字段值对应的比对值。
对于第一数据列对应的其他拼接值,根据上述相同的方法,得到其他各个拼接值对应的比对值。例如第一数据表包括t1行数据,即第一数据列包括t1个字段值,则根据上述方法得到t1个比对值,将这t1个比对值相加,得到第一数据列对应的第一比对值。
对于第二数据表中第二数据列的每个字段值,通过上述相同的方法得到第二数据列对应的拼接值,然后得到每个拼接值对应的比对值,将各个拼接值对应的比对值相加,得到第二数据列对应的第二比对值。如果第一比对值和第二比对值相同,则表示第一数据列和第二数据列中的数据一致;如果第一比对值和第二比对值不相同,则表示第一数据列和第二数据列中的数据不一致。
通过上述方法,能够对两个数据表中的每一列数据进行对比,如果第一数据表中的数据是正确的数据表,通过上述方法能够确定第二数据表中与第一数据表存在数据不一致的数据列。
上述方法中,在需要对比一个数据表中的一列数据与另一个数据表中的一列数据是否相同时,先通过上述方法得到每列数据对应的拼接值,然后基于拼接值确定每个拼接值对应的比对值,根据该列数据对应的多个拼接值对应的比对值确定该列数据对应的比对值。对于需要比对的两个数据表中的两列数据,通过上述方法确定两列数据对应的两个比对值之后,根据两个比对值是否相同即可确定两列数据是否相同。上述方法通过散列算法将不同类型的数据转化为固定长度的字符串,能够实现不同类型的数据的对比,并且在对比两列数据的过程中,通过散列算法以及逻辑运算等简单的运算就能够实现对比两列数据是否相同的目的,运算速度快,能够提高数据稽核的效率。
进一步的,通过增加标识列,根据标识列的行标识得到数据列对应的拼接值之后,基于数据列对应的拼接值判断两个数据列的数据是否一致,能够避免两个数据列包括的数据相同但是顺序不同导致判断错误的情况。例如,如果第一数据表的第一数据列的第1行数据是1000,第一数据列的第2行的数据是1549;第二数据表的第二数据列的第1行的数据是1549,第二数据列的第1行的数据是1000,第一数据表的第一数据列和第二数据表的第二数据列的其他行的数据都相同,如果按照上述第一种方法~第四种方法,第一数据列对应的第一比对值和第二数据列对应的第二比对值会是相同的,数据对比系统200确定第一数据列和第二数据列的数据一致,但第一数据列和第二数据列的第1行的数据和第2行的数据并不一致,因此会出现上述误判的情况。
上述第五种方法基于拼接值确定两个数据列的数据是否一致的方法能够避免上述误判情况。例如,如果第一数据表的第一数据列的第1行数据是1000,第一数据列的第2行的数据是1549;第二数据表的第二数据列的第1行的数据是1549,第二数据列的第2行的数据是1000,第一数据表的第一数据列和第二数据表的第二数据列的其他行的数据都相同。通过上述方法,第一数据列的第1行数据对应的拼接值是00011000,第一数据列的第1行数据对应的拼接值是00021549;第二数据列的第1行数据对应的拼接值是00011549,第二数据列的第2行数据对应的拼接值是00021000,这样再通过上述方法确定两个数据列的数据是否一致时,能够避免上述误判情况的发生。
在一种可能的实现方式中,上述S201中,客户端100检测到用户在表关系配置界面触发的确认操作之后,能够在比对任务界面增加一个新的稽核任务。如图6所示,图6是本申请提供的一种比对任务界面的示意图。比对任务界面包括序号、表标识(identity,ID)、稽核任务ID、第一数据表、第二数据表、任务状态、对比结果等字段。其中,表ID是对比的两个数据表的ID,稽核任务ID用于表示一个对比任务,第一数据表和第二数据表是对比的两个数据表的名称,任务状态指示稽核任务的执行状态,任务状态包括未执行、执行中、执行成功和执行失败。对比结果包括一致和不一致,一致表示两个数据表中对比的数据列包括的数据是一致的,不一致表示两个数据表中的数据不一致,当比对结果是不一致时,用户能够通过触发该比对结果,客户端在检测到触发该比对结果的操作之后,生成申请请求,以从数据对比系统200获取第一数据表和第二数据表中数据存在不一致的字段。
用户能够通过表关系配置界面向比对任务界面添加多个稽核任务,然后通过比对任务界面序号后的复选框,选择一个或多个稽核任务,再触发比对任务界面的开始校验控件,客户端100在检测到用户触发开始校验控件之后,生成上述数据对比请求。
如图6中所示,图6中展示了图3中用户创建的一个稽核任务,该稽核任务需要对比的两个数据表的名称都是损益表,该稽核任务的序号是2,两个数据表的表ID都是12796,稽核任务ID是14319,任务状态是未执行。用户在该界面选择该稽核任务,触发开始校验控件之后,客户端100获取该稽核任务对应的两个数据表的名称以及这两个数据表所属的数据库,生成上述数据对比请求。
可选的,上述比对任务界面还可以包括第一数据表行数、第二数据表行数、创建人、比对开始时间和比对结束时间等字段中的一种或多种。
在对比两个数据表中的数据是否一致时,可以不用对比两个数据表包括的全部字段,对比两个数据表中的部分字段即可。例如对于两个数据表中的日期字段可以不用对比。因此,本申请中,数据对比系统200在获取第一数据表和第二数据表之后,首先要确定两个数据表中需要对比的多个字段。在一种可能的实现方式中,数据对比系统200从两个数据库中获取两个数据表之后,从其中一个数据表中提取该数据表包括的所有字段的字段名称,发送给客户端100,客户端100在上述表关系配置界面显示获取的多个字段名称,以供用户选择需要对比的字段。用户在选择需要对比的一个或多个字段之后,客户端100获取这一个或多个字段,将这一个或多个字段发送的数据对比系统200。数据对比系统200接收客户端100发送的一个或多个字段,对两个数据表中的这一个或多个字段中分别进行对比。
在另一种可能的实现方式中,在对两个数据表进行对比以确定两个数据表中的数据是否一致之前,数据对比系统200能够识别两个数据表中需要对比的字段,例如,对于数据表中的日期等字段,可以不进行对比。数据对比系统200能够根据业务需求确定需要对比的字段,例如在财务领域,与金额相关的字段比较重要,例如成本、单价、利润等字段比较重要,需要进行对比以确保两个数据库中的数据是一致的。数据对比系统200能够通过字段名称的语义信息确定数据表中包括的与金额相关的字段,将识别出的这些字段作为需要对比的字段。
对于上述方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请所必须的。因此,本领域的技术人员根据以上描述的内容,能够想到的其他合理的步骤组合,也属于本申请的保护范围内。
上文结合图1至图6详细介绍了本申请所要保护的数据稽核方法,接下来,进一步结合图7至图9分别介绍本申请所要保护的系统、装置、计算设备和计算设备集群。
参见图7,图7是本申请提供的一种数据管理系统的示意图,该数据管理系统包括客户端100、数据对比系统200和存储系统300。客户端100和数据对比系统200的部署方式可以参见图1相关的介绍,在此不再赘述。
客户端100用于获取用户输入的数据表名称、第一数据库的名称和第二数据库的名称,生成数据对比请求并将数据对比请求发送给数据对比系统200,以使数据对比系统200根据数据对比请求确定两个数据表的数据是否一致;其中,客户端100实现的操作可以参照上述图2-图6所对应的方法实施例中客户端100实现的操作,数据对比系统200实现对两个数据表中的数据进行对比的方法可以参照上述图2-图6所对应的方法实施例中数据对比系统200实现的操作,在此不再赘述。
存储系统300包括上述第一数据库和第二数据库,例如上述Oracle数据库和Gauss数据库,用于存储业务在运行过程中产生的数据。
上述数据对比系统200包括数据稽核装置,数据稽核装置包括通信模块210、处理模块220和获取模块230,通信模块210用于获取客户端100发送的数据对比请求,获取模块230用于根据数据对比请求中的数据表名称从第一数据库中获取数据表名称指示的第一数据表,以及从第二数据库中获取数据表名称指示的第二数据表。处理模块220用于对两个数据表进行对比,以确定两个数据表中的数据是否一致,处理模块220实现对两个数据表中的数据进行对比的方法可以参照上述图2-图6所对应的方法实施例中数据对比系统200对两个数据表进行对比的操作,在此不再赘述。
上述通信模块210、处理模块220和获取模块230均可以通过软件实现,或者可以通过硬件实现。示例性的,接下来以处理模块220为例,介绍处理模块220的实现方式,其他模板的实现方式可以参考处理模块220的实现方式。
处理模块220作为软件功能单元的一种举例,处理模块220包括运行在计算实例上的代码。其中,计算实例包括物理主机(计算设备)、虚拟机、容器中的至少一种。进一步地,上述计算实例可以是一台或者多台。例如,处理模块220可以包括运行在多个主机/虚拟机/容器上的代码。需要说明的是,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的区域(region)中,也可以分布在不同的region中。进一步地,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的可用区(availability zone,AZ)中,也可以分布在不同的AZ中,每个AZ包括一个数据中心或多个地理位置相近的数据中心。其中,一个region可以包括多个AZ。
同样,用于运行该代码的多个主机/虚拟机/容器可以分布在同一个虚拟私有云(virtual private cloud,VPC)中,也可以分布在多个VPC中。其中,通常一个VPC设置在一个region内,同一region内两个VPC之间,以及不同region的VPC之间跨区通信需在每个VPC内设置通信网关,经通信网关实现VPC之间的互连。
模块作为硬件功能单元的一种举例,处理模块220可以包括至少一个计算设备,如服务器等。或者,处理模块220可以是利用中央处理单元(central processing unit,CPU)实现,也可以利用专用集成电路(application-specific integrated circuit,ASIC)或可编程逻辑器件(programmable logic device,PLD)实现的设备等。其中,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD)、现场可编程门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)、数据处理单元(data processing unit,DPU)、神经网络处理单元(neural network processing unit,NPU)、片上系统(system on chip,SoC)、卸载卡、加速卡或其任意组合实现。
处理模块220包括的多个计算设备可以分布在相同的region中,也可以分布在不同的region中。处理模块220包括的多个计算设备可以分布在相同的AZ中,也可以分布在不同的AZ中。同样,处理模块220包括的多个计算设备可以分布在同一个VPC中,也可以分布在多个VPC中。其中,所述多个计算设备可以是服务器、ASIC、PLD、CPLD、FPGA、GAL、DPU、NPU、SoC、卸载卡、加速卡等计算设备的任意组合。
需要说明的是,在其他实施例中,处理模块220可以用于执行上述任意模块或接口执行的操作,各个模块或接口负责实现的操作可根据需要指定,通过各个模块的配合实现数据对比系统200实现的全部功能。
存储系统300可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。存储系统300还可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard disk drive,HDD)或固态硬盘(solid state drive,SSD)。此外,存储系统300还可以通过存储级内存(storage class memory,SCM),相变存储(phase change memory,PCM),或其他类型存储介质实现。
参见图8,图8是本申请提供的一种计算设备的示意图,如图8所示,计算设备700包括:总线702、处理器704、存储器706和通信接口708。处理器704、存储器706和通信接口708之间通过总线702通信。计算设备700可以是服务器或终端设备。应理解,本申请不限定计算设备700中的处理器、存储器的个数。该计算设备可以是服务器,例如是中心服务器、边缘服务器,或者是本地数据中心中的本地服务器。在一些实施例中,计算设备也可以是台式机、笔记本电脑或者智能手机等终端设备。
总线702可以是外设部件互连标准(peripheral component interconnect express,PCIe)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线、统一总线(unified bus,Ubus或UB)、计算机快速链接(compute express link,CXL)、缓存一致互联协议(cache coherent interconnect for accelerators,CCIX)等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。总线702可包括在计算设备700各个部件(例如,存储器706、处理器704、通信接口708)之间传送信息的通路。其中,统一总线也可称为灵衢总线。
处理器704可以包括中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)、ASIC、FPGA、CPLD、NPU、SoC、卸载卡、加速卡等计算设备中的任意一种或多种。
存储器706可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。处理器704还可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard disk drive,HDD)或固态硬盘(solid state drive,SSD)。此外,存储器706还可以通过存储级内存(storage class memory,SCM),相变存储(phase change memory,PCM),或其他类型存储介质实现。
需要说明的是,同一计算设备中可配置相同类型的存储介质实现存储器706功能,也可以配置两种或两种以上类型的存储介质以实现存储器706的功能,本申请对此不做限定。
存储器706中存储有可执行的程序代码,处理器704执行该可执行的程序代码以实现数据对比系统的功能。也即,存储器706上存有用于执行图2所对应的实施例中数据对比系统实现的数据稽核方法的指令。
通信接口708使用例如但不限于网络接口卡、收发器一类的收发模块,来实现计算设备700与其他设备或通信网络之间的通信。
应理解,根据本申请所提供的计算设备700可对应于本申请图1所提供的数据对比系统200所包括的各模块,并可以对应于执行根据本申请图2至图6所提供的方法中的相应主体,并且计算设备700中的各个模块的上述和其它操作和/或功能分别为了实现图2至图6对应的实施例中所述方法的相应流程,为了简洁,在此不再赘述。
作为一种可能的实现方式,计算设备700也可包括芯片系统,芯片系统包括处理器和供电电路,供电电路用于对处理器执行供电,处理器用于执行信用管理方法所对应的操作步骤。为了简洁,在此不再赘述。其中,处理器可通过CPU实现,也可通过GPU、DPU、NPU、XPU、SoC、卸载卡、加速卡等计算设备或AI芯片实现。
作为一种可能的实现方式,计算设备700中可包括多种类型的处理器704,即计算设备700为异构设备,例如,计算设备700中包括CPU和GPU,可以由其中处理器704中至少一个处理器执行数据稽核方法所对应的操作步骤。为了简洁,在此不再赘述。
本申请还提供了一种计算设备集群。该计算设备集群包括至少一台如图8所示的计算设备。计算设备集群中的一个或多个计算设备700中的存储器706中可以存有相同的用于执行上述图2至图6所对应的实施例中数据对比系统200实现的指令。
在一些可能的实现方式中,该计算设备集群中的一个或多个计算设备700的存储器706中也可以分别存有用于执行数据稽核方法的部分指令。换言之,一个或多个计算设备700的组合可以共同执行用于实现数据稽核方法的指令。
需要说明的是,计算设备集群中的不同的计算设备700中的存储器706可以存储不同的指令,分别用于实现数据对比系统200的部分功能。也即,不同的计算设备700中的存储器706存储的指令可以实现通信模块210、处理模块220和获取模块230中的一个或多个模块的功能。
在一些可能的实现方式中,计算设备集群中的一个或多个计算设备可以通过网络连接。其中,所述网络可以是广域网或局域网等。图9是本申请提供的两个计算设备之间通过网络连接的示意图,图9示出了一种可能的实现方式。如图9所示,两个计算设备700A和700B之间通过网络进行连接。具体地,通过各个计算设备中的通信接口与所述网络进行连接。在这一类可能的实现方式中,计算设备700A中的存储器706中存有执行处理模块220的功能的指令。同时,计算设备700B中的存储器706中存有执行获取模块230的功能的指令。
应理解,图9中示出的计算设备700A的功能也可以由多个计算设备700完成。同样,计算设备700B的功能也可以由多个计算设备700完成。
本申请还提供了一种包含指令的计算机程序产品,该计算机程序产品可以是包含指令的,能够运行在计算设备上或被储存在任何可用介质中的软件或程序产品。当所述计算机程序产品在至少一个计算设备上运行时,使得至少一个计算设备执行上述图2至图6所对应的实施例中数据对比系统实现的方法。
本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是计算设备能够存储的任何可用介质或者是包含一个或多个可用介质的数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质、或者半导体介质(例如固态硬盘)等。该计算机可读存储介质包括指令,所述指令指示计算设备执行上述图2至图6所对应的实施例中数据对比系统实现的方法。最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的保护范围。

Claims (11)

  1. 一种数据稽核方法,其特征在于,包括:
    获取数据对比请求,所述数据对比请求包括数据表名称、第一数据库的名称和第二数据库的名称;
    根据所述数据对比请求从第一数据库中获取第一数据表,从第二数据库中获取第二数据表;其中,所述第一数据表和所述第二数据表的数据表名称相同;
    通过散列算法确定所述第一数据表中第一数据列对应的第一比对值,以及第二数据表中第二数据列对应的第二比对值;
    所述第一比对值和所述第二比对值相同,确定所述第一数据表中第一数据列的数据与所述第二数据表中第二数据列的数据相同。
  2. 根据权利要求1所述的方法,其特征在于,所述通过散列算法确定所述第一数据表中第一数据列对应的第一比对值,包括:
    对所述第一数据列包括的多个字段值,通过所述散列算法和逻辑运算确定所述多个字段值中每个字段值对应的比对值,根据所述每个字段值对应的比对值确定所述第一数据列对应的第一比对值。
  3. 根据权利要求2所述的方法,其特征在于,通过所述散列算法和逻辑运算确定所述多个字段值中每个字段值对应的比对值,包括:
    通过所述散列算法将第一字段值转换为第一散列值;其中,所述第一字段值是所述多个字段值中的一个,所述第一散列值包括m个字符;
    从所述第一散列值中提取连续的n个字符,将所述n个字符划分为i组字符串;其中,n小于或等于m;
    将所述i组字符串中的第j组字符串与第j-2校验值进行所述逻辑运算,得到第j-1校验值;其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串;
    将第i-1校验值确定为所述第一字段值对应的比对值。
  4. 根据权利要求2所述的方法,其特征在于,通过所述散列算法和逻辑运算确定所述多个字段值中每个字段值对应的比对值,包括:
    获取第一字段值所属的行的行标识;其中,所述第一数据表包括的多行数据中每一行对应的行标识各不相同,所述第一字段值是所述多个字段值中的一个;
    将所述第一字段值对应的行标识与所述第一字段值进行拼接,得到第一拼接值;
    通过所述散列算法将所述第一拼接值转换为第二散列值,所述第二散列值包括m个字符;
    从所述第二字符串中提取出连续的n个字符,将所述n个字符划分为i组字符串;其中,n小于或等于m;
    将所述i组字符串中的第j组字符串与第j-2校验值进行所述逻辑运算,得到第j-1校验值;其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串;
    将第i-1校验值作为所述第一字段值对应的比对值。
  5. 一种数据稽核装置,其特征在于,所述装置包括:
    通信模块,用于获取数据对比请求,所述数据对比请求包括数据表名称、第一数据库的名称和第二数据库的名称;
    获取模块,用于根据所述数据对比请求从第一数据库中获取第一数据表,从第二数据库中获取第二数据表;其中,所述第一数据表和所述第二数据表的数据表名称相同;
    处理模块,用于通过散列算法确定所述第一数据表中第一数据列对应的第一比对值,以及第二数据表中第二数据列对应的第二比对值;
    所述处理模块,还用于在所述第一比对值和所述第二比对值相同时,确定所述第一数据表中第一数据列的数据与所述第二数据表中第二数据列的数据相同。
  6. 根据权利要求5所述的装置,其特征在于,所述处理模块具体用于:
    对所述第一数据列包括的多个字段值,通过所述散列算法确定所述多个字段值中每个字段值对应的比对值,根据所述每个字段值对应的比对值确定所述第一数据列对应的第一比对值。
  7. 根据权利要求6所述的装置,其特征在于,所述处理模块具体用于:
    通过所述散列算法将第一字段值转换为第一散列值;其中,所述第一字段值是所述多个字段值中的一个,所述第一散列值包括m个字符;
    从所述第一散列值中提取连续的n个字符,将所述n个字符划分为i组字符串;其中,n小于或等于m;
    将所述i组字符串中的第j组字符串与第j-2校验值进行所述逻辑运算,得到第j-1校验值;其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串;
    将第i-1校验值确定为所述第一字段值对应的比对值。
  8. 根据权利要求6所述的装置,其特征在于,所述处理模块具体用于:
    获取第一字段值所属的行的行标识;其中,所述第一数据表包括的多行数据中每一行对应的行标识各不相同,所述第一字段值是所述多个字段值中的一个;
    将所述第一字段值对应的行标识与所述第一字段值进行拼接,得到第一拼接值;
    通过所述散列算法将所述第一拼接值转换为第二散列值,所述第二散列值包括m个字符;
    从所述第二字符串中提取出连续的n个字符,将所述n个字符划分为i组字符串;其中,n小于或等于m;
    将所述i组字符串中的第j组字符串与第j-2校验值进行所述逻辑运算,得到第j-1校验值;其中,j大于或等于2且小于或等于i;当j等于2时,第j-2校验值为第1组字符串;
    将第i-1校验值作为所述第一字段值对应的比对值。
  9. 一种计算设备,其特征在于,所述计算设备包括处理器和存储器,所述存储器用于存储指令,所述处理器用于执行所述存储器中存储的指令,实现如权利要求1-4中任一项所述的方法。
  10. 一种计算机可读存储介质,其特征在于,包括计算机程序指令,当所述计算机程序指令由计算设备集群执行时,所述计算设备集群实现如权利要求1-4中任一项所述的方法。
  11. 一种包含指令的计算机程序产品,其特征在于,当所述指令由计算设备集群运行时,所述计算设备集群实现如权利要求1-4中任一项所述的方法。
PCT/CN2025/100272 2024-06-14 2025-06-10 一种数据稽核方法、装置及相关设备 Pending WO2025256533A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410774083.3 2024-06-14
CN202410774083.3A CN121144276A (zh) 2024-06-14 2024-06-14 一种数据稽核方法、装置及相关设备

Publications (1)

Publication Number Publication Date
WO2025256533A1 true WO2025256533A1 (zh) 2025-12-18

Family

ID=97992739

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2025/100272 Pending WO2025256533A1 (zh) 2024-06-14 2025-06-10 一种数据稽核方法、装置及相关设备

Country Status (2)

Country Link
CN (1) CN121144276A (zh)
WO (1) WO2025256533A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007133818A (ja) * 2005-11-14 2007-05-31 Nippon Telegr & Teleph Corp <Ntt> データ改竄検出装置及びデータ改竄検出方法
US20090254507A1 (en) * 2008-04-02 2009-10-08 Hitachi, Ltd. Storage Controller and Duplicated Data Detection Method Using Storage Controller
CN105677645A (zh) * 2014-11-17 2016-06-15 阿里巴巴集团控股有限公司 一种数据表比对方法和装置
CN114942927A (zh) * 2022-06-08 2022-08-26 中信建投证券股份有限公司 一种数据库数据对比方法及装置
CN115809230A (zh) * 2022-12-22 2023-03-17 中国建设银行股份有限公司 多数据库结构化数据比对方法、装置及相关设备
CN117390004A (zh) * 2023-10-16 2024-01-12 中国联合网络通信集团有限公司 数据稽核方法、设备及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007133818A (ja) * 2005-11-14 2007-05-31 Nippon Telegr & Teleph Corp <Ntt> データ改竄検出装置及びデータ改竄検出方法
US20090254507A1 (en) * 2008-04-02 2009-10-08 Hitachi, Ltd. Storage Controller and Duplicated Data Detection Method Using Storage Controller
CN105677645A (zh) * 2014-11-17 2016-06-15 阿里巴巴集团控股有限公司 一种数据表比对方法和装置
CN114942927A (zh) * 2022-06-08 2022-08-26 中信建投证券股份有限公司 一种数据库数据对比方法及装置
CN115809230A (zh) * 2022-12-22 2023-03-17 中国建设银行股份有限公司 多数据库结构化数据比对方法、装置及相关设备
CN117390004A (zh) * 2023-10-16 2024-01-12 中国联合网络通信集团有限公司 数据稽核方法、设备及存储介质

Also Published As

Publication number Publication date
CN121144276A (zh) 2025-12-16

Similar Documents

Publication Publication Date Title
US12512999B2 (en) Asynchronously determining relational data integrity using cryptographic data structures
CN109902071B (zh) 业务日志存储方法、系统、装置及设备
US10949405B2 (en) Data deduplication device, data deduplication method, and data deduplication program
US11029851B2 (en) Sub-block modifications for block-level snapshots
US20230362015A1 (en) Notification control method, verification method, and information processing apparatus
US11126751B2 (en) Index creation for data records
US11907379B2 (en) Creating a secure searchable path by hashing each component of the path
CN112163412B (zh) 数据校验方法、装置、电子设备及存储介质
US11016671B2 (en) Snapshot block storage path structure wherein identification of blocks that are identical between two snapshots are determined without performing block by block comparison between the two snapshots
CN112395850B (zh) 一种检查数据定义一致性的方法、装置和电子设备
US11403185B2 (en) Network-accessible block-level snapshots
WO2025256533A1 (zh) 一种数据稽核方法、装置及相关设备
CN114721586A (zh) 用于存储管理的方法、电子设备和计算机程序产品
WO2025055385A1 (zh) 页面的镜像存储方法、装置、设备及存储介质
WO2021071589A1 (en) Reliable detection of deleted assets in data stores
US11768855B1 (en) Replicating data across databases by utilizing validation functions for data completeness and sequencing
US12105582B2 (en) System for code base sharing during computing application failure using a distributed register network
CN113434359B (zh) 数据溯源系统构建方法、装置、电子设备及可读存储介质
CN118410036A (zh) 一种基于集群的安全审计管理方法、设备、介质及产品
CN114185588A (zh) 增量包生成方法、装置、设备及存储介质
CN111488361A (zh) 一种交叉报表生成方法及系统
WO2025228232A1 (zh) 一种数据生成方法、系统及相关设备
CN116881284B (zh) 结构化查询语句的数据回补方法、装置、设备及存储介质
US12277107B1 (en) Detection of changes in storage arrays for databases
CN115509879A (zh) 操作日志生成方法、终端设备及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 25821243

Country of ref document: EP

Kind code of ref document: A1