Data comparison method, apparatus, device, and computer-readable medium

By combining configuration files and standard application programming interface components, sampling test cases and scripts are generated, enabling efficient data comparison across databases. This solves the problem of insufficient applicability in existing technologies and improves the applicability and efficiency of data comparison.

CN120316140BActive Publication Date: 2026-02-03CHINA SECURITIES DEPOSITORY & CLEARING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510804320.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2026-02-03
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

Existing technologies for data comparison have poor applicability and cannot effectively meet the needs of actual users.

Method used

The feature parameters in the sampling test case template file are replaced with the comparison parameters in the configuration file to generate sampling test cases and scripts. The database is connected through the standard application programming interface component, the operation statements are executed to compare the business data of the source database and the target database, and the comparison results are stored as program and business logs.

Benefits of technology

It improves the applicability of data comparison, making it suitable for various databases and meeting the needs of actual users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120316140B_ABST
    Figure CN120316140B_ABST
Patent Text Reader

Abstract

The application discloses a data comparison method and device, equipment and a computer readable medium, and relates to the technical field of computers. A specific embodiment of the method comprises: replacing feature parameters in a sampling case template file with comparison parameters in a configuration file to obtain a sampling case of the configuration file, updating a date variable in the sampling case to obtain a sampling script; executing the sampling script in a sampling source database to obtain sampling data, and obtaining an input parameter case in a case database according to configuration information in the configuration file and the sampling data, splicing the input parameter case to obtain an operation statement; and using the operation statement to obtain business data from a source database and a target database respectively to compare the business data obtained from the source database with the business data obtained from the target database. The embodiment can improve the applicability of data comparison and effectively meet actual user requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a data comparison method, apparatus, device, and computer-readable medium. Background Technology

[0002] In today's information society, database management and utilization have become crucial across all industries. To ensure the authenticity and accuracy of information in databases, it is necessary to compare data stored in different databases.

[0003] In the process of realizing this invention, the inventors discovered that the prior art has at least the following problems: the applicability of data comparison is poor and it cannot effectively meet the actual user needs. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a data comparison method, apparatus, device, and computer-readable medium, which can improve the applicability of data comparison and effectively meet the needs of actual users.

[0005] To achieve the above objectives, according to one aspect of the present invention, a data comparison method is provided, comprising:

[0006] The sampling test cases in the configuration file are obtained by replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file, and the sampling script is obtained by updating the date variable in the sampling test cases.

[0007] The sampling script is executed in the sampling source database to obtain sampling data, and the input parameter test cases are obtained in the test case database according to the configuration information in the configuration file and the sampling data. The input parameter test cases are then concatenated to obtain the operation statement.

[0008] The operation statements are used to retrieve business data from the source database and the destination database respectively, so as to compare the business data retrieved from the source database and the business data retrieved from the destination database.

[0009] The process of replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test cases in the configuration file, and updating the date variable in the sampling test cases to obtain the sampling script includes:

[0010] The task triggering information in the configuration file is used to send a comparison instruction. In response to the comparison instruction, the sampling test case template file is processed cyclically using the comparison parameters in the configuration file to replace the feature parameters in the sampling test case template file to obtain the sampling test cases in the configuration file.

[0011] After executing the sampling test case according to the running parameters in the configuration file, the date variable in the sampling test case is updated to obtain the sampling script.

[0012] The method further includes:

[0013] A sampling script is found based on a specified date. The found sampling script is used to compare business data obtained from the source database and business data obtained from the destination database according to the specified date, so as to achieve the comparison of business data on the specified date.

[0014] The step involves executing the sampling script in the sampling source database to obtain sampling data, and then retrieving input parameter test cases from the test case database based on the configuration information in the configuration file and the sampling data. The operation statements are then obtained by concatenating the input parameter test cases, including:

[0015] The sampling script is executed in the sampling source database to obtain sampling data;

[0016] Based on the sampling data, the database connection parameters in the configuration file, and the comparison path in the configuration file, input parameter test cases are obtained from the test case database, and the input parameter test cases are concatenated to obtain the execution operation statement.

[0017] The step of using the operation statements to retrieve business data from the source database and the destination database respectively, and comparing the business data retrieved from the source database and the business data retrieved from the destination database, includes:

[0018] The system connects the source database and the destination database through a standard application programming interface component, executes the operation statements to obtain business data from the source database and the destination database respectively, and organizes and outputs the organized business data according to a preset data result format.

[0019] In response to the comparison operation instruction, multiple threads are invoked according to the comparison method in the comparison operation instruction to compare the processed business data obtained from the source database and the processed business data obtained from the destination database.

[0020] The step of connecting the source database and the destination database through a standard application programming interface (API) component and executing the operation statements to obtain business data from the source database and the destination database respectively includes:

[0021] In response to a database connection indication, the standard application programming interface component is acquired and stored based on the database connection indication;

[0022] The source and destination databases are connected via a standard application programming interface (API) component, and the operation statements are executed to retrieve business data from the source and destination databases respectively.

[0023] After comparing the business data obtained from the source database and the business data obtained from the destination database, the process also includes:

[0024] The running parameters of the business data comparison are used as program logs, and the comparison results and comparison data between the source database and the target data are used as business logs.

[0025] The program logs are stored in a local database according to a log file format, while the business logs are stored in a security database.

[0026] According to a second aspect of the present invention, a data comparison apparatus is provided, comprising:

[0027] The script module is used to replace the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test cases in the configuration file, and update the date variable in the sampling test cases to obtain the sampling script.

[0028] The operation module is used to execute the sampling script in the sampling source database to obtain sampling data, and obtain input parameter test cases in the test case database according to the configuration information in the configuration file and the sampling data, and concatenate the input parameter test cases to obtain operation statements.

[0029] The comparison module is used to retrieve business data from the source database and the destination database respectively using the operation statements to compare the business data retrieved from the source database and the business data retrieved from the destination database.

[0030] According to a third aspect of the present invention, a data comparison electronic device is provided, comprising:

[0031] One or more processors;

[0032] Storage device for storing one or more programs.

[0033] When the one or more programs are executed by the one or more processors, the one or more processors perform the methods described above.

[0034] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method as described above.

[0035] One embodiment of the above invention has the following advantages or beneficial effects: Sampling test cases are obtained by replacing the feature parameters in the sampling test case template file with comparison parameters from the configuration file; the date variable in the sampling test cases is updated to obtain a sampling script; the sampling script is executed in the sampling source database to obtain sampling data; input parameter test cases are obtained in the test case database according to the configuration information in the configuration file and the sampling data; the input parameter test cases are concatenated to obtain operation statements; business data is obtained from the source database and the destination database respectively using the operation statements to compare the business data obtained from the source database and the business data obtained from the destination database. The sampling script and operation statements are applicable to multiple databases, improving the applicability of data comparison and effectively meeting the needs of actual users.

[0036] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0037] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0038] Figure 1 This is a schematic diagram of the main flow of the data comparison method according to an embodiment of the present invention;

[0039] Figure 2 This is a schematic diagram of the process of obtaining a sampled sample based on a sampling use case according to an embodiment of the present invention;

[0040] Figure 3 This is a flowchart illustrating the process of obtaining execution operation statements using sampled data according to an embodiment of the present invention.

[0041] Figure 4 This is a schematic diagram illustrating the process of obtaining and comparing business data from a source database and a destination database according to an embodiment of the present invention;

[0042] Figure 5 This is a schematic diagram of the process for acquiring and storing standard application programming interface components according to an embodiment of the present invention;

[0043] Figure 6 This is a schematic diagram of the log process for storing business data according to an embodiment of the present invention;

[0044] Figure 7 This is a schematic diagram of the main structure of the data comparison device according to an embodiment of the present invention;

[0045] Figure 8 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0046] Figure 9 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0047] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0048] When comparing information stored in different databases, database function interfaces can be used for comparison. Specifically, the following aspects need to be considered: data structure, data type, data consistency, data integrity, and data security. These factors will affect the results and efficiency of the comparison.

[0049] You can use SQL statements to perform cross-database function queries. By writing corresponding SQL statements, you can retrieve data from different databases and perform simple data comparison operations.

[0050] Data synchronization tools can be used to synchronize the output of functions in one database to another, thereby achieving data consistency. By regularly synchronizing and updating data, it can be ensured that the data in both databases remains up-to-date.

[0051] Metadata management tools can be used. These tools allow you to discover and extract metadata information from different databases, such as table structure and field types, and map this metadata information to a unified data model. Metadata management tools also enable comparisons of target databases without directly accessing the source database.

[0052] However, the comparison of heterogeneous database function interfaces has limitations: it has poor applicability to heterogeneous databases of different types, encodings and storage methods and cannot effectively meet the actual user needs.

[0053] To address the issue of poor applicability of data comparison and its inability to effectively meet the needs of actual users, the following technical solutions from the embodiments of the present invention can be adopted.

[0054] See Figure 1 , Figure 1 This is a schematic diagram of the main flow of a data comparison method according to an embodiment of the present invention. A sampling script is used to obtain sampled data for the corresponding date, and operation statements are obtained through the sampling script to compare business data in the source database and the target database. For example... Figure 1 As shown in Figure 100, the specific steps include:

[0055] S101. Replace the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test cases in the configuration file, and update the date variable in the sampling test cases to obtain the sampling script.

[0056] In embodiments of the present invention, the configuration file is a set of parameters sent by the user for performing data comparison. As an example, the configuration file includes one or more of the following parameters: comparison parameters, comparison path, database connection parameters, database address, username and password, SQL statement, task triggering information, running parameters, and configuration information.

[0057] To improve the speed of obtaining sampled test cases, sampled test case template files can be used. As an example, sampled test case template files can be configured according to time and / or user type. That is, different time periods and / or different user types will require different sampled test case template files, thus improving the relevance of the templates.

[0058] Specifically, the sampling test cases in the configuration file are obtained by replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file, and the sampling script is obtained by updating the date variable in the sampling test cases.

[0059] See Figure 2 , Figure 2 This is a flowchart illustrating the process of obtaining a sample based on sampling cases according to an embodiment of the present invention. Specifically, it includes the following steps:

[0060] S201. Send a comparison instruction using the task trigger information in the configuration file. In response to the comparison instruction, use the comparison parameters in the configuration file to process the sampling test case template file in a loop to replace the feature parameters in the sampling test case template file to obtain the sampling test cases in the configuration file.

[0061] The task triggering information in the configuration file is used to send a comparison instruction to trigger the execution of a data comparison. As an example, the task triggering information includes the execution time point. If the execution time point in the comparison instruction matches the current time, the data comparison is triggered; that is, in response to the comparison instruction, the sampled test case template file is processed cyclically using the comparison parameters in the configuration file. As another example, the task triggering information includes an execution command. In response to the execution command in the comparison instruction, the data comparison is immediately triggered; that is, in response to the comparison instruction, the sampled test case template file is processed cyclically using the comparison parameters in the configuration file.

[0062] Based on the task trigger information in the configuration file, a comparison instruction is sent, and the execution of data comparison is controlled through the comparison instruction to achieve effective control over data comparison.

[0063] In an embodiment of the present invention, in response to a comparison instruction, the sampling test case template file is processed cyclically using comparison parameters in the configuration file to replace the feature parameters in the sampling test case template file to obtain the sampling test cases in the configuration file.

[0064] The sampling test cases are obtained by replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file. Using the sampling test case template file can reduce the configuration workload and improve the accuracy and ease of use of the configuration parameters.

[0065] Specifically, the corresponding feature parameter in the sampling test case template file is replaced for each comparison parameter. If the configuration file contains multiple comparison parameters, the sampling test case template file is processed iteratively for each parameter. This iterative processing enables more efficient, comprehensive, and reliable parameter replacement, making it particularly suitable for scenarios requiring large-scale data comparison.

[0066] S202. After executing the sampling test cases according to the running parameters in the configuration file, update the date variable in the sampling test cases to obtain the sampling script.

[0067] In embodiments of the present invention, sampling test cases for the configuration file are stored in a data sampling knowledge base. After retrieving the sampling test cases from the data sampling knowledge base, the sampling test cases are executed according to the running parameters of the configuration file, and the date variables in the sampling test cases are replaced with the current date to obtain the sampling script. As an example, the sampling script is stored in txt format to improve its applicability. The sampling script is identified by date so that it can be reused according to date. As an example, the sampling script includes an SQL sampling script or a Python sampling script.

[0068] In one embodiment of the present invention, a specified date reuse sampling script can be used to compare business data on a specified date.

[0069] Specifically, a sampling script is searched based on a specified date. The searched sampling script is then used to compare business data obtained from the source database and business data obtained from the destination database according to the specified date, so as to achieve business data comparison on the specified date.

[0070] exist Figure 2 In this embodiment, sampling cases are obtained using a sampling case template file, and the date variables in the sampling cases are updated to obtain a sampling script. The sampling script can be reused based on dates, thereby improving the applicability of data comparison.

[0071] S102. Execute the sampling script in the sampling source database to obtain sampling data, and obtain the input parameter test cases in the test case database according to the configuration information in the configuration file and the sampling data. Concatenate the input parameter test cases to obtain the operation statement.

[0072] The sampling source database is the original database that stores all the data. Sampling scripts are executed in the sampling source database to obtain sampled data. Then, based on the configuration information in the configuration file and the sampled data, input parameter test cases are obtained from the test case database. The purpose of obtaining the input parameter test cases is to assemble them into operation statements.

[0073] See Figure 3 , Figure 3 This is a flowchart illustrating the process of obtaining execution statements using sampled data according to an embodiment of the present invention. Specifically, it includes the following steps:

[0074] S301. Execute the sampling script in the sampling source database to obtain sampling data.

[0075] The system connects to the source database, executes queries in the sampling script to retrieve sampled data, and stores the sampled data in the sampling data result table. The sampling data result table can be stored in a database of a different type than the source database.

[0076] In embodiments of the present invention, a standard application programming interface (API) is used to connect to the sampling source database. Standard APIs are applicable to various types of sampling source databases. As an example, a standard API includes JDBC (Java Database Connectivity).

[0077] S302. Based on the sampling data, the database connection parameters in the configuration file, and the comparison path in the configuration file, obtain the input parameter test cases from the test case database, and concatenate the input parameter test cases to obtain the execution operation statement.

[0078] The test case database is used to store and manage test cases, parameter configurations, and expected results. It connects to the test case database first according to the database connection parameters in the configuration file, then retrieves input test cases from the database based on sampled data, and concatenates these input test cases to obtain the execution operation statements. The execution operation statements are stored according to the comparison path in the configuration file, so that business data can be compared when the execution operation statements are called.

[0079] exist Figure 3 In this embodiment, the execution operation statement is obtained by concatenating input parameter test cases. The input parameter test cases are applicable to multiple databases, and thus the execution operation statement can be applied to different databases in various scenarios.

[0080] S103. Use operation statements to retrieve business data from the source database and the destination database respectively, and compare the business data retrieved from the source database and the business data retrieved from the destination database.

[0081] In an embodiment of the present invention, after obtaining the operation statement, business data can be obtained from the source database and the destination database respectively to compare the business data obtained from the source database and the business data obtained from the destination database.

[0082] See Figure 4 , Figure 4 This is a schematic diagram illustrating the process of obtaining and comparing business data from a source database and a destination database according to an embodiment of the present invention. Specifically, it includes the following steps:

[0083] S401. Connect to the source database and the destination database through the standard application programming interface component, execute operation statements to obtain business data from the source database and the destination database respectively, and organize and output the organized business data according to the preset data result format.

[0084] In embodiments of the present invention, a standard application programming interface (API) component is used to connect the source database and the destination database. This standard API component supports the extraction of business data from heterogeneous databases with different architectures or coding schemes.

[0085] See Figure 5 , Figure 5 This is a schematic diagram illustrating the process of acquiring and storing standard application programming interface (API) components according to an embodiment of the present invention. Specifically, it includes the following steps:

[0086] S501, In response to a database connection instruction, obtain and store standard application programming interface components based on the database connection instruction.

[0087] In one embodiment of the present invention, in order to be applicable to multiple types of databases, upon receiving a database connection instruction, a standard application programming interface component is acquired and stored based on the database connection instruction.

[0088] S502. Connect to the source database and the destination database through the standard application programming interface component, and execute operation statements to obtain business data from the source database and the destination database respectively.

[0089] Standard application programming interface (API) components can be used to connect to different types of source and destination databases, and execute operation statements to retrieve business data from the source and destination databases respectively.

[0090] exist Figure 5 In one embodiment, a standard application programming interface (API) component is obtained to connect to different types of databases.

[0091] In one embodiment of the present invention, if the standard application programming interface (API) component cannot connect to the source or destination database, a JDBC driver component that cannot connect to the database can be introduced. The standard API component is then updated with the introduced JDBC driver component, thereby increasing the number of databases that can be connected to for data comparison.

[0092] The execution statements retrieve business data from both the source and destination databases, organize the data according to a preset data result format, and output the organized business data. As an example, the preset data result format includes: (List...) <Map<key,value> >). List is an ordered collection. Map<Key, Value> Represents a collection of key-value pairs. A list consisting of multiple key-value pair dictionaries (Map). Organizing business data using a preset data result format can improve data comparison efficiency and reduce the error rate of data comparison.

[0093] S402. In response to the comparison operation instruction, multiple threads are invoked according to the comparison method in the comparison operation instruction to compare the processed business data obtained from the source database and the processed business data obtained from the destination database.

[0094] In one embodiment of the present invention, business data obtained from a source database and business data obtained from a destination database are compared based on a comparison method specified in a comparison operation instruction. The comparison operation instruction is sent by the user or preset.

[0095] The comparison operation instructions include the comparison method. As an example, the comparison method includes one or more of the following: row-by-row and field-by-field comparison, result set comparison, and data storage order comparison. Row-by-row and field-by-field comparison is suitable when the comparison results must be strongly ordered. Strong order requires that the arrangement of the comparison results must satisfy a definite order and predictability. Result set comparison is suitable when the order of the output results does not need to be compared.

[0096] Furthermore, to improve the efficiency of comparing business data, multiple threads can be invoked to perform the comparison. As an example, when the comparison operation instruction includes multiple comparison methods, each thread uses one comparison method to compare the processed business data retrieved from the source database and the processed business data retrieved from the destination database.

[0097] Furthermore, when comparing a large amount of business data, multiple threads can be used simultaneously to perform the comparison using the same method. For example, the business data to be compared can be divided into multiple parts, with each part being compared by a separate thread. Multiple threads can then compare the processed business data in parallel, reducing the time required for the comparison process.

[0098] exist Figure 4In the embodiments, the use of standard application programming interface components can support multiple types of databases to improve applicability, and comparison methods can be set to improve data comparison efficiency.

[0099] See Figure 6 , Figure 6 This is a schematic diagram of the log process for storing business data according to an embodiment of the present invention. Specifically, it includes the following steps:

[0100] S601. The running parameters of the compared business data are recorded as program logs, and the comparison results and comparison data between the source database and the target data are recorded as business logs.

[0101] To ensure data security, the runtime logs of the corresponding business data are divided into two parts: program logs and business logs.

[0102] The runtime parameters of the compared business data are recorded as program logs, which are then used to maintain the database. As an example, the program logs include: the comparison interface, the comparison runtime, and the executed SQL statements.

[0103] The comparison results and data between the source database and the destination database are recorded as business logs. As an example, the business logs include the comparison results (true / false), inconsistent comparison data, and business outcome data.

[0104] S602. Program logs are stored in the local database according to the log file format, while business logs are stored in the security database.

[0105] In embodiments of the present invention, considering that the program log does not involve sensitive data, the program log can be stored in a local database in a log file format for easy querying.

[0106] Business logs often contain sensitive data, so they can be stored in a secure database to ensure data security.

[0107] exist Figure 6 In this embodiment, logs are stored according to their category, thereby ensuring the security of business logs while using program logs to maintain the database.

[0108] In the embodiments of the present invention described above, sampling test cases are obtained by replacing the feature parameters in the sampling test case template file with comparison parameters in the configuration file, and the date variable in the sampling test cases is updated to obtain a sampling script. The sampling script is executed in the sampling source database to obtain sampling data, and input parameter test cases are obtained in the test case database according to the configuration information in the configuration file and the sampling data. The input parameter test cases are then concatenated to obtain operation statements. The operation statements are used to obtain business data from both the source and destination databases to compare the business data obtained from the source database and the business data obtained from the destination database. By using the sampling script to obtain business data from the source and destination databases through operation statements, the sampling script and operation statements are applicable to multiple databases, improving the applicability of data comparison and effectively meeting the needs of actual users.

[0109] See Figure 7 , Figure 7 This is a schematic diagram of the main structure of a data comparison device according to an embodiment of the present invention. The data comparison device can implement data comparison methods, such as... Figure 7 As shown in Figure 700, the data comparison device specifically includes:

[0110] Script module 701 is used to replace the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test case in the configuration file, and update the date variable in the sampling test case to obtain the sampling script.

[0111] Operation module 702 is used to execute the sampling script in the sampling source database to obtain sampling data, and obtain input parameter test cases in the test case database according to the configuration information in the configuration file and the sampling data, and concatenate the input parameter test cases to obtain operation statements.

[0112] The comparison module 703 is used to obtain business data from the source database and the destination database respectively using the operation statement to compare the business data obtained from the source database and the business data obtained from the destination database.

[0113] In one embodiment of the present invention, the script module 701 is specifically used to send a comparison instruction using the task trigger information in the configuration file, and in response to the comparison instruction, to process the sampling test case template file cyclically using the comparison parameters in the configuration file, so as to replace the feature parameters in the sampling test case template file to obtain the sampling test cases in the configuration file.

[0114] After executing the sampling test case according to the running parameters in the configuration file, the date variable in the sampling test case is updated to obtain the sampling script.

[0115] In one embodiment of the present invention, the script module 701 is specifically used to search for a sampling script based on a specified date, and to use the searched sampling script to compare the business data obtained from the source database and the business data obtained from the destination database according to the specified date, so as to realize the comparison of business data on the specified date.

[0116] In one embodiment of the present invention, the operation module 702 is specifically used to execute the sampling script in the sampling source database to obtain sampling data;

[0117] Based on the sampling data, the database connection parameters in the configuration file, and the comparison path in the configuration file, input parameter test cases are obtained from the test case database, and the input parameter test cases are concatenated to obtain the execution operation statement.

[0118] In one embodiment of the present invention, the comparison module 703 is specifically used to connect the source database and the destination database through a standard application programming interface component, execute the operation statement to obtain business data from the source database and the destination database respectively, and organize and output the organized business data according to a preset data result format.

[0119] In response to the comparison operation instruction, multiple threads are invoked according to the comparison method in the comparison operation instruction to compare the processed business data obtained from the source database and the processed business data obtained from the destination database.

[0120] In one embodiment of the present invention, the comparison module 703 is specifically used to obtain and store the standard application programming interface component based on the database connection indication in response to the database connection indication.

[0121] The source and destination databases are connected via a standard application programming interface (API) component, and the operation statements are executed to retrieve business data from the source and destination databases respectively.

[0122] In one embodiment of the present invention, the comparison module 703 is specifically used to use the running parameters of the comparison business data as program logs, and the comparison results and comparison data of the source database and the target data as business logs.

[0123] The program logs are stored in a local database according to a log file format, while the business logs are stored in a security database.

[0124] Figure 8 An exemplary system architecture 800 is shown that can be applied to the data comparison method or data comparison apparatus of the present invention.

[0125] like Figure 8As shown, system architecture 800 may include terminal devices 801, 802, and 803, a network 804, and a server 805. Network 804 serves as the medium for providing communication links between terminal devices 801, 802, and 803 and server 805. Network 804 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0126] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0127] Terminal devices 801, 802, and 803 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0128] Server 805 can be a server providing various services, such as a backend management server supporting shopping websites browsed by users using terminal devices 801, 802, and 803 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information and product information - for example only) to the terminal devices.

[0129] It should be noted that the data comparison method provided in the embodiments of the present invention is generally executed by the server 805, and correspondingly, the data comparison device is generally set in the server 805.

[0130] It should be understood that Figure 8 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0131] The following is for reference. Figure 9 It shows a schematic diagram of the structure of a computer system 900 suitable for implementing a terminal device of the present invention. Figure 9 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0132] like Figure 9As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 902 or programs loaded from storage section 908 into random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the system 900. The CPU 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0133] The following components are connected to I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to I / O interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 910 as needed so that computer programs read from it can be installed into storage section 908 as needed.

[0134] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 909, and / or installed from removable medium 911. When the computer program is executed by central processing unit (CPU) 901, it performs the functions defined above in the system of this invention.

[0135] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0137] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a script module, an operation module, and a comparison module. The names of these modules do not necessarily limit the module itself; for example, the script module can also be described as "used to replace feature parameters in a sampling test case template file with comparison parameters in a configuration file to obtain sampling test cases in the configuration file, and to update date variables in the sampling test cases to obtain a sampling script."

[0138] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include:

[0139] The sampling test cases in the configuration file are obtained by replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file, and the sampling script is obtained by updating the date variable in the sampling test cases.

[0140] The sampling script is executed in the sampling source database to obtain sampling data, and the input parameter test cases are obtained in the test case database according to the configuration information in the configuration file and the sampling data. The input parameter test cases are then concatenated to obtain the operation statement.

[0141] The operation statements are used to retrieve business data from the source database and the destination database respectively, so as to compare the business data retrieved from the source database and the business data retrieved from the destination database.

[0142] According to the technical solution of this embodiment of the invention, sampling test cases are obtained by replacing the feature parameters in the sampling test case template file with comparison parameters in the configuration file, and the date variable in the sampling test cases is updated to obtain a sampling script. The sampling script is executed in the sampling source database to obtain sampling data, and input parameter test cases are obtained in the test case database according to the configuration information in the configuration file and the sampling data. The input parameter test cases are then concatenated to obtain operation statements. The operation statements are used to obtain business data from both the source and destination databases to compare the business data obtained from the source database and the business data obtained from the destination database. By using the sampling script to obtain business data from the source and destination databases through operation statements, the sampling script and operation statements are applicable to multiple databases, improving the applicability of data comparison and effectively meeting the needs of actual users.

[0143] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention. It should be noted that the acquisition, storage, and application of user personal information involved in the technical solutions of this disclosure comply with relevant laws and regulations and do not violate public order and good morals.

Claims

1. A data comparison method, characterized in that, include: The sampling test cases in the configuration file are obtained by replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file, and the sampling script is obtained by updating the date variable in the sampling test cases. The sampling script is executed in the sampling source database to obtain sampling data. Input test cases are obtained from the test case database based on the configuration information in the configuration file and the sampling data. The input test cases are then concatenated to obtain operation statements. This includes: connecting to the test case database according to the database connection parameters in the configuration file; obtaining input test cases from the test case database based on the sampling data; and concatenating the input test cases to obtain execution operation statements. The test case database is used to store and manage test cases, parameter configurations, and expected results. The execution operation statements are stored according to the comparison path in the configuration file so that business data can be compared when the execution operation statements are called. The operation statements are used to obtain business data from both the source and destination databases to compare the business data obtained from the source database and the business data obtained from the destination database.

2. The data comparison method according to claim 1, characterized in that, The process of replacing the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test cases in the configuration file, and updating the date variable in the sampling test cases to obtain the sampling script includes: The task triggering information in the configuration file is used to send a comparison instruction. In response to the comparison instruction, the sampling test case template file is processed cyclically using the comparison parameters in the configuration file to replace the feature parameters in the sampling test case template file to obtain the sampling test cases in the configuration file. After executing the sampling test case according to the running parameters in the configuration file, the date variable in the sampling test case is updated to obtain the sampling script.

3. The data comparison method according to claim 1, characterized in that, The method further includes: A sampling script is found based on a specified date. The found sampling script is used to compare the business data obtained from the source database and the business data obtained from the destination database according to the specified date, so as to achieve the comparison of business data on the specified date.

4. The data comparison method according to claim 1, characterized in that, The step of using the operation statements to retrieve business data from the source database and the destination database respectively, and comparing the business data retrieved from the source database and the business data retrieved from the destination database, includes: The system connects the source database and the destination database through a standard application programming interface component, executes the operation statements to obtain business data from the source database and the destination database respectively, and organizes and outputs the organized business data according to a preset data result format. In response to the comparison operation instruction, multiple threads are invoked according to the comparison method in the comparison operation instruction to compare the processed business data obtained from the source database and the processed business data obtained from the destination database.

5. The data comparison method according to claim 4, characterized in that, The step of connecting the source database and the destination database through a standard application programming interface (API) component and executing the operation statements to obtain business data from the source database and the destination database respectively includes: In response to a database connection indication, the standard application programming interface component is acquired and stored based on the database connection indication; The source and destination databases are connected via a standard application programming interface (API) component, and the operation statements are executed to retrieve business data from the source and destination databases respectively.

6. The data comparison method according to claim 1, characterized in that, After comparing the business data obtained from the source database and the business data obtained from the destination database, the process also includes: The running parameters of the compared business data are recorded as program logs, and the comparison results and data between the source database and the destination database are recorded as business logs. The program logs are stored in a local database according to a log file format, while the business logs are stored in a security database.

7. A data comparison device, characterized in that, include: The script module is used to replace the feature parameters in the sampling test case template file with the comparison parameters in the configuration file to obtain the sampling test cases in the configuration file, and update the date variable in the sampling test cases to obtain the sampling script. The operation module is used to execute the sampling script in the sampling source database to obtain sampling data, obtain input parameter test cases in the test case database according to the configuration information in the configuration file and the sampling data, and concatenate the input parameter test cases to obtain operation statements. The operation module includes: connecting to the test case database according to the database connection parameters in the configuration file, obtaining input parameter test cases from the test case database based on the sampling data, and concatenating the input parameter test cases to obtain execution operation statements. The test case database is used to store and manage test cases, parameter configurations and expected results. The execution operation statements are stored according to the comparison path in the configuration file so that the comparison of business data can be realized by calling the execution operation statements. The comparison module is used to retrieve business data from the source database and the destination database respectively using the operation statements to compare the business data retrieved from the source database and the business data retrieved from the destination database.

8. A data comparison electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.

9. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Data consistency processing method and system

    CN104268291A

  • Database adaptation compatibility method and device, electronic equipment and storage medium

    CN118885463A