Database table comparison method and device, server and storage medium

By comparing the field, type and primary key information of the database table, the problems of low efficiency and high labor cost of comparison of a large number of database tables are solved, and efficient and accurate database table comparison is achieved.

CN119669231APending Publication Date: 2025-03-21CCB FINTECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411863677.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, when a large number of database tables are generated in different working environments, a large number of database tables are manually compared and processed, making the database table comparison less efficient and labor cost is increased.

Method used

Provide a database table comparison method. By obtaining any database table in the pre-created database array, it is judged as the source table and the target table, comparing field information, type information and primary key information, recording the comparison results to the record report, and outputting the report.

Benefits of technology

It improves the efficiency of database table comparison, reduces labor costs, avoids human comparison errors, and improves the accuracy of comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669231A_ABST
    Figure CN119669231A_ABST
Patent Text Reader

Abstract

The invention provides a database table comparison method and device, a server and a storage medium, and relates to the technical field of data processing.The method comprises the steps that any database table in a pre-created database array is obtained; if it is judged that the database table is a source table and a target table, field information of the source table is compared with field information in the target table to obtain a corresponding field comparison result, and the field information at least comprises field names; moreover, comparing the type information of the source table with the type information in the target table to obtain a corresponding type comparison result; moreover, comparing the primary key information of the source table with the primary key information in the target table to obtain a corresponding primary key comparison result; recording the field comparison result, the type comparison result and the primary key comparison result to corresponding record reports; and the record report is output according to the preset mode, so that the database table comparison efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a database table comparison method, apparatus, server, and storage medium. Background Technology

[0002] A database table is a data structure used to organize and store data. It consists of rows and columns, similar to a spreadsheet or two-dimensional table. When developing a work item, multiple different work environments are needed, each with different purposes, requiring different database tables. For the work item to function properly, it is necessary to identify the differences between the different database tables to alert operators to any corresponding issues.

[0003] In existing technologies, traditional database table comparison methods require operators to retrieve and compare database tables from different work environments after a certain period of operation to determine the differences between the database tables, thereby identifying the corresponding problems for maintenance of the work item.

[0004] However, in existing technologies, when a large number of database tables are generated in different working environments, manually comparing these tables results in low efficiency and increased labor costs. Summary of the Invention

[0005] This application provides a database table comparison method, apparatus, server, and storage medium to solve the problem that when a large number of database tables are generated in different operating environments, manually comparing these tables results in low efficiency and increased labor costs.

[0006] Firstly, this application provides a database table comparison method, applied to a server, including:

[0007] Obtain any database table from a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table;

[0008] Determine whether the database table is a source table or a target table;

[0009] If the database tables are determined to be a source table and a target table, then the field information of the source table and the field information of the target table are compared to obtain the corresponding field comparison results, wherein the field information includes at least the field name; and,

[0010] The type information in the source table and the type information in the target table are compared to obtain the corresponding type comparison results; and,

[0011] The primary key information of the source table and the primary key information of the target table are compared to obtain the corresponding primary key comparison results;

[0012] Record the field comparison results, the type comparison results, and the primary key comparison results to the corresponding record report;

[0013] The record report is output according to the preset method.

[0014] In one possible design, the creation process of the database array includes: initializing a preset database and connecting to the preset database to obtain information data from the preset database, wherein the information data of the preset database includes multiple types of information data; creating multiple corresponding database tables based on the multiple types of information data; sorting the multiple database tables according to preset conditions to obtain sorted multiple database tables; and integrating the sorted multiple database tables into a database array.

[0015] In one possible design, the preset database includes a source database and a target database; correspondingly, the initialization of the preset database and connection to the preset database to obtain information data from the preset database, wherein the information data from the preset database includes multiple types of information data, including: initializing the source database and the target database, and connecting to the source database and the target database to obtain information data from the source database and the target database, wherein the information data from the source database includes multiple types of source information data, and the information data from the target database includes corresponding multiple types of target information data; correspondingly, the creation of multiple database tables based on the multiple types of information data includes: from multiple... The process involves: acquiring any source information data from the source information data and acquiring the corresponding target information data from the multiple target information data; determining whether the source information data exists and whether the target information data exists; if the source information data exists and the target information data does not exist, creating a source table and designating it as a database table; if the source information data does not exist and the target information data exists, creating a target table and designating it as a database table; if both the source information data and the target information data exist, creating both a source table and a target table and designating them as database tables; and iterating through the remaining multiple source information data and corresponding multiple target information data to determine the corresponding multiple database tables.

[0016] In one possible design, the field information includes fields and field names; correspondingly, if the database table is determined to be a source table and a target table, the field information of the source table and the field information of the target table are compared to obtain corresponding field comparison results. The field information includes at least field names, including: if the database table is determined to be a source table and a target table, determining whether the source table contains a first field to obtain a first determination result; and determining whether the target table contains a second field to obtain a second determination result; if the first determination result is that the source table contains a first field, and the second determination result is that the target table contains a second field, then the first field of the source table and the second field of the target table are compared to obtain a first field comparison result; and the field names of the source table and the field names of the target table are compared to obtain a second field comparison result.

[0017] In one possible design, the type information includes data type and type length; correspondingly, comparing the type information of the source table and the type information of the target table to obtain a corresponding type comparison result includes: if the second field comparison result shows that the field name of the source table and the field name of the target table are the same, then the data type of the source table and the data type of the target table are further compared to obtain a first type comparison result; and the type length of the source table and the type length of the target table are further compared to obtain a second type comparison result.

[0018] In one possible design, the primary key information includes a primary key name and a primary key field; correspondingly, comparing the primary key information of the source table and the primary key information of the target table to obtain a corresponding primary key comparison result includes: comparing the primary key name of the source table and the primary key name of the target table to obtain a first primary key comparison result; and comparing the primary key field of the source table and the primary key field of the target table to obtain a second primary key comparison result.

[0019] In one possible design, recording the field comparison result, the type comparison result, and the primary key comparison result to the corresponding record report includes: recording the first judgment result, the second judgment result, the first field comparison result, and the second field comparison result to a first record report; recording the first type comparison result and the second type comparison result to a second record report; and recording the first primary key comparison result and the second primary key comparison result to a third record report. Correspondingly, outputting the record report according to a preset method includes: outputting the first record report, the second record report, and the third record report according to a preset method.

[0020] In one possible design, after determining whether the database table is a source table and a target table, the method further includes: if the database table is a source table, then recording the source table to the fourth record report; or, if the database table is a target table, then recording the target table to the fourth record report; correspondingly, the step of outputting the record report according to a preset method includes: outputting the fourth record report according to a preset method.

[0021] Secondly, this application provides a database table comparison device, applied to a server, comprising:

[0022] The acquisition module is used to acquire any database table in a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table;

[0023] The judgment module is used to determine whether the database table is a source table or a target table;

[0024] The first comparison module is used to compare the field information of the source table and the field information of the target table if the database table is determined to be a source table and a target table, in order to obtain the corresponding field comparison result, wherein the field information includes at least the field name; and,

[0025] The second comparison module is used to compare the type information of the source table and the type information of the target table to obtain the corresponding type comparison result; and,

[0026] The third comparison module is used to compare the primary key information of the source table with the primary key information of the target table to obtain the corresponding primary key comparison results;

[0027] The first recording module is used to record the field comparison results, the type comparison results, and the primary key comparison results to the corresponding record report;

[0028] The output module is used to output the record report according to a preset method.

[0029] Thirdly, this application provides a server, including: at least one processor and a memory;

[0030] The memory stores computer-executed instructions;

[0031] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the database table comparison method as described in the first aspect and various possible designs of the first aspect.

[0032] Fourthly, this application provides a computer storage medium storing computer execution instructions, which, when executed by a processor, implement the database table comparison method described in the first aspect and various possible designs of the first aspect.

[0033] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the database table comparison method described in the first aspect and various possible designs of the first aspect.

[0034] The database table comparison method, apparatus, server, and storage medium provided in this application obtain any database table from a pre-created database array; if the database table is determined to be a source table and a target table, the field information of the source table is compared with the field information of the target table to obtain the corresponding field comparison results, wherein the field information includes at least the field name; furthermore, the type information of the source table is compared with the type information of the target table to obtain the corresponding type comparison results; and furthermore, the primary key information of the source table is compared with the primary key information of the target table to obtain the corresponding primary key comparison results; the field comparison results, type comparison results, and primary key comparison results are recorded to the corresponding record report; and the record report is output according to a preset method, thereby improving the efficiency of database table comparison and reducing labor costs. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a schematic diagram illustrating an application scenario of the database table comparison method provided in the embodiments of this application;

[0037] Figure 2 Flowchart of the database table comparison method provided in the embodiments of this application Figure 1 ;

[0038] Figure 3 Flowchart of the database table comparison method provided in the embodiments of this application Figure 2 ;

[0039] Figure 4 This is a schematic diagram of the structure of the database table comparison device provided in the embodiments of this application;

[0040] Figure 5 This is a schematic diagram of the hardware structure of the server provided in an embodiment of this application. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0042] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0043] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0044] A database table is an object used to store data in a database. It is a structured collection of data and forms the foundation of the entire database system. It organizes and stores data, consisting of rows and columns, similar to a spreadsheet or two-dimensional table. When developing a work item, multiple different operating environments may be needed, each with different purposes and requiring different database tables. For the work item to function properly, it is necessary to identify the differences between these database tables to alert operators to any issues. In existing technologies, traditional database table comparison methods require operators to retrieve and compare database tables from different operating environments after a certain period of work item operation to determine the differences and identify corresponding problems for work item maintenance. However, existing technologies, when generating a large number of database tables across different operating environments, require manual comparison of numerous tables, resulting in low efficiency and increased labor costs.

[0045] To address the aforementioned technical problems, this application proposes the following technical concept: Considering a pre-created database array, when any one of the database tables is used as the source table and the target table, the inventors compare the field information, type information, and primary key information of the source table and the target table to obtain the field comparison results, type comparison results, and primary key comparison results; the comparison results are recorded in the corresponding record report and the record report is output, thereby improving the efficiency of database table comparison and reducing labor costs.

[0046] Figure 1This is a schematic diagram illustrating an application scenario of the database table comparison method provided in the embodiments of this application.

[0047] like Figure 1 As shown, the scenario includes a display terminal 101 and a server 102.

[0048] The display terminal 101 can be a display screen or a personal computer or other terminal.

[0049] Server 102 can be a standalone server or a cluster of multiple servers.

[0050] Server 102 retrieves any database table from the pre-created database array. If the database table is determined to be a source table or a target table, the field information of the source table is compared with the field information of the target table to obtain the corresponding field comparison results, wherein the field information includes at least the field name. Furthermore, the type information of the source table is compared with the type information of the target table to obtain the corresponding type comparison results. Additionally, the primary key information of the source table is compared with the primary key information of the target table to obtain the corresponding primary key comparison results. The field comparison results, type comparison results, and primary key comparison results are recorded to the corresponding record report. The record report is output to display terminal 101 according to a preset method. The following detailed embodiment provides a further explanation.

[0051] Figure 2 Flowchart of the database table comparison method provided in the embodiments of this application Figure 1 The execution entity in this embodiment can be Figure 1 The server in the illustrated embodiment is not specifically limited in this embodiment. Figure 2 As shown, the method includes:

[0052] S201: Retrieve any database table from a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table.

[0053] In this embodiment, the source table is the raw data that has not been filtered or processed, preserving the integrity and authenticity of the data; the target table is a target data table set in the data analysis and processing, representing the target result that needs to be achieved to complete a certain task.

[0054] In this embodiment, the process of creating the database array in step S201 specifically includes:

[0055] S2011: Initialize the preset database and connect to the preset database to obtain information data from the preset database, wherein the information data of the preset database includes various types of information data.

[0056] For example, various types of information data can include student information data, teacher information data, dataset administrator information data, etc.

[0057] In this embodiment, the preset database includes a source database and a target database; correspondingly, step S2011 specifically includes:

[0058] Initialize the source database and target database, and connect to the source database and target database to obtain information data from the source database and the target database. The information data in the source database includes various types of source information data, and the information data in the target database contains various types of target information data.

[0059] For example, the multiple source information data can be student information data, teacher information dataset administrator information data in the source database; the multiple target information data can be student information data, teacher information dataset administrator registration data in the target database.

[0060] S2012: Create multiple database tables based on various information data.

[0061] For example, taking administrator registration data as an example, the corresponding database table includes details such as name, phone number, job title, account and password.

[0062] Specifically, step S2012 includes:

[0063] S20121: Obtain any source information data from multiple source information data, and obtain the corresponding target information data from multiple target information data.

[0064] S20122: Determine whether the source information data exists, and determine whether the target information data exists.

[0065] S20123: If the source information data exists and the target information data does not exist, then create the source table and designate it as a database table.

[0066] S20124: If the source information data does not exist, but the target information data does exist, then create the target table and designate the target table as a database table.

[0067] S20125: If both source and target information data exist, then create source and target tables and designate them as database tables.

[0068] S20126: Traverse the remaining multiple source information data and corresponding multiple target information data to determine the corresponding multiple database tables.

[0069] S2013: Sort multiple database tables according to preset conditions to obtain sorted database tables.

[0070] In this embodiment, the preset condition can be a name initial alphabetical sorting rule.

[0071] S2014: Combine multiple sorted database tables into a database array.

[0072] In this embodiment, an array is a data structure used to store data elements of the same type.

[0073] S202: Determine whether the database table is a source table or a target table.

[0074] S203: If the database tables are determined to be a source table and a target table, then the field information of the source table and the field information of the target table are compared to obtain the corresponding field comparison results, wherein the field information includes at least the field name; and,

[0075] In this embodiment, the field information includes the field and the field name; correspondingly, step S203 specifically includes:

[0076] S2031: If the database table is determined to be both a source table and a target table, then determine whether the source table contains the first field to obtain the first determination result; and,

[0077] In this embodiment, fields are the basic components of a database table. Each table consists of several fields, and each field represents a specific type of data.

[0078] S2032: Determine whether the target table contains the second field to obtain the second judgment result.

[0079] S2033: If the first judgment result is that the source table contains the first field, and the second judgment result is that the target table contains the second field, then the first field of the source table and the second field of the target table are compared to obtain the comparison result of the first field; and,

[0080] S2034: Compare the field names of the source table with the field names of the target table to obtain the comparison result of the second field.

[0081] In this embodiment, the field name refers to the name of each column in the database table, which is used to identify and reference specific data in the table.

[0082] S204: Compare the type information in the source table with the type information in the target table to obtain the corresponding type comparison result; and,

[0083] In this embodiment, the type information includes data type and type length; correspondingly, step S204 specifically includes:

[0084] S2041: If the comparison result of the second field shows that the field name in the source table is the same as the field name in the target table, then continue to compare the data types of the source table and the target table to obtain the first type comparison result; and,

[0085] In this embodiment, the data types of the database tables mainly include numeric types, date and time types, and string types.

[0086] S2042: Continue to compare the type length of the source table and the type length of the target table to obtain the second type comparison result.

[0087] In this embodiment, type length refers to the storage limit of a specific data type in a database table.

[0088] S205: Compare the primary key information of the source table with the primary key information of the target table to obtain the corresponding primary key comparison results.

[0089] In this embodiment, the primary key information includes the primary key name and the primary key field; correspondingly, step S205 specifically includes:

[0090] S2051: Compare the primary key names of the source table and the target table to obtain the first primary key comparison result; and,

[0091] In this embodiment, the primary key name is usually referred to as the "primary key". The primary key is a combination of one or more columns in a database table used to uniquely identify each row of records.

[0092] S2052: Compare the primary key fields of the source table and the target table to obtain the second primary key comparison result.

[0093] In this embodiment, the primary key field of a database table refers to a combination of one or more fields whose values ​​can uniquely identify each record in the table.

[0094] S206: Record the field comparison results, type comparison results, and primary key comparison results to the corresponding record report.

[0095] In this embodiment, the record report is determined by a preset report model, which is used to determine the format of the report.

[0096] Specifically, step S206 includes: recording the first judgment result, the second judgment result, the first field comparison result, and the second field comparison result to the first record report; recording the first type comparison result and the second type comparison result to the second record report; and recording the first primary key comparison result and the second primary key comparison result to the third record report.

[0097] S207: Output record reports according to the preset method.

[0098] In this embodiment, the preset method can be any one of printing, email, and pop-up window, or other methods.

[0099] Specifically, step S207 includes: outputting a first record report, a second record report, and a third record report according to a preset method.

[0100] For example, the first record report, the second record report, and the third record report are output in a printing manner.

[0101] In summary, the database table comparison method provided in this embodiment obtains any database table from a pre-created database array; if the database table is determined to be a source table or a target table, the field information of the source table is compared with the field information of the target table to obtain the corresponding field comparison results, wherein the field information includes at least the field name; furthermore, the type information of the source table is compared with the type information of the target table to obtain the corresponding type comparison results; and furthermore, the primary key information of the source table is compared with the primary key information of the target table to obtain the corresponding primary key comparison results; the field comparison results, type comparison results, and primary key comparison results are recorded to the corresponding record report; and the record report is output according to a preset method, which improves the efficiency of database table comparison and reduces labor costs.

[0102] In addition, the database table comparison method provided in this embodiment automatically compares the database tables, avoiding errors caused by manual comparison and thus improving the accuracy of database table comparison.

[0103] In addition, the database table comparison method provided in this embodiment records the first judgment result, the second judgment result, the first field comparison result, and the second field comparison result to the first record report; records the first type comparison result and the second type comparison result to the second record report; and records the first primary key comparison result and the second primary key comparison result to the third record report. By displaying different comparison results through different record reports, the comparison results of the database tables are made clearer, more intuitive, and easier to understand.

[0104] Figure 3 Flowchart of the database table comparison method provided in the embodiments of this application Figure 2 In the embodiments of this application, in Figure 2 Based on the provided embodiments, a detailed description is given of the recording method for database tables after step S202 that are either source tables or target tables. For example... Figure 3 As shown, the method includes:

[0105] S301: Retrieve any database table from a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table.

[0106] In this embodiment, the discussion of the source table and the target table has been explained in detail in step S201, and will not be repeated here.

[0107] S302: If the database table is the source table, then record the source table in the fourth record report; or,

[0108] S303: If the database table is the target table, then record the target table in the fourth record report.

[0109] S304: Output the fourth record report according to the preset method.

[0110] In this embodiment, the discussion of the preset method has been explained in detail in step S207, and will not be repeated here.

[0111] In summary, the database table comparison method provided in this embodiment obtains any database table from a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table; if the database table is a source table, the source table is recorded in the fourth record report; or, if the database table is a target table, the target table is recorded in the fourth record report; and the fourth record report is output according to a preset method. By directly generating a record report from a single source table or target table, the efficiency of database table comparison is improved and the labor cost is reduced.

[0112] It should be noted that the database table comparison method provided in this embodiment can use an artificial intelligence engine with built-in AI algorithms to compare database tables through technologies such as resource partitioning algorithms, rule engines, and logistic regression.

[0113] Figure 4 This is a schematic diagram of the database table comparison device provided in an embodiment of this application. Figure 4 As shown, the database table comparison device includes: an acquisition module 401, a judgment module 402, a first comparison module 403, a second comparison module 404, a third comparison module 405, a first record module 406, and an output module 407.

[0114] The acquisition module 401 is used to acquire any database table in a pre-created database array, wherein the pre-created database array includes multiple database tables, each of which is a source table and / or a target table;

[0115] The judgment module 402 is used to determine whether the database table is a source table or a target table;

[0116] The first comparison module 403 is used to compare the field information of the source table and the field information of the target table if the database table is determined to be a source table and a target table, so as to obtain the corresponding field comparison result, wherein the field information includes at least the field name; and,

[0117] The second comparison module 404 is used to compare the type information of the source table and the type information of the target table to obtain the corresponding type comparison result; and,

[0118] The third comparison module 405 is used to compare the primary key information of the source table and the primary key information of the target table to obtain the corresponding primary key comparison result.

[0119] The first recording module 406 is used to record the field comparison result, the type comparison result and the primary key comparison result to the corresponding record report;

[0120] Output module 407 is used to output the record report according to a preset method.

[0121] In one possible implementation, the device further includes:

[0122] The connection module 408 is used to initialize the preset database and connect to the preset database to obtain information data from the preset database, wherein the information data of the preset database includes various types of information data;

[0123] The creation module 409 is used to create multiple corresponding database tables based on the various information data.

[0124] The sorting module 410 is used to sort the multiple database tables according to preset conditions to obtain sorted multiple database tables.

[0125] Integration module 411 is used to integrate the sorted multiple database tables into a database array.

[0126] In one possible implementation, the preset database includes a source database and a target database; correspondingly, the connection module 408 is specifically configured to: initialize the source database and the target database, and connect to the source database and the target database to obtain information data from the source database and the target database, wherein the information data from the source database includes multiple types of source information data, and the information data from the target database contains corresponding multiple types of target information data; correspondingly, the creation module 409 specifically includes:

[0127] The acquisition unit 4091 is used to acquire any source information data from multiple source information data, and to acquire the corresponding target information data from the multiple target information data;

[0128] The judgment unit 4092 is used to determine whether the source information data exists and whether the target information data exists.

[0129] The first determining unit 4093 is used to create a source table and determine the source table as a database table if the source information data exists and the target information data does not exist.

[0130] The second determining unit 4094 is used to create a target table and determine the target table as a database table if the source information data does not exist and the target information data exists.

[0131] The third determining unit 4095 is used to create a source table and a target table if the source information data exists and the target information data exists, and to determine the source table and the target table as database tables.

[0132] Traversal unit 4096 is used to traverse the remaining multiple source information data and corresponding multiple target information data to determine the corresponding multiple database tables.

[0133] In one possible implementation, the field information includes fields and field names; correspondingly, the first comparison module 403 specifically includes:

[0134] The first judgment unit 4031 is used to determine whether the source table contains a first field if the database table is determined to be both a source table and a target table, so as to obtain a first judgment result; and,

[0135] The first judgment unit 4032 is used to determine whether the target table contains a second field in order to obtain a second judgment result;

[0136] The first comparison unit 4033 is configured to compare the first field of the source table and the second field of the target table if the first judgment result indicates that the source table contains a first field, and the second judgment result indicates that the target table contains a second field, to obtain a comparison result for the first field; and,

[0137] The second comparison unit 4034 is used to compare the field names of the source table and the field names of the target table to obtain a second field comparison result.

[0138] In one possible implementation, the type information includes data type and type length; correspondingly, the second comparison module 404 specifically includes:

[0139] The first comparison unit 4041 is configured to, if the second field comparison result indicates that the field names of the source table and the target table are the same, continue to compare the data types of the source table and the target table to obtain a first type comparison result; and,

[0140] The second comparison unit 4042 is used to continue comparing the type length of the source table and the type length of the target table to obtain a second type comparison result.

[0141] In one possible implementation, the primary key information includes a primary key name and a primary key field; correspondingly, the third comparison module 405 includes:

[0142] The first comparison unit 4051 is used to compare the primary key name of the source table and the primary key name of the target table to obtain a first primary key comparison result; and,

[0143] The second comparison unit 4052 is used to compare the primary key field of the source table and the primary key field of the target table to obtain a second primary key comparison result.

[0144] In one possible implementation, the first recording module 406 is specifically used to: record the first judgment result, the second judgment result, the first field comparison result, and the second field comparison result to a first recording report; record the first type comparison result and the second type comparison result to a second recording report; and record the first primary key comparison result and the second primary key comparison result to a third recording report. Correspondingly, the output module 407 is specifically used to: output the first recording report, the second recording report, and the third recording report according to a preset method.

[0145] In one possible implementation, the device further includes:

[0146] The second recording module 412 is used to record the source table to the fourth recording report if the database table is a source table; or,

[0147] The third recording module 413 is used to record the target table to the fourth recording report if the database table is the target table;

[0148] Accordingly, the output module 407 is specifically used to: output the fourth record report according to a preset method.

[0149] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0150] Figure 5This is a schematic diagram of the hardware structure of the server provided in an embodiment of this application. Figure 5 As shown, the server in this embodiment includes a processor 501 and a memory 502; the memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, causing at least one processor to execute the database table comparison method described above.

[0151] Alternatively, the memory 502 can be either standalone or integrated with the processor 501.

[0152] When the memory 502 is set up independently, the server also includes a bus 503 for connecting the memory 502 and the processor 501.

[0153] This application also provides a computer storage medium storing computer execution instructions. When a processor executes the computer execution instructions, it implements the database table comparison method described above.

[0154] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the database table comparison method described above.

[0155] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0156] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.

[0157] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.

[0158] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.

[0159] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0160] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0161] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0162] The aforementioned storage media can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0163] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0164] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A database table comparison method, characterized in that: Applicable to servers, including: Obtain any database table in a pre-created database array, wherein the pre-created database array includes a plurality of database tables, each of which is a source table and / or a target table; Determine whether the database table is a source table and a target table; If it is determined that the database table is a source table and a target table, the field information of the source table is compared with the field information in the target table to obtain a corresponding field comparison result, wherein the field information at least includes a field name; and Compare the type information in the source table with the type information in the target table to obtain a corresponding type comparison result; and Compare the primary key information in the source table with the primary key information in the target table to obtain a corresponding primary key comparison result; Record the field comparison result, the type comparison result and the primary key comparison result in a corresponding record report; Output the record report in a preset manner.

2. The method according to claim 1, characterized in that The process of creating the database array includes: Initialize a preset database and connect to the preset database to obtain information data of the preset database, wherein the information data of the preset database includes multiple information data; According to the various information data, create corresponding multiple database tables; Sorting the multiple database tables according to preset conditions to obtain multiple sorted database tables; The sorted multiple database tables are integrated into a database array.

3. The method according to claim 2, characterized in that The preset database includes a source database and a target database; Accordingly, the preset database is initialized and connected to the preset database to obtain information data of the preset database, wherein the information data of the preset database includes multiple information data, including: Initializing the source database and the target database, and connecting to the source database and the target database to obtain information data of the source database and information data of the target database, wherein the information data of the source database includes multiple source information data, and the information data of the target database includes corresponding multiple target information data; Accordingly, the creation of multiple corresponding database tables based on the multiple information data includes: Acquire any source information data from a plurality of source information data, and acquire corresponding target information data from the plurality of target information data; Determine whether the source information data exists, and determine whether the target information data exists; If the source information data exists and the target information data does not exist, creating a source table and determining the source table as a database table; If the source information data does not exist, and the target information data exists, then creating a target table, and determining the target table as a database table; If the source information data exists and the target information data exists, then creating a source table and a target table, and determining the source table and the target table as database tables; The remaining multiple source information data and the corresponding multiple target information data are traversed to determine the corresponding multiple database tables.

4. The method according to claim 1, characterized in that: The field information includes the field and the field name; Correspondingly, if it is determined that the database table is a source table and a target table, the field information of the source table is compared with the field information in the target table to obtain a corresponding field comparison result, wherein the field information at least includes a field name, including: If it is determined that the database table is a source table and a target table, then determining whether the source table contains a first field to obtain a first determination result; and, Determining whether the target table contains a second field to obtain a second determination result; If the first judgment result is that the source table contains a first field, and the second judgment result is that the target table contains a second field, then the first field of the source table and the second field of the target table are compared to obtain a first field comparison result; and, The field names of the source table and the field names of the target table are compared to obtain a second field comparison result.

5. The method according to claim 4, characterized in that The type information includes data type and type length; Accordingly, comparing the type information in the source table with the type information in the target table to obtain a corresponding type comparison result includes: If the second field comparison result is that the field name of the source table is the same as the field name of the target table, then continue to compare the data type of the source table with the data type of the target table to obtain a first type comparison result; and, Continue to compare the type length of the source table with the type length of the target table to obtain a second type comparison result.

6. The method according to claim 5, characterized in that The primary key information includes the primary key name and the primary key field; Accordingly, comparing the primary key information in the source table with the primary key information in the target table to obtain a corresponding primary key comparison result includes: Comparing the primary key name of the source table with the primary key name of the target table to obtain a first primary key comparison result; and, The primary key field of the source table is compared with the primary key field of the target table to obtain a second primary key comparison result.

7. The method according to claim 6, characterized in that The recording of the field comparison result, the type comparison result and the primary key comparison result into a corresponding record report includes: Record the first judgment result, the second judgment result, the first field comparison result, and the second field comparison result in a first record report; record the first type comparison result and the second type comparison result in a second record report; record the first primary key comparison result and the second primary key comparison result in a third record report; Accordingly, the outputting of the record report in a preset manner includes: The first record report, the second record report and the third record report are outputted in a preset manner.

8. The method according to any one of claims 1 to 7, characterized in that: After determining whether the database table is a source table and a target table, the method further includes: If the database table is a source table, the source table is recorded in a fourth record table; or, If the database table is a target table, the target table is recorded in a fourth record report; Accordingly, the outputting of the record report in a preset manner includes: The fourth record report is outputted in a preset manner.

9. A database table comparison device, characterized in that: Applicable to servers, including: An acquisition module, used for acquiring any database table in a pre-created database array, wherein the pre-created database array includes a plurality of database tables, each of which is a source table and / or a target table; A judgment module, used to judge whether the database table is a source table and a target table; a first comparison module, for comparing field information of the source table with field information in the target table to obtain corresponding field comparison results if it is determined that the database table is a source table and a target table, wherein the field information at least includes a field name; and A second comparison module is used to compare the type information in the source table with the type information in the target table to obtain a corresponding type comparison result; and A third comparison module is used to compare the primary key information in the source table with the primary key information in the target table to obtain a corresponding primary key comparison result; A first recording module, used for recording the field comparison result, the type comparison result and the primary key comparison result into a corresponding record report; The output module is used to output the record report in a preset manner.

10. A server, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the database table comparison method according to any one of claims 1 to 8.

11. A computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, and when the processor executes the computer executable instructions, the database table comparison method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the database table comparison method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Synchronous configuration method and device for configuration management data, equipment and storage medium

    CN120768908A