WO2019029155A1 - 数据对比方法、装置、计算机设备和存储介质 - Google Patents

数据对比方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2019029155A1
WO2019029155A1 PCT/CN2018/077482 CN2018077482W WO2019029155A1 WO 2019029155 A1 WO2019029155 A1 WO 2019029155A1 CN 2018077482 W CN2018077482 W CN 2018077482W WO 2019029155 A1 WO2019029155 A1 WO 2019029155A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
compared
name
field
database
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.)
Ceased
Application number
PCT/CN2018/077482
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019029155A1 publication Critical patent/WO2019029155A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Definitions

  • the present application relates to the field of computer technology, and in particular, to a data comparison method, apparatus, computer device, and storage medium.
  • data comparison tools such as Compare Beyond (a file comparison tool) can be used to compare large amounts of data.
  • Compare Beyond a file comparison tool
  • these data comparison tools have limited data sources, and can only compare the data in Excel (an office software) table, but can not directly grab data in the database for comparison. Therefore, how to directly compare the data in different databases becomes a technical problem that needs to be solved.
  • a data comparison method, apparatus, computer device, and storage medium are provided.
  • a data comparison method that includes:
  • configuration information includes a field name to be compared in the first file and a field name to be compared in the second file;
  • a data comparison device comprising:
  • a file capture module configured to acquire a first database name and a first file name, and fetch the first file in the first database according to the first database name and the first file name; obtain the second database name and the second file name, according to The second database name and the second file name fetch the second file in the second database;
  • a comparison module configured to obtain configuration information, where the configuration information includes a field name to be compared in the first file and a field name to be compared in the second file; according to the field name to be compared in the first file, and the second The field names to be compared in the file compare the data in the first file and the second file, and output a comparison result.
  • a computer device comprising a memory and one or more processors having stored therein computer readable instructions, the computer readable instructions being executable by the processor to cause the one or more processors to execute The following steps:
  • configuration information includes a field name to be compared in the first file and a field name to be compared in the second file;
  • One or more computer readable non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of:
  • configuration information includes a field name to be compared in the first file and a field name to be compared in the second file;
  • 1 is a flow chart of a data comparison method in an embodiment
  • FIG. 2 is a schematic diagram of a comparison page in one embodiment
  • FIG. 3 is a schematic structural diagram of a data comparison device in an embodiment
  • FIG. 4 is a schematic structural diagram of a computer device in an embodiment
  • FIG. 5 is a diagram of an application scenario in an embodiment.
  • first may be referred to as a second client
  • second client may be referred to as a first client, without departing from the scope of the present application.
  • Both the first client and the second client are clients, but they are not the same client.
  • a data comparison method is provided.
  • the method is applied to the terminal as an example for description, and specifically includes the following steps:
  • Step 102 Acquire a first database name and a first file name, and fetch the first file in the first database according to the first database name and the first file name.
  • Step 104 Obtain a second database name and a second file name, and fetch the second file in the second database according to the second database name and the second file name.
  • Step 106 Acquire configuration information, where the configuration information includes a field name to be compared in the first file and a field name to be compared in the second file.
  • Step 108 Compare the data in the first file and the second file according to the field name to be compared in the first file and the field name to be compared in the second file, and output a comparison result.
  • a data comparison application is running on the terminal.
  • the application can compare files in different databases.
  • the database includes Sql Server database, Oracle database and MySql database. Multiple files are included in the database. Different databases can be deployed on different servers.
  • the file can be a data table, a package (a file in an Oracle database), or a text.
  • the terminal can display the configuration page through the application.
  • the user can enter configuration information in the configuration page through the terminal.
  • the configuration information includes basic information of the file to be compared, including the file name to be compared, the name of the field to be compared, and the like.
  • the files to be compared may be files from different databases or files from the same database.
  • the two files to be compared may be referred to as a first file and a second file, respectively.
  • the database corresponding to the first file is referred to as a first database
  • the database corresponding to the second file is referred to as a second database.
  • the configuration information may include all field names of the first file and the second file, and may also include partial field names.
  • the server may include a first server and a second server. The first database is deployed on the first server, and the second database is deployed on the second server.
  • the terminal can display the comparison page through the application. Different files can be compared in the comparison page.
  • the comparison page is shown in Figure 2.
  • the user can input the first database name, the first database connection string, the first file name, the second database name, the second database connection string, the second file name, and the like in the comparison page by using the terminal.
  • the first database name and the second database name may be the same. If the first database name and the second database name are different, the first file name and the second file name may be the same.
  • Ado.Net a set of object-oriented libraries for interacting with the data source
  • call the database connection object to connect to the Oracle database and use Ado (ActiveX Data Control).
  • Objects including: Oracle Command (database command object), Oracle Data Adapter (data adapter object) and Oracle Data Reader (a data object, only allow read-only, forward-looking view of the data stored in it), etc.
  • the first file in the first database is crawled. After the user clicks the "View Data" control after the second file name on the comparison page, the application responds to the control, and the second file is captured in the second database according to the second database connection string.
  • the terminal After the terminal captures the first file and the second file through the application, the data of the first file and the data of the second file are respectively read, and the read data is added to the comparison page for display.
  • the page According to the field name to be compared in the first file in the configuration information and the field name to be compared in the second file, the page will be compared.
  • the data of the first file displayed is compared with the data of the second file. If the field name to be compared in the first file in the configuration file and the field name to be compared in the second file are all field names, the terminal compares all the data in the first file and the second file by using the application. For example, the first field in the first file is compared with the first field in the second file from the first line, the second field in the first file and the second field in the second file are from the first line. Compare line by line, and so on, until all fields are
  • the terminal compares the data to be compared in the first file and the second file by using the application program. .
  • the first field in the first file and the second field in the second file are compared line by line from the first line, and the second field in the first file and the third field in the second file start from the first line. Compare line by line until all generations of comparison fields are compared. After the comparison is completed, the comparison result is output.
  • the comparison results can include all data, or only inconsistent data. In order to facilitate the user to understand the comparison result, the comparison result may only display the inconsistent data in the first file and the second file.
  • all or part of the data migrated from the first file may be included in the second file.
  • the first file includes all or part of the data migrated from the second file.
  • the field names to be compared in the configuration information may be the field name before migration and the field name after migration.
  • the field name before migration and the field name after migration can be the same or different.
  • Migration rules are also included in the configuration information. According to the migration rule, the field name before migration and the corresponding migrated field name, and the field value before migration and the corresponding migrated field value can be found.
  • the terminal may perform batch reading or page reading on the first file and the second file, respectively. Add the read data to the comparison page for comparison. Further, in the comparison process, the progress bar can also be displayed in the comparison page, thereby displaying the progress of the data comparison, thereby facilitating the user to know the progress of the data comparison in time.
  • the first file may be captured in the first database by using the first database name and the first file name
  • the second file may be captured in the second database by using the second database name and the second file.
  • the data in the first file and the second file are compared according to the field name to be compared in the first file in the configuration information and the field name to be compared in the second file, thereby outputting the comparison result. Since the first file and the second file can be directly captured from the unused database, the data of the first file and the second file can be effectively compared according to the configuration information. This makes it possible to directly compare data in different databases.
  • steps in the flowchart of FIG. 1 are sequentially displayed as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these steps is not strictly limited, and may be performed in other sequences. Moreover, at least some of the steps in FIG. 1 may include a plurality of sub-steps or stages, which are not necessarily performed at the same time, but may be executed at different times, and the order of execution thereof is not necessarily This may be performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of the other steps.
  • the method further includes: if there is no configuration information, obtaining a field name to be compared in the first file and a field name to be compared in the second file; respectively, in the first file according to the field name to be compared Querying the first field to be compared and querying the second field to be compared in the second file; and arranging the first field and the second field in a first preset order; performing the first field and the second field after the arrangement Contrast, output comparison results.
  • the query statement or the query file may include a file name to be compared and a field name to be compared. If only the file name to be compared is included, it means that all fields of the file to be compared need to be compared. If both the file name to be compared and the field name to be compared are included, it means that some fields of the file to be compared need to be compared.
  • the user can use the terminal to input a query statement or a query file corresponding to the first file and a query statement or a query file corresponding to the second file in the comparison page.
  • the terminal obtains the field name to be compared in the first file and the field name to be compared in the second file according to the query statement or the query file, and queries the first field to be compared in the first file according to the field name to be compared. And querying the second field to be compared with the second file.
  • the first field to be compared includes the field name to be compared and the corresponding field value, which may be a field to be compared, or may be a plurality of fields to be compared.
  • the application arranges the first field and the second field that are queried according to the first preset order, so as to ensure that the query result of the first file is consistent with the query result of the second file, thereby ensuring the accuracy of the data comparison.
  • the terminal compares the arranged first field and the second field through the application, and outputs the comparison result.
  • the field name to be compared in the comparison file may be queried by inputting a query statement or importing a query file to obtain data to be compared.
  • the method further includes: obtaining a table structure corresponding to the first file and a table structure corresponding to the second file; comparing the table structure corresponding to the first file with the table structure corresponding to the second file; outputting the first The file is inconsistent with the second file.
  • the first file may be a data table
  • the second file may also be a data table.
  • the table structure of the first file includes a plurality of fields
  • the table structure of the second file also includes a plurality of fields.
  • the comparison page may also include a control "query table structure".
  • the user can click the control "query table structure" in the comparison page through the terminal, and the application responds to the control to separately query the table structure corresponding to the first file and the table structure corresponding to the second file.
  • the terminal compares the table structure of the first comparison file and the table structure of the second file through the application, and outputs a field inconsistent between the first file and the second file.
  • the first file includes a plurality of packages
  • the second file includes a plurality of packages.
  • the method further includes: if the configuration information includes the package name to be compared and the corresponding owner, according to the package name to be compared and the corresponding genus
  • the master obtains two packets to be compared in the first database and the second database respectively, and compares the two packets to be compared; if the configuration information does not include the package name to be compared and the corresponding owner, the first database is Multiple packages in the package and/or multiple packages in the second database are compared separately.
  • the first database and the second database may both be Oracle databases.
  • An Oracle database can include multiple packages.
  • the package can be used to classify functions or stored procedures.
  • the package has a header and a body. A function and a stored procedure are defined in the header, and the body is used to implement the functions and stored procedures defined in the header.
  • Each package has a corresponding package name and owner.
  • the first file may include a plurality of packages, and the second file may also include a plurality of packages. If the package name to be compared and the corresponding owner are entered in the configuration information, the terminal can obtain the corresponding two packages to be compared through the application, and compare the two packages. This gives the content difference between the two specified packages. Therefore, after the database script is handed over, it is convenient to verify whether the package has changed.
  • the terminal may acquire, by the application, multiple packets in the first database, and multiple packages in the second database, and multiple packets in the first database. Compare with multiple packages in the second database. Wherein, multiple packages in the first database can be compared, and multiple packages in the second database can be compared, and multiple packages in the first database and multiple packages in the second database are further Can be compared. Therefore, after the database script is handed over, it is convenient to know whether the package changes between different owners. It is also possible to facilitate the user to know whether the packets between different databases are synchronized to the same content after the database version is synchronized.
  • the first file includes the interface parameter of the current version
  • the second file includes the interface parameter of the previous version
  • the method further includes: converting the interface parameter of the current version to the first interface parameter of the Json format; The plurality of parameter data of the interface parameter are sorted according to the second preset order; the interface parameter of the previous version is converted into the second interface parameter of the Json format; and the plurality of parameter data of the second interface parameter are sorted according to the second preset order; The sorted first interface parameter is compared with the second interface parameter, and the parameter data in which the current version is inconsistent with the previous version is output.
  • the first file may record the interface parameters of the current version of the database.
  • the second file can record the interface parameters of a version on the database. Multiple interface data is included in the interface parameters.
  • the interface data can be recorded in the form of a data table or in the form of text. Due to the poor readability of interface parameters, it is not convenient to compare directly through the application.
  • the terminal can convert the interface parameters through the application. Specifically, the terminal obtains the interface parameter of the current version in the first file by using the application, and converts the interface parameter of the current version into the first interface parameter of the Json format.
  • the first interface parameter includes a plurality of parameter data, and the plurality of parameter data are displayed line by line and are sorted in a second preset order.
  • the terminal obtains the interface parameter of the previous version in the second file through the application, and converts the interface parameter of the previous version into the second interface parameter of the Json format.
  • the second interface parameter includes a plurality of parameter data, and the plurality of parameter data are displayed line by line and sorted in a second preset order.
  • the application compares the first interface parameter with the second interface parameter line by line, and outputs parameter data in which the current version is inconsistent with the previous version. Since the order of the first interface parameter and the plurality of parameter data in the second interface parameter are consistent, it is easy to know the parameter data of the two by comparison. This makes it easy for the user to know which parameter data in the interface data between different versions of the database has been modified.
  • a data comparison apparatus including: a file capture module 302 and a comparison module 304, wherein:
  • the file fetching module 302 is configured to obtain a first database name and a first file name, and fetch the first file in the first database according to the first database name and the first file name; and obtain the second database name and the second file name, according to the first The second database name and the second file name fetch the second file in the second database.
  • the comparison module 304 is configured to obtain configuration information, where the configuration information includes a field name to be compared in the first file, and a field name to be compared in the second file; according to the field name to be compared in the first file and the second file The field names to be compared are compared with the data in the first file and the second file, and the comparison result is output.
  • the comparison module 304 is further configured to: if the configuration information does not exist, obtain the field name to be compared in the first file and the field name to be compared in the second file; respectively, according to the field name to be compared Querying the first field to be compared and querying the second field to be compared in the second file; and arranging the first field and the second field in a first preset order; arranging the first field and the second field Compare and output the comparison results.
  • the first file includes a data table
  • the second file includes a data table
  • the comparison module 304 is further configured to obtain a table structure corresponding to the first file and a table structure corresponding to the second file; The structure is compared with the table structure corresponding to the second file; the fields in which the first file is inconsistent with the second file are output.
  • the first file includes a plurality of packages
  • the second file includes a plurality of packages.
  • the comparison module 304 is further configured to: if the configuration information includes the package name to be compared and the corresponding owner, according to the package name to be compared and the corresponding The owner obtains two packages to be compared in the first database and the second database, and compares the two packages to be compared; if the configuration information does not include the package name to be compared and the corresponding owner, the first will be Multiple packages in the database and/or multiple packages in the second database are compared separately.
  • the first file includes the interface parameter of the current version
  • the second file includes the interface parameter of the previous version
  • the comparison module 304 is further configured to convert the interface parameter of the current version into the first interface parameter of the Json format
  • the plurality of parameter data of an interface parameter are sorted according to a second preset order
  • the interface parameter of the previous version is converted into the second interface parameter of the Json format
  • the plurality of parameter data of the second interface parameter are sorted according to the second preset order; Comparing the sorted first interface parameter with the second interface parameter, and outputting parameter data in which the current version is inconsistent with the previous version.
  • a computer device comprising the terminal mentioned in the above embodiments.
  • the computer device includes a processor, a memory, and a network interface connected by a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the non-volatile storage medium of the computer device stores an operating system and computer readable instructions, and the non-volatile storage medium can be a computer-readable non-volatile storage medium.
  • the computer readable instructions are executed by the processor to implement a data comparison method.
  • the internal memory of the computer device provides an environment for the operation of an operating system and computer readable instructions in a non-volatile storage medium.
  • the network interface of the computer device is used for communicating with an external server through a network connection, for example, capturing a file to be compared in a database in the server.
  • the processor executes the computer readable instructions, the following steps may be performed: acquiring the first database name and the first file name, and fetching the first file in the first database according to the first database name and the first file name; acquiring the second database name and the second file a file name, the second file is captured in the second database according to the second database name and the second file name; obtaining configuration information, where the configuration information includes a field name to be compared in the first file, and a field to be compared in the second file Name; compare the data in the first file and the second file according to the field name to be compared in the first file and the field name to be compared in the second file, and output the comparison result.
  • FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • an application scenario is provided.
  • the computer device 502 is connected to the first server 504 via a network, and the computer device 504 is connected to the second server 506 via a network.
  • a first database is deployed on the first server 504 and a second database is deployed on the second server 506.
  • a data comparison application is run in computer device 504.
  • the computer device 504 can display a comparison page through the application. The first page name and the first file name and the second database name and the second file name input by the user are included in the comparison page.
  • the computer device 504 accesses the first server 504 with the data comparison application to read the data of the first file in the first database, and the computer device 504 accesses the second server 506 with the data comparison application to read the second file in the second database.
  • Computer device 504 adds the read data to the comparison page for presentation.
  • the computer device 504 invokes the configuration information by using the data comparison application, and compares the data of the first file and the second file displayed in the page according to the field name to be compared in the first file in the configuration information and the field name to be compared in the second file.
  • the data is compared and the comparison results are output on the comparison page. This makes it possible to directly compare data in different databases.
  • the processor also performs the following steps when executing the computer readable instructions:
  • the aligned first field and the second field are compared to output a comparison result.
  • the first file includes a data table
  • the second file includes a data table
  • the processor performs the following steps when executing the computer readable instructions:
  • the first file includes a plurality of packages
  • the second file includes a plurality of packages
  • the processor further performs the following steps when executing the computer readable instructions:
  • the two packages to be compared are obtained in the first database and the second database according to the package name to be compared and the corresponding owner, and the two packages to be compared are compared. Compare;
  • the multiple packets in the first database and/or the multiple packets in the second database are separately compared.
  • the first file includes the current version of the interface parameter
  • the second file includes the interface parameter of the previous version.
  • the processor executes the computer readable instructions, the processor further performs the following steps: converting the current version of the interface parameter to the Json format The first interface parameter; the plurality of parameter data of the first interface parameter are sorted in a second preset order;
  • one or more computer readable non-volatile storage media having computer readable instructions, when executed by one or more processors, causing one or more processors Perform the following steps:
  • configuration information includes a field name to be compared in the first file and a field name to be compared in the second file;
  • the data in the first file and the second file are compared according to the field name to be compared in the first file and the field name to be compared in the second file, and the comparison result is output.
  • the processor also performs the following steps when executing the computer readable instructions:
  • the aligned first field and the second field are compared to output a comparison result.
  • the first file includes a data table
  • the second file includes a data table
  • the processor performs the following steps when executing the computer readable instructions:
  • the first file includes a plurality of packages
  • the second file includes a plurality of packages
  • the processor further performs the following steps when executing the computer readable instructions:
  • the two packages to be compared are obtained in the first database and the second database according to the package name to be compared and the corresponding owner, and the two packages to be compared are compared. Compare;
  • the multiple packets in the first database and/or the multiple packets in the second database are separately compared.
  • the first file includes an interface parameter of the current version
  • the second file includes interface parameters of the previous version
  • the computer readable instructions are further executed by the processor to perform the following steps:
  • one or more computer readable non-volatile storage media storing computer readable instructions are provided, the computer readable instructions being executed by one or more processors such that one or more The steps in the various method embodiments described above are implemented when the processor is executed.
  • the readable storage medium which when executed, may include the flow of an embodiment of the methods as described above.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.

Landscapes

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

Abstract

本申请涉及一种数据对比方法,包括:获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。

Description

数据对比方法、装置、计算机设备和存储介质
本申请要求于2017年8月8日提交中国专利局、申请号为2017106705122、发明名称为“数据对比方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及一种数据对比方法、装置、计算机设备和存储介质。
背景技术
在数据库开发过程中,通常需要对数据库中的数据进行对比。例如,通过数据对比来验证数据库脚本移交之后数据表的内容是否发生改动,或者数据库版本同步后,两个数据库是否同步成一致的内容等。
在传统的数据对比方式中,可以采用数据对比工具,如Compare Beyond(一款文件对比工具),对大量数据进行对比。但是这些数据对比工具进行对比的数据源有限,只能对Excel(一款办公软件)表格中的数据进行对比,而无法直接在数据库中抓取数据进行对比。因此,如何直接对不同数据库中的数据进行有效对比成为目前需要解决的一个技术问题。
发明内容
根据本申请公开的各种实施例,提供一种数据对比方法、装置、计算机设备和存储介质。
一种数据对比方法,包括:
获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名 在第二数据库中抓取第二文件;
获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
一种数据对比装置,包括:
文件抓取模块,用于获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;及
对比模块,用于获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;
获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下 步骤:
获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;
获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为一个实施例中数据对比方法的流程图;
图2为一个实施例中对比页面的示意图;
图3为一个实施例中数据对比装置的结构示意图;
图4为一个实施例中计算机设备的结构示意图;
图5为一个实施例中的应用场景图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一客户端称为第二客户端,且类似地,可将第二客户端称为第一客户端。第一客户端和第二客户端两者都是客户端,但其不是同一客户端。
在一个实施例中,如图1所示,提供了一种数据对比方法,以该方法应用于终端为例进行说明,具体包括以下步骤:
步骤102,获取第一数据库名和第一文件名,根据第一数据库名和第一文件名在第一数据库中抓取第一文件。
步骤104,获取第二数据库名和第二文件名,根据第二数据库名和第二文件名在第二数据库中抓取第二文件。
步骤106,获取配置信息,配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名。
步骤108,根据第一文件中待对比的字段名以及第二文件中待对比的字段名对第一文件和第二文件中的数据进行对比,输出对比结果。
终端上运行了数据对比应用程序。该应用程序可以对不同的数据库中的文件进行对比。数据库包括Sql Server数据库、Oracle数据库以及MySql数据库等。数据库中包括多个文件。不同的数据库可以分别部署在不同的服务器上。文件可以是数据表,也可以是包(Oracle数据库中一种文件),还可以是文本等。
终端通过该应用程序可以展示配置页面。用户可以通过终端在配置页面中输入配置信息。配置信息包括待对比的文件的基本信息,包括待对比的文件名、待对比的字段名等。其中待对比的文件可以是来自不同数据库中的文件,也可以是来自同一数据库中的文件。为了简洁描述,将待对比的两个文件可以分别称为第一文件和第二文件。将第一文件对应的数据库称为第一数据库,将第二文件对应的数据库称为第二数据库。配置信息中可以包括第一文件和第二文件的全部字段名也可以包括部分字段名。服务器可以包括第一 服务器和第二服务器。其中,第一数据库部署在第一服务器上,第二数据库部署在第二服务器上。
终端通过该应用程序可以展示对比页面。对比页面中可以对不同的文件进行对比。对比页面如图2所示。用户利用终端可以在对比页面中输入第一数据库名、第一数据库连接串、第一文件名以及第二数据库名、第二数据库连接串、第二文件名等。其中,第一数据库名和第二数据库名可以相同,如果第一数据库名和第二数据库名不同,那么第一文件名和第二文件名可以相同。用户通过终端在对比页面点击第一文件名后的“查看数据”这一控件,应用程序响应该控件,根据第一数据库连接串在第一数据库中抓取第一文件。以第一数据库为Oracle数据库为例,应用程序可以运用Ado.Net(一组用于和数据源进行交互的面向对象类库),调用数据库连接对象连接到Oracle数据库,利用Ado(ActiveX数据控件)对象,包括:Oracle Command(数据库命令对象)、Oracle Data Adapter(数据适配器对象)以及Oracle Data Reader(一种数据对象,只允许以只读、顺向的方式查看其中所存储的数据)等,对第一数据库中的第一文件进行抓取。用户通过终端在对比页面点击第二文件名后的“查看数据”这一控件,应用程序响应该控件,根据第二数据库连接串在第二数据库中抓取第二文件。
终端通过应用程序抓取到第一文件和第二文件后,分别读取第一文件的数据和第二文件的数据,将读取到的数据添加在对比页面中进行展示。用户通过终端在对比页面点击“开始”这一控件,应用程序响应该控件,调用配置信息,根据配置信息中第一文件中待对比的字段名以及第二文件中待对比的字段名将对比页面中展示的第一文件的数据和第二文件的数据进行对比。如果配置信息中第一文件中待对比的字段名和第二文件中待对比的字段名是全部字段名,则终端通过应用程序对第一文件和第二文件中全部数据进行相应的对比。例如,第一文件中的第一字段与第二文件中的第一字段从第一行开始逐行对比,第一文件中的第二字段与第二文件中的第二字段从第一行开始逐行对比,以此类推,直到所有的字段完成对比。
如果配置信息中第一文件中待对比的字段名和第二文件中待对比的字段名是部分字段名,则终端通过应用程序对第一文件和第二文件中待对比的部分数据进行相应的对比。例如,第一文件中的第一字段与第二文件中的第二字段从第一行开始逐行对比,第一文件中的第二字段与第二文件中的第三字段从第一行开始逐行对比,直到所有的代对比字段完成对比。对比完成后,输出对比结果。对比结果可以包括全部数据,也可以只包括不一致的数据。为了便于用户了解对比结果,对比结果可以只显示第一文件和第二文件中不一致的数据。
进一步的,第二文件中可以包括从第一文件中的迁移的全部或部分数据。或者第一文件中包括从第二文件中的迁移的全部或部分数据。对发生数据迁移的两个文件进行对比时,配置信息中待对比的字段名可以是迁移前的字段名和迁移后的字段名。迁移前的字段名和迁移后的字段名可以相同,也可以不同。配置信息中还包括迁移规则。根据迁移规则可以查找到迁移前的字段名与对应的迁移后的字段名,以及迁移前的字段值与对应的迁移后的字段值。当大量数据从一个文件迁移至另一个文件时,通过上述方式将迁移前后的数据进行对比,可以快速有效的得知数据迁移是否准确无误。
进一步的,若第一文件的数据和第二文件的数据均较多,终端可以对第一文件和第二文件分别进行分批读取或者分页读取。将读取到的数据添加在对比页面中进行对比。进一步的,在对比过程中对比页面中还可以显示进度条,以此显示数据对比的进度,由此方便用户及时了解数据对比进度。
本实施例中,通过第一数据库名和第一文件名可以第一数据库中抓取第一文件,通过第二数据库名和第二文件可以在第二数据库中抓取第二文件。根据配置信息中第一文件中待对比的字段名以及第二文件中待对比的字段名对第一文件和第二文件中的数据进行对比,由此可以输出对比结果。由于第一文件和第二文件可以从不用的数据库中直接抓取,根据配置信息可以将第一文件和第二文件的数据进行有效对比。由此实现了直接对不同数据库中的数据进行有效对比。
应该理解的是,虽然图1的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,图1中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
在一个实施例中,该方法还包括:若不存在配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;将第一字段和第二字段按照第一预设顺序进行排列;将排列后的第一字段和第二字段进行对比,输出对比结果。
如果用户没有在配置页面中进行配置,也可以通过对比页面输入查询语句或者导入查询文件。其中,查询语句或查询文件中可以包括待对比文件名和待对比字段名。如果只包括待对比文件名,则表示待对比文件的全部字段都需要进行对比。如果既包括待对比文件名,又包括待对比字段名,则表示待对比文件的部分字段需要进行对比。
具体的,用户利用终端可以分别在对比页面中输入第一文件对应的查询语句或者查询文件,以及第二文件对应的查询语句或者查询文件。终端通过应用程序根据查询语句或查询文件分别获取第一文件中待对比的字段名以及第二文件中待对比的字段名,根据待对比的字段名分别在第一文件查询待对比的第一字段以及和第二文件中查询待对比的第二字段。其中,待对比的第一字段包括待对比的字段名及对应的字段值,可以是一个待对比字段,也可以是多个待对比字段。
应用程序将查询到的第一字段和第二字段按照第一预设顺序进行排列,以此确保第一文件的查询结果与第二文件的查询结果顺序一致,进而能够确保数据对比的准确性。终端通过应用程序对排列后的第一字段和第二字段进 行对比,输出对比结果。
本实施例中,如果没有在配置页面中输入配置信息,还可以通过输入查询语句或导入查询文件对待对比文件中的待对比字段名进行查询,得到待对比数据。由此使得数据对比的方式更灵活,方便用户选择更符合自己使用习惯的对比方式。
在一个实施例中,该方法还包括:获取第一文件对应的表结构以及第二文件对应的表结构;对第一文件对应的表结构和第二文件对应的表结构进行对比;输出第一文件与第二文件中不一致的字段。
本实施例中,第一文件可以是数据表,第二文件也可以是数据表。第一文件的表结构中包括多个字段,第二文件的表结构也包括多个字段。在根据配置信息或查询语句等对第一文件和第二文件进行对比时,还可以对第一文件和第二文件的表结构分别进行对比。
具体的,对比页面中还可以包括控件“查询表结构”。用户通过终端可以在对比页面中点击控件“查询表结构”,应用程序响应该控件可以分别查询第一文件对应的表结构以及第二文件对应的表结构。终端通过应用程序可以将第一对比文件的表结构以及第二文件的表结构进行对比,输出第一文件与第二文件中不一致的字段。
通过对第一文件和第二文件的字段和表结构分别进行对比,有助于用户全面了解不同数据库中相同文件名的两个数据表之间的不同。由此在数据库版本同步之后,可以方便用户了解不同数据库之间的表结构是否同步为一致的内容。
在一个实施例中,第一文件包括多个包,第二文件包括多个包,该方法还包括:若配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;若配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
本实施例中,第一数据库和第二数据库可以均为Oracle数据库。Oracle 数据库可以包括多个包。通过包可以对函数或存储过程进行分类管理。包具有包头和包体。包头中定义了一个函数和一个存储过程,包体用于实现包头中定义的函数和存储过程。
每个包具有对应的包名和属主。第一文件可以包括多个包,第二文件也可以包括多个包。如果在配置信息中输入了待对比包名和对应的属主,则终端通过应用程序可以获取到相应的两个待对比的包,将两个包进行对比。由此得到两个指定包的内容差异。从而使得数据库脚本移交之后,可以方便验证包是否发生改动。
如果配置信息中未包括待对比包名和对应的属主,则终端通过应用程序可以获取第一数据库中的多个包,以及第二数据库中的多个包,将第一数据库中的多个包与第二数据库中的多个包进行对比。其中,第一数据库中的多个包之间可以进行对比,第二数据库中的多个包之间可以进行对比,第一数据库中的多个包与第二数据库中的多个包之间还可以进行对比。由此在数据库脚本移交之后,可以方便了解不同属主之间包是否发生改动。也可以在数据库版本同步之后,方便用户了解不同数据库之间的包是否同步为一致的内容。
在一个实施例中,第一文件包括当前版本的接口参数,第二文件包括上一版本的接口参数,该方法还包括:将当前版本的接口参数转换为Json格式的第一接口参数;第一接口参数的多个参数数据按第二预设顺序排序;将上一版本的接口参数转换为Json格式的第二接口参数;第二接口参数的多个参数数据按第二预设顺序排序;将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
本实施例中,第一文件可以记录了数据库当前版本的接口参数。第二文件可以记录了数据库上一个版本的接口参数。接口参数中包括了多个接口数据。接口数据可以采用数据表的形式进行记录,也可以采用文本的形式进行记录。由于接口参数的可读性较差,不便于直接通过该应用程序进行比对。
为了得知数据库的当前版本与上一版本之间有哪些参数数据进行了修 改,终端可以通过应用程序对接口参数进行转换。具体的,终端通过应用程序获取第一文件中当前版本的接口参数,将当前版本的接口参数转换为Json格式的第一接口参数。第一接口参数包括多个参数数据,多个参数数据逐行显示,并按第二预设顺序排序。终端通过应用程序获取第二文件中上一版本的接口参数,将上一版本的接口参数转换为Json格式的第二接口参数。第二接口参数包括多个参数数据,多个参数数据逐行显示,并按第二预设顺序排序。应用程序对第一接口参数与第二接口参数逐行进行比较,输出当前版本与上一版本不一致的参数数据。由于第一接口参数与第二接口参数中的多个参数数据的排列顺序一致,因此通过对比,很容易得知两者不同的参数数据。由此方便用户了解数据库不同版本之间的接口数据中有哪些参数数据被修改。
在一个实施例中,如图3所示,提供了一种数据对比装置,包括:文件抓取模块302和对比模块304,其中:
文件抓取模块302,用于获取第一数据库名和第一文件名,根据第一数据库名和第一文件名在第一数据库中抓取第一文件;获取第二数据库名和第二文件名,根据第二数据库名和第二文件名在第二数据库中抓取第二文件。
对比模块304,用于获取配置信息,配置信息中包括第一文件中待对比的字段名,以及第二文件中待对比的字段名;根据第一文件中待对比的字段名以及第二文件中待对比的字段名对第一文件和第二文件中的数据进行对比,输出对比结果。
在一个实施例中,对比模块304还用于若不存在配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;将第一字段和第二字段按照第一预设顺序进行排列;将排列后的第一字段和第二字段进行对比,输出对比结果。
在一个实施例中,第一文件包括数据表,第二文件包括数据表,对比模块304还用于获取第一文件对应的表结构以及第二文件对应的表结构;对第 一文件对应的表结构和第二文件对应的表结构进行对比;输出第一文件与第二文件中不一致的字段。
在一个实施例中,第一文件包括多个包,第二文件包括多个包,对比模块304还用于若配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;若配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
在一个实施例中,第一文件包括当前版本的接口参数,第二文件包括上一版本的接口参数,对比模块304还用于将当前版本的接口参数转换为Json格式的第一接口参数;第一接口参数的多个参数数据按第二预设顺序排序;将上一版本的接口参数转换为Json格式的第二接口参数;第二接口参数的多个参数数据按第二预设顺序排序;将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
在一个实施例中,提供了一种计算机设备,该计算机设备包括上述实施例中提及的终端。如图4所示,该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该计算机设备的非易失性存储介质存储有操作系统和和计算机可读指令,非易失性存储介质可以是计算机可读非易失性存储介质。该计算机可读指令被处理器执行时以实现一种数据对比方法。该计算机设备的内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的网络接口用于与外部服务器通过网络连接通信,比如,在服务器中的数据库中抓取待对比文件等。处理器执行计算机可读指令时可以执行以下步骤:获取第一数据库名和第一文件名,根据第一数据库名和第一文件名在第一数据库中抓取第一文件;获取第二数据库名和第二文件名,根据第二数据库名和第二文件名在第二数据库中抓取第二文件;获取配置信息,配置信息中包括第一文件中待对比的字段名,以及第二文件中待对比的字段名;根据第一文件中待 对比的字段名以及第二文件中待对比的字段名对第一文件和第二文件中的数据进行对比,输出对比结果。
本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,如图5所示,提供了一种应用场景。其中,计算机设备502通过网络与第一服务器504连接,计算机设备504通过网络与第二服务器506连接。第一服务器504上部署了第一数据库,第二服务器506上部署了第二数据库。计算机设备504中运行了数据对比应用程序。计算机设备504通过该应用程序可以展示对比页面。比页面中包括用户输入的第一数据库名和第一文件名以及第二数据库名和第二文件名等。计算机设备504利用数据对比应用程序访问第一服务器504在第一数据库中读取第一文件的数据,以及计算机设备504利用数据对比应用程序访问第二服务器506在第二数据库中读取第二文件的数据。计算机设备504将读取到的数据添加到对比页面中进行展示。计算机设备504利用数据对比应用程序调用配置信息,根据配置信息中第一文件中待对比的字段名以及第二文件中待对比的字段名将对比页面中展示的第一文件的数据和第二文件的数据进行对比,在对比页面中输出对比结果。由此实现了直接对不同数据库中的数据进行有效对比。
在一个实施例中,处理器执行计算机可读指令时还执行以下步骤:
若不存在配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;
根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;
将第一字段和第二字段按照第一预设顺序进行排列;及
将排列后的第一字段和第二字段进行对比,输出对比结果。
在一个实施例中,第一文件包括数据表,第二文件包括数据表,处理器 执行计算机可读指令时还执行以下步骤:
获取第一文件对应的表结构以及第二文件对应的表结构;
对第一文件对应的表结构和第二文件对应的表结构进行对比;
输出第一文件与第二文件中不一致的字段。
在一个实施例中,第一文件包括多个包,第二文件包括多个包,处理器执行计算机可读指令时还执行以下步骤:
若配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及
若配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
在一个实施例中,第一文件包括当前版本的接口参数,第二文件包括上一版本的接口参数,处理器执行计算机可读指令时还执行以下步骤:将当前版本的接口参数转换为Json格式的第一接口参数;第一接口参数的多个参数数据按第二预设顺序排序;
将上一版本的接口参数转换为Json格式的第二接口参数;第二接口参数的多个参数数据按第二预设顺序排序;及
将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
在一个实施例中,提供了一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
获取第一数据库名和第一文件名,根据第一数据库名和第一文件名在第一数据库中抓取第一文件;
获取第二数据库名和第二文件名,根据第二数据库名和第二文件名在第二数据库中抓取第二文件;
获取配置信息,配置信息中包括第一文件中待对比的字段名以及第二文 件中待对比的字段名;及
根据第一文件中待对比的字段名以及第二文件中待对比的字段名对第一文件和第二文件中的数据进行对比,输出对比结果。
在一个实施例中,处理器执行计算机可读指令时还执行以下步骤:
若不存在配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;
根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;
将第一字段和第二字段按照第一预设顺序进行排列;及
将排列后的第一字段和第二字段进行对比,输出对比结果。
在一个实施例中,第一文件包括数据表,第二文件包括数据表,处理器执行计算机可读指令时还执行以下步骤:
获取第一文件对应的表结构以及第二文件对应的表结构;
对第一文件对应的表结构和第二文件对应的表结构进行对比;及
输出第一文件与第二文件中不一致的字段。
在一个实施例中,第一文件包括多个包,第二文件包括多个包,处理器执行计算机可读指令时还执行以下步骤:
若配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及
若配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
在一个实施例中,第一文件包括当前版本的接口参数,第二文件包括上一版本的接口参数,计算机可读指令被处理器执行时还执行以下步骤:
将当前版本的接口参数转换为Json格式的第一接口参数;第一接口参数的多个参数数据按第二预设顺序排序;
将上一版本的接口参数转换为Json格式的第二接口参数;第二接口参数 的多个参数数据按第二预设顺序排序;及
将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
在一个实施例中,提供了一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行时实现上述各个方法实施例中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种数据对比方法,包括:
    获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
    获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;
    获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
    根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若不存在所述配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;
    根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;
    将所述第一字段和第二字段按照第一预设顺序进行排列;及
    将排列后的第一字段和第二字段进行对比,输出对比结果。
  3. 根据权利要求1所述的方法,其特征在于,所述第一文件包括数据表,所述第二文件包括数据表,所述方法还包括:
    获取第一文件对应的表结构以及第二文件对应的表结构;
    对第一文件对应的表结构和第二文件对应的表结构进行对比;及
    输出第一文件与第二文件中不一致的字段。
  4. 根据权利要求1所述的方法,其特征在于,所述第一文件包括多个包,所述第二文件包括多个包,所述方法还包括:
    若所述配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及
    若所述配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
  5. 根据权利要求1所述的方法,其特征在于,所述第一文件包括当前版本的接口参数,所述第二文件包括上一版本的接口参数,所述方法还包括:
    将所述当前版本的接口参数转换为Json格式的第一接口参数;所述第一接口参数的多个参数数据按第二预设顺序排序;
    将所述上一版本的接口参数转换为Json格式的第二接口参数;所述第二接口参数的多个参数数据按第二预设顺序排序;及
    将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
  6. 一种数据对比装置,其特征在于,所述装置包括:
    文件抓取模块,用于获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;及
    对比模块,用于获取配置信息,所述配置信息中包括第一文件中待对比的字段名,以及第二文件中待对比的字段名;根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
  7. 根据权利要求6所述的装置,其特征在于,所述对比模块还用于若不存在所述配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;及将所述第一字段和第二字段按照第一预设顺序进行排列;将排列后的第一字段和第二字段进行对比,输出对比结果。
  8. 根据权利要求6或7所述的装置,其特征在于,所述第一文件包括数据表,所述第二文件包括数据表,所述对比模块还用于获取第一文件对应的 表结构以及第二文件对应的表结构;对第一文件对应的表结构和第二文件对应的表结构进行对比;及输出第一文件与第二文件中不一致的字段。
  9. 根据权利要求6所述的装置,其特征在于,所述第一文件包括多个包,所述第二文件包括多个包,所述对比模块还用于若所述配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及若所述配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
  10. 根据权利要求6所述的装置,其特征在于,所述第一文件包括当前版本的接口参数,所述第二文件包括上一版本的接口参数,所述对比模块还用于将所述当前版本的接口参数转换为Json格式的第一接口参数;所述第一接口参数的多个参数数据按第二预设顺序排序;将所述上一版本的接口参数转换为Json格式的第二接口参数;所述第二接口参数的多个参数数据按第二预设顺序排序;及将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
  11. 一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
    获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
    获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;
    获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
    根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
  12. 根据权利要求11所述的计算机设备,其特征在于,所述计算机可读 指令被所述处理器执行时,使得所述一个或多个处理器还执行以下步骤:
    若不存在所述配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;
    根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;
    将所述第一字段和第二字段按照第一预设顺序进行排列;及
    将排列后的第一字段和第二字段进行对比,输出对比结果。
  13. 根据权利要求11所述的计算机设备,其特征在于,所述第一文件包括数据表,所述第二文件包括数据表,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器还执行以下步骤:
    获取第一文件对应的表结构以及第二文件对应的表结构;
    对第一文件对应的表结构和第二文件对应的表结构进行对比;及
    输出第一文件与第二文件中不一致的字段。
  14. 根据权利要求11-13任一项所述的计算机设备,其特征在于,所述第一文件包括多个包,所述第二文件包括多个包,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器还执行以下步骤:
    若所述配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及
    若所述配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
  15. 根据权利要求14所述的计算机设备,其特征在于,所述第一文件包括当前版本的接口参数,所述第二文件包括上一版本的接口参数,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器还执行以下步骤:
    将所述当前版本的接口参数转换为Json格式的第一接口参数;所述第一接口参数的多个参数数据按第二预设顺序排序;
    将所述上一版本的接口参数转换为Json格式的第二接口参数;所述第二接口参数的多个参数数据按第二预设顺序排序;及
    将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
  16. 一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
    获取第一数据库名和第一文件名,根据所述第一数据库名和第一文件名在第一数据库中抓取第一文件;
    获取第二数据库名和第二文件名,根据所述第二数据库名和第二文件名在第二数据库中抓取第二文件;
    获取配置信息,所述配置信息中包括第一文件中待对比的字段名以及第二文件中待对比的字段名;及
    根据所述第一文件中待对比的字段名以及第二文件中待对比的字段名对所述第一文件和第二文件中的数据进行对比,输出对比结果。
  17. 根据权利要求16所述的存储介质,其特征在于,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    若不存在所述配置信息,则获取第一文件中待对比的字段名以及第二文件中待对比的字段名;
    根据待对比的字段名分别在第一文件查询待对比的第一字段以及在第二文件中查询待对比的第二字段;
    将所述第一字段和第二字段按照第一预设顺序进行排列;及
    将排列后的第一字段和第二字段进行对比,输出对比结果。
  18. 根据权利要求16所述的存储介质,其特征在于,所述第一文件包括数据表,所述第二文件包括数据表,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    获取第一文件对应的表结构以及第二文件对应的表结构;
    对第一文件对应的表结构和第二文件对应的表结构进行对比;及
    输出第一文件与第二文件中不一致的字段。
  19. 根据权利要求16-18任一项所述的存储介质,其特征在于,所述第一文件包括多个包,所述第二文件包括多个包,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    若所述配置信息中包括待对比包名和对应的属主,则根据待对比包名和对应的属主分别在第一数据库中和第二数据库中获取两个待对比的包,将两个待对比的包进行对比;及
    若所述配置信息中未包括待对比包名和对应的属主,则将第一数据库中的多个包和/或第二数据库中的多个包分别进行对比。
  20. 根据权利要求19所述的存储介质,其特征在于,所述第一文件包括当前版本的接口参数,所述第二文件包括上一版本的接口参数,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器还执行以下步骤:
    将所述当前版本的接口参数转换为Json格式的第一接口参数;所述第一接口参数的多个参数数据按第二预设顺序排序;
    将所述上一版本的接口参数转换为Json格式的第二接口参数;所述第二接口参数的多个参数数据按第二预设顺序排序;及
    将排序后的第一接口参数与第二接口参数进行比较,输出当前版本与上一版本不一致的参数数据。
PCT/CN2018/077482 2017-08-08 2018-02-28 数据对比方法、装置、计算机设备和存储介质 Ceased WO2019029155A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710670512.2 2017-08-08
CN201710670512.2A CN107688618B (zh) 2017-08-08 2017-08-08 数据对比方法、装置、计算机设备和存储介质

Publications (1)

Publication Number Publication Date
WO2019029155A1 true WO2019029155A1 (zh) 2019-02-14

Family

ID=61153373

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077482 Ceased WO2019029155A1 (zh) 2017-08-08 2018-02-28 数据对比方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN107688618B (zh)
WO (1) WO2019029155A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11379419B2 (en) * 2019-11-29 2022-07-05 Sap Se Autonomous intelligent data pipeline comparator

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107688618B (zh) * 2017-08-08 2019-03-12 平安科技(深圳)有限公司 数据对比方法、装置、计算机设备和存储介质
CN108509612A (zh) * 2018-03-30 2018-09-07 北京润科通用技术有限公司 一种数据处理方法及装置
CN109492197A (zh) * 2018-09-18 2019-03-19 深圳壹账通智能科技有限公司 文件信息比对方法、装置、计算机设备和存储介质
CN109829138A (zh) * 2018-12-15 2019-05-31 中国平安人寿保险股份有限公司 文件比对方法、装置、电子设备及计算机可读存储介质
CN109710571B (zh) * 2018-12-27 2023-06-23 腾讯音乐娱乐科技(深圳)有限公司 一种文件解析方法、设备及存储介质
CN111399972B (zh) * 2019-01-02 2023-05-09 中国移动通信有限公司研究院 一种虚拟机抓包的方法、装置及计算机可读存储介质
CN110209705A (zh) * 2019-04-25 2019-09-06 深圳壹账通智能科技有限公司 数据查询方法、装置、计算机设备、计算机存储介质
CN110287182B (zh) * 2019-05-05 2021-09-14 浙江吉利控股集团有限公司 一种大数据的数据对比方法、装置、设备及终端
CN110377883A (zh) * 2019-06-04 2019-10-25 苏州神州数码捷通科技有限公司 基于大数据的一种深加工数据校验方法
CN110737642B (zh) * 2019-09-05 2022-09-02 平安科技(深圳)有限公司 数据库信息分析方法、装置、计算机装置及存储介质
CN112905691B (zh) * 2019-11-19 2024-05-14 中盈优创资讯科技有限公司 信息同步方法及装置
CN111339039A (zh) * 2020-02-21 2020-06-26 京东数字科技控股有限公司 文件的比较方法和装置、存储介质、电子装置
CN113760884B (zh) * 2020-08-06 2024-12-03 北京沃东天骏信息技术有限公司 一种数据比对方法和装置
CN113051882B (zh) * 2021-04-23 2025-01-14 中国工商银行股份有限公司 数据差异对比方法、装置、介质和产品
CN115544986A (zh) * 2022-08-23 2022-12-30 中船黄埔文冲船舶有限公司 一种两个版本电缆册对比排序的方法
CN116303646A (zh) * 2023-03-17 2023-06-23 平安银行股份有限公司 一种跨数据库的数据比对方法、装置、设备及存储介质
CN116205542B (zh) * 2023-04-28 2023-08-04 菲特(天津)检测技术有限公司 一种基于数据对比的质量管理系统、方法、设备及介质
CN116991871A (zh) * 2023-07-31 2023-11-03 广州品唯软件有限公司 数据对比方法、装置、存储介质及计算机设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064968A (zh) * 2012-12-31 2013-04-24 中国电子科技集团公司第十五研究所 一种基于缓存的标准化数据打包方法
US8473519B1 (en) * 2008-02-25 2013-06-25 Cisco Technology, Inc. Unified communication audit tool
CN103995854A (zh) * 2014-05-13 2014-08-20 大唐移动通信设备有限公司 一种设备跨版本升级方法和装置
CN104268291A (zh) * 2014-10-23 2015-01-07 税友软件集团股份有限公司 一种数据一致性处理方法和系统
CN105989089A (zh) * 2015-02-12 2016-10-05 阿里巴巴集团控股有限公司 一种数据对比方法及装置
CN106503268A (zh) * 2016-12-07 2017-03-15 广东神马搜索科技有限公司 数据对比方法、装置和系统
CN107688618A (zh) * 2017-08-08 2018-02-13 平安科技(深圳)有限公司 数据对比方法、装置、计算机设备和存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186556B (zh) * 2011-12-28 2016-09-07 北京百度网讯科技有限公司 得到和搜索结构化语义知识的方法及对应装置
CN103942143B (zh) * 2014-04-09 2017-03-15 烽火通信科技股份有限公司 一种基于版本库比较的PC‑Lint代码检查结果筛选方法
CN106599300B (zh) * 2016-12-28 2020-06-30 中国建设银行股份有限公司 一种分布式系统数据库结构对比方法和装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8473519B1 (en) * 2008-02-25 2013-06-25 Cisco Technology, Inc. Unified communication audit tool
CN103064968A (zh) * 2012-12-31 2013-04-24 中国电子科技集团公司第十五研究所 一种基于缓存的标准化数据打包方法
CN103995854A (zh) * 2014-05-13 2014-08-20 大唐移动通信设备有限公司 一种设备跨版本升级方法和装置
CN104268291A (zh) * 2014-10-23 2015-01-07 税友软件集团股份有限公司 一种数据一致性处理方法和系统
CN105989089A (zh) * 2015-02-12 2016-10-05 阿里巴巴集团控股有限公司 一种数据对比方法及装置
CN106503268A (zh) * 2016-12-07 2017-03-15 广东神马搜索科技有限公司 数据对比方法、装置和系统
CN107688618A (zh) * 2017-08-08 2018-02-13 平安科技(深圳)有限公司 数据对比方法、装置、计算机设备和存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11379419B2 (en) * 2019-11-29 2022-07-05 Sap Se Autonomous intelligent data pipeline comparator

Also Published As

Publication number Publication date
CN107688618B (zh) 2019-03-12
CN107688618A (zh) 2018-02-13

Similar Documents

Publication Publication Date Title
WO2019029155A1 (zh) 数据对比方法、装置、计算机设备和存储介质
CN112148509A (zh) 数据处理方法、装置、服务器及计算机可读存储介质
CN107729227B (zh) 应用程序测试范围确定方法、系统、服务器和存储介质
WO2020000706A1 (zh) 基于数据库比对的接口测试方法、系统、设备和存储介质
WO2019056494A1 (zh) 图表生成方法、装置、计算机设备和存储介质
CN113608955B (zh) 一种日志记录方法、装置、设备及存储介质
WO2021217846A1 (zh) 接口数据处理方法、装置、计算机设备和存储介质
CN107729251A (zh) 测试用例管理方法及装置
CN108563694A (zh) 对逻辑删除的sql执行方法、装置、计算机设备和存储介质
WO2019153514A1 (zh) 业务系统动态生成方法、装置、计算机设备及存储介质
CN111177113A (zh) 数据迁移方法、装置、计算机设备和存储介质
CN106649242A (zh) 一种报表的生成方法及系统
CN112817866A (zh) 录制回放方法、装置、系统、计算机设备以及存储介质
CN108536467A (zh) 代码的定位处理方法、装置、终端设备及存储介质
CN113761040A (zh) 数据库与应用程序双向映射方法、设备、介质及程序产品
CN114661806B (zh) 设计数据的处理方法、装置、设备及介质
CN113238750A (zh) 一种病例表单设计器及目标表单界面生成方法
CN114385221A (zh) 一种版本管理方法、装置及电子设备
CN108399125A (zh) 自动化测试方法、装置、计算机设备和存储介质
CN107506299B (zh) 一种代码分析方法及终端设备
CN119293039A (zh) 一种仿真数据采集存储方法、系统、服务器及介质
CN110119351B (zh) 一种测试用例执行方法及装置
CN105740131B (zh) 软件用户行为回退处理方法及装置
US8302045B2 (en) Electronic device and method for inspecting electrical rules of circuit boards
HK1250266B (zh) 数据对比方法、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 05.08.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18843130

Country of ref document: EP

Kind code of ref document: A1