Database model comparison method and device, electronic equipment and computer program product

By automatically comparing database models, the problem of database model out-of-synchronization is solved, the troubleshooting process is simplified, the cloud migration speed and user experience are improved, and the automatic comparison and consistency mechanism of database models are realized.

CN118568073APending Publication Date: 2024-08-30CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410620839.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing technology cannot effectively automatically compare database models, resulting in database model out-of-synchronization problems in enterprise IT systems, affecting cloud migration progress and application services, and requiring long troubleshooting times.

Method used

By responding to the model comparison instructions, the table to be compared and the standard table are obtained from the target database and the standard database, the corresponding relationship is determined based on the table name, and the metadata information is compared, and the basic information of the target database and the standard database is automatically obtained and compared. Table model to realize automatic comparison of database models.

Benefits of technology

It realizes automatic comparison of database models, simplifies the troubleshooting process, shortens troubleshooting time, improves cloud migration speed and user experience, reduces the work pressure of operation and maintenance personnel, and provides a consistency mechanism to ensure that each node and environment synchronous execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568073A
    Figure CN118568073A
Patent Text Reader

Abstract

The invention discloses a database model comparison method and device, electronic equipment and a computer program product. The method comprises the steps that in response to a model comparison instruction, at least one to-be-compared table is obtained from a target database, at least one standard table is obtained from a standard database, a target base table model used for describing the to-be-compared table is stored in the target database, and a standard base table model used for describing the standard table is pre-stored in the standard database; the corresponding relation between the to-be-compared table and the standard table is determined based on the table name, and the to-be-compared table and the standard table with the corresponding relation have the same table name; metadata information comparison is carried out on the to-be-compared table and the standard table which have the corresponding relation; and determining a comparison result based on the to-be-compared tables which do not have the corresponding relationship and the to-be-compared tables which have differences with the metadata information. The technical problem that database models cannot be automatically compared is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of databases, and in particular to a database model comparison method, device, electronic equipment and computer program product. Background Art

[0002] With the continuous development of enterprise IT systems, the frequency of business updates and the amount of data are growing, and the frequency of database DDL operations is also increasing. For database systems, modifying model DDL statements is an atomic operation, but due to network and node load issues, some nodes and shards fail to execute or are not executed. In distributed databases (MySQL), there is currently no perfect consistency mechanism to ensure the successful synchronization of each node / environment.

[0003] During the application migration to the cloud, there are different environments such as development testing, simulation testing, integration testing, and production. Due to differences in the online process between the environments, there are problems with the database model being out of sync. Previously, operation and maintenance personnel manually compared or manually checked and troubleshooted after a failure occurred, which was slow. For systems that have not been put into production, the progress of cloud migration is affected; for systems that have been put into production, the troubleshooting time is too long, affecting the external services of the application.

[0004] Currently, no effective solution has been proposed for the above-mentioned problem of being unable to automatically compare database models. Summary of the invention

[0005] The embodiments of the present invention provide a database model comparison method, device, electronic device and computer program product to at least solve the technical problem that the database model cannot be automatically compared.

[0006] According to one aspect of an embodiment of the present invention, a database model comparison method is provided, comprising: in response to a model comparison instruction, obtaining at least one table to be compared from a target database, and obtaining at least one standard table from a standard database, wherein a target base table model is stored in the target database, and the target base table model is used to describe the table to be compared in the target database, and a standard database for model comparison is stored in the target database, and a standard base table model is pre-stored in the standard database, and the standard base table model is used to describe the standard table in the standard database; determining a correspondence between the table to be compared and the standard table based on a table name, wherein the table to be compared with the standard table having the correspondence has the same table name; performing a metadata information comparison between the table to be compared with the standard table having the correspondence, wherein the metadata information is used to describe the features of the table to be compared or the standard table; and determining a comparison result based on the table to be compared without the correspondence and the table to be compared with which the metadata information is different.

[0007] Optionally, before obtaining at least one to-be-compared table from the target database and obtaining at least one standard table from the standard database in response to a model comparison instruction, the method further includes: identifying an instruction type of the model comparison instruction, wherein the instruction type includes: a first comparison instruction instructing to perform a model comparison on at least one target database in the same environment, and a second comparison instruction instructing to perform a model comparison on at least one target database in a different environment; when the model comparison instruction is the first comparison instruction, determining a target standard database in the same environment, wherein the target database belonging to the same environment is a same environment database, and the target standard database is a standard database used to perform a model comparison on the same environment database.

[0008] Optionally, after identifying the instruction type of the model comparison instruction, the method further includes: when the model comparison instruction is the second comparison instruction, determining the different environments, wherein the different environments include at least: a first target environment and a second target environment, the target database belonging to the first target environment is the first target database, and determining the target database belonging to the second target environment is the second target database; determining a first standard database belonging to the first target environment, wherein the first standard database is a standard database used for model comparison of the first target database; determining a second standard database belonging to the second target environment, wherein the second standard database is a standard database used for model comparison of the second target database.

[0009] Optionally, the method also includes: determining a preset configuration library corresponding to the target database; searching the preset configuration library for a storage path of target database information of the target database in the distributed application coordination service zookeeper; obtaining the target database information according to the storage path, wherein the target database information includes at least: the standard database corresponding to the target database, and instance setting information in the target database and the standard database, the instance setting information in the target database is used to determine the target base table model, and the instance setting information in the standard database is used to determine the standard base table model.

[0010] Optionally, determining the preset configuration library corresponding to the target database includes: when there are multiple target databases, identifying the target environment to which each target database belongs; when all of the multiple target databases belong to the target environment, determining the preset configuration library belonging to the target environment; when the multiple target databases belong to different target environments, respectively determining the preset configuration library belonging to each target environment.

[0011] Optionally, determining the correspondence between the table to be compared and the standard table based on the table name includes: obtaining the table name of each table to be compared in the target database one by one as the table to be compared name; comparing the table name to be compared with the table name of each standard table in the standard database; when there is a standard table with the same name as the table to be compared in the standard database, determining that the standard table with the same name as the table to be compared has the correspondence; when there is no standard table with the same name as the table to be compared in the standard database, determining that the table to be compared corresponding to the table name does not have the correspondence.

[0012] Optionally, obtaining the table name of each table to be compared in the target database one by one as the name of the table to be compared includes: when there are multiple target databases and the multiple target databases belong to the same environment, treating the tables to be compared with the same table name in the multiple target databases as a common table, and treating the tables to be compared with different table names in the multiple target databases as sub-tables within the database; obtaining the table name of the common table or the sub-table within the database one by one as the name of the table to be compared.

[0013] According to another aspect of an embodiment of the present invention, a database model comparison device is also provided, comprising: an acquisition module, for acquiring at least one table to be compared from a target database and at least one standard table from a standard database in response to a model comparison instruction, wherein the target database stores a target base table model, and the target base table model is used to describe the table to be compared in the target database, and the target database has a standard database for model comparison, and the standard database pre-stores a standard base table model, and the standard base table model is used to describe the standard table in the standard database; a first determination module, for determining a correspondence between the table to be compared and the standard table based on a table name, wherein the table to be compared with the standard table having the correspondence has the same table name; a comparison module, for performing metadata information comparison between the table to be compared with the standard table having the correspondence, wherein the metadata information is used to describe the features of the table to be compared or the standard table; and a second determination module, for determining a comparison result based on the table to be compared without the correspondence and the table to be compared with the metadata information.

[0014] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, comprising: a memory and a processor, wherein the processor is configured to run a program stored in the processor, wherein the above-mentioned database model comparison method is executed when the program is run.

[0015] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to perform the steps of the above-mentioned database model comparison method.

[0016] In an embodiment of the present invention, in response to a model comparison instruction, at least one table to be compared is obtained from a target database, and at least one standard table is obtained from a standard database, wherein a target base table model is stored in the target database, and the target base table model is used to describe the table to be compared in the target database, and a standard database for model comparison exists in the target database, and a standard base table model is pre-stored in the standard database, and the standard base table model is used to describe the standard table in the standard database; the correspondence between the table to be compared and the standard table is determined based on the table name, wherein the table to be compared and the standard table with the corresponding relationship have the same table name; The metadata information of the table to be compared is compared with the standard table, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; based on the table to be compared for which there is no corresponding relationship and the table to be compared for which there is a difference in metadata information, the comparison result is determined, and the purpose of comparing the standard base table model in the target database with the standard base table model in the standard database is achieved by automatically acquiring and comparing the table to be compared in the target database and the standard base table model in the standard database, thereby achieving the technical effect of automatically comparing the model of the target database and the standard data, and then solving the technical problem that the database model cannot be automatically compared. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0018] Figure 1 is a flow chart of a database model comparison method according to an embodiment of the present invention;

[0019] Figure 2 is a schematic diagram of a model comparison method in the same environment according to an embodiment of the present invention;

[0020] Figure 3 is a schematic diagram of a model comparison method in different environments according to an embodiment of the present invention;

[0021] Figure 4 is a schematic diagram of a database model comparison device according to an embodiment of the present invention;

[0022] Figure 5 It is a structural block diagram of a computer terminal according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0026] Zookeeper is a centralized service used to maintain configuration information, name, provide distributed synchronization and provide group services. It can be used to store and maintain information such as distributed database nodes, gateways, masters and slaves, and sharding algorithms.

[0027] Standard library: Each distributed database cluster has a standard library for storing library table structures. Management commands related to library table structures are sent to the standard library for execution. It is transparent to applications, and applications do not need to know the existence of the standard library.

[0028] According to an embodiment of the present invention, a database model comparison method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] Figure 1 is a flow chart of a database model comparison method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0030] Step S102, in response to the model comparison instruction, obtaining at least one table to be compared from the target database and obtaining at least one standard table from the standard database, wherein the target database stores a target base table model, the target base table model is used to describe the table to be compared in the target database, the target database has a standard database for model comparison, the standard database pre-stores a standard base table model, the standard base table model is used to describe the standard table in the standard database;

[0031] Step S104, determining the correspondence between the table to be compared and the standard table based on the table names, wherein the table to be compared and the standard table that have a correspondence have the same table name;

[0032] Step S106, comparing metadata information of the table to be compared and the standard table that have a corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table;

[0033] Step S108, determining a comparison result based on the to-be-compared tables for which no corresponding relationship exists and the to-be-compared tables for which metadata information is different.

[0034] In an embodiment of the present invention, in response to a model comparison instruction, at least one table to be compared is obtained from a target database, and at least one standard table is obtained from a standard database, wherein a target base table model is stored in the target database, and the target base table model is used to describe the table to be compared in the target database, and a standard database for model comparison exists in the target database, and a standard base table model is pre-stored in the standard database, and the standard base table model is used to describe the standard table in the standard database; the correspondence between the table to be compared and the standard table is determined based on the table name, wherein the table to be compared and the standard table with the corresponding relationship have the same table name; The metadata information of the table to be compared is compared with the standard table, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; based on the table to be compared for which there is no corresponding relationship and the table to be compared for which there is a difference in metadata information, the comparison result is determined, and the purpose of comparing the standard base table model in the target database with the standard base table model in the standard database is achieved by automatically acquiring and comparing the table to be compared in the target database and the standard base table model in the standard database, thereby achieving the technical effect of automatically comparing the model of the target database and the standard data, and then solving the technical problem that the database model cannot be automatically compared.

[0035] In the above step S102, the model comparison instruction may be a unique identifier of the target database that needs to be compared with the model, input by the user, such as the name of the target database.

[0036] In the above step S102, the target database may be a database in a distributed database system.

[0037] Optionally, a distributed database system may include multiple target databases, wherein the multiple target databases may be in the same environment or in different environments.

[0038] In the above step S102, the target database is a software system for storing and managing data, which can provide data addition, deletion, modification and query operations, and can support data indexing, transaction processing and backup functions. Common databases include relational databases (such as MySQL, Oracle) and non-relational databases (such as MongoDB, Redis), etc.

[0039] In the above step S102, the standard database refers to the library that comes with the programming language or platform, which includes the basic functions and common tools provided by the language itself, such as input and output, string processing, data structure, mathematical operations, etc. The standard library is usually the core part of the language or platform, and developers can directly call the functions and classes provided by the standard library to implement various functions without re-implementing them themselves.

[0040] It should be noted that target databases and standard databases are often used together in actual development. For example, when writing Web applications, developers can use target databases to store user data and application status, and use the network programming functions provided by standard databases to process user requests and responses. By using target databases and standard databases reasonably, developers can implement various applications and systems more efficiently.

[0041] In the above step S102, the base table model is a database design model used to describe the entities in the database and the relationships between them. The base table model usually uses tables and key-value pairs to organize and store data. Each table represents an entity, and each key-value pair represents the attributes of the entity. In the present application, the base table model in the target database is the target base table model, the base table model in the standard database is the standard base table model, the table in the target database is the table to be compared, and the table in the standard database is the standard table.

[0042] Optionally, the target database is compared, that is, the target base table model in the target database is compared with the standard base table model in the target corresponding standard database. The target base table model is compared with the standard base table model. This can be achieved by comparing the table to be compared described by the target base table model with the standard table described by the standard base table model.

[0043] Before determining the correspondence between the table to be compared and the standard table based on the table name in the above step S104, the method further includes: deleting a special standard table that is only used in the standard library.

[0044] In the above step S104, the table to be compared in the target database and the standard table in the standard database both have corresponding table names. If the table names of the table to be compared and the standard table are the same, it means that there is a corresponding relationship between the table to be compared and the standard table, and the detailed information of the table to be compared and the standard table with the corresponding relationship can be further compared; if there is no standard table with the same table name as that of a table to be compared in the standard database, it means that there is no corresponding relationship between the table to be compared.

[0045] In the above step S106, the table to be compared and the standard table use metadata information to describe the organizational structure and attributes of the table. The metadata information can help understand the basic information and usage rules of the table and determine the characteristics of the table.

[0046] In the above step S106, the metadata information at least includes: the number of tables, the table structure (field name, field type, field length, field encoding), the number of indexes, and the index column.

[0047] In the above step S108, the comparison results may display the tables to be compared that do not have a corresponding relationship and the tables to be compared that have different metadata information; and may also display metadata information in the tables to be compared that is different from the corresponding standard tables.

[0048] As an optional embodiment, before obtaining at least one table to be compared from the target database and obtaining at least one standard table from the standard database in response to a model comparison instruction, the method also includes: identifying the instruction type of the model comparison instruction, wherein the instruction type includes: a first comparison instruction instructing to perform a model comparison on at least one target database in the same environment, and a second comparison instruction instructing to perform a model comparison on at least one target database in a different environment; when the model comparison instruction is the first comparison instruction, determining a target standard database in the same environment, wherein the target database belonging to the same environment is a same environment database, and the target standard database is a standard database used to perform a model comparison on the same environment database.

[0049] In the above-mentioned embodiment of the present invention, at least one target database in the same environment shares a corresponding standard database, and each target database in different environments and different target databases respectively have corresponding standard databases. Therefore, before responding to the model comparison instruction, by identifying the instruction type of the model comparison instruction, the corresponding standard database determination method can be selected according to the identified instruction type to realize the determination of the standard database.

[0050] Optionally, when the number of target databases is 1, the target database must belong to the database of the same environment, and the environment judgment may not be performed, that is, the instruction type identification may not be performed. For example, when the model comparison instruction indicates to perform model comparison on a target database, the instruction type identification may not be performed.

[0051] Optionally, when there are multiple target databases, it is necessary to identify the instruction type to determine whether the multiple target databases are in the same environment or in different environments.

[0052] As an optional embodiment, after identifying the instruction type of the model comparison instruction, the method also includes: when the model comparison instruction is a second comparison instruction, determining different environments, wherein the different environments include at least: a first target environment and a second target environment, a target database belonging to the first target environment is a first target database, and a target database belonging to the second target environment is determined to be a second target database; determining a first standard database belonging to the first target environment, wherein the first standard database is a standard database used to perform model comparison on the first target database; determining a second standard database belonging to the second target environment, wherein the second standard database is a standard database used to perform model comparison on the second target database.

[0053] In the above embodiment of the present invention, when multiple target databases belong to different environments, multiple target environments to which the multiple target databases belong can be determined, one or more target databases can exist in each target environment, and one or more target databases in the same target environment share the same annotation database.

[0054] For example, multiple target environments to which multiple target databases belong can be represented as a first target environment and a second target environment, wherein the first target environment and the second target environment are different, and the target database belonging to the first target environment is taken as the first target database, and the standard database belonging to the first target environment is taken as the first standard database; the target database belonging to the second target environment is taken as the second target database, and the standard database belonging to the second target environment is taken as the second standard database.

[0055] As an optional embodiment, the method also includes: determining a preset configuration library corresponding to the target database; in the preset configuration library, searching for a storage path of the target database information of the target database in the distributed application coordination service zookeeper; obtaining the target database information according to the storage path, wherein the target database information includes at least: a standard database corresponding to the target database, and instance setting information in the target database and the standard database, the instance setting information in the target database is used to determine the target base table model, and the instance setting information in the standard database is used to determine the standard base table model.

[0056] It should be noted that a configuration repository is a place to store configuration information that helps developers manage and organize application configurations. Configuration repositories usually contain application settings, environment variables, database connection information, log settings, etc. By using a configuration repository, developers can easily manage and update application configurations so that they can deploy and run applications in different environments. A configuration repository can be a separate file or a feature integrated into a development tool or platform.

[0057] It should be noted that Zookeeper is an open source distributed coordination service that provides a hierarchical namespace, similar to the directory tree structure of a file system. In Zookeeper, database information is usually stored in a specific path in the form of nodes, and the storage path of the database in Zookeeper can be found through the information in the configuration library. In this way, Zookeeper can be used to manage and maintain various configuration information, status information, etc. in a distributed system.

[0058] In the above-mentioned embodiment of the present invention, when it is necessary to perform a model comparison on the target database, the storage path of the target database information of the target database in the distributed application coordination service zookeeper can be found through the preset configuration library corresponding to the target database, and then the development API interface of the distributed application coordination service zookeeper is called to obtain the target database information in the storage path. The standard database corresponding to the target database and the instance setting information in the target database and the annotation database can be determined through the target database information. Then, the target base table model can be determined according to the instance setting information in the target database, and the standard base table model can be determined according to the instance setting information in the standard database.

[0059] Optionally, the target database information includes: database instance set information (ie, instance setting information) and a standard library.

[0060] It should be noted that, under the same environment, the target database may be each shard database in the distributed database, and the target database information may also include the shard information of the distributed database.

[0061] Optionally, when the target database is in different environments, there is a corresponding distributed application coordination service zookeeper in each different environment.

[0062] In the above-mentioned embodiment of the present invention, based on the target database information, the standard database corresponding to the target database can be determined, and the target base table model, the table to be compared and the metadata information of the table to be compared in the target database, as well as the standard base table model, the standard table and the metadata information of the standard table in the standard database can be obtained.

[0063] As an optional embodiment, determining the preset configuration library corresponding to the target database includes: when there are multiple target databases, identifying the target environment to which each target database belongs; when all of the multiple target databases belong to the target environment, determining the preset configuration library belonging to the target environment; when the multiple target databases belong to different target environments, respectively determining the preset configuration library belonging to each target environment.

[0064] In the above-mentioned embodiment of the present invention, there is a corresponding preset configuration library in each target environment. When multiple target databases belong to different target environments, the preset configuration library belonging to the target environment can be obtained, and then the target database information can be obtained from the preset configuration library, thereby realizing the determination of preset configuration libraries for different target environments.

[0065] As an optional embodiment, determining the correspondence between the table to be compared and the standard table based on the table name includes: obtaining the table name of each table to be compared in the target database one by one as the name of the table to be compared; comparing the name of the table to be compared with the table name of each standard table in the standard database; when there is a standard table with the same name as the table to be compared in the standard database, determining that there is a correspondence between the standard table with the same name as the table to be compared and the table to be compared; when there is no standard table with the same name as the table to be compared in the standard database, determining that there is no correspondence between the table to be compared corresponding to the name of the table to be compared.

[0066] In the above-mentioned embodiment of the present invention, during the process of model comparison, the correspondence between the table to be compared and the standard table can be determined by the comparison table name, and the tables to be compared that do not have a corresponding relationship can be screened out from the target database; and then the metadata information of the tables to be compared that have a corresponding relationship can be compared with the corresponding standard tables, which can reduce the number of tables to be compared that need to be compared with metadata information, thereby improving the comparison efficiency.

[0067] As an optional embodiment, the table name of each to-be-compared table in the target database is obtained one by one as the name of the to-be-compared table, including: when there are multiple target databases and the multiple target databases belong to the same environment, the to-be-compared tables with the same table name in the multiple target databases are taken as a common table, and the to-be-compared tables with different table names in the multiple target databases are taken as sub-tables within the database; the table names of the common table or the sub-table within the database are obtained one by one as the name of the to-be-compared table.

[0068] In the above-mentioned embodiment of the present invention, when multiple target databases belong to the same environment, the tables to be compared with the same table name can be screened in the multiple target databases as a common table, and the tables to be compared in each target database that do not belong to the common table can be used as sub-tables within the library, and then the common table or the sub-table within the library is compared with the standard table in the standard database, such as comparing the table name of the common table or the sub-table within the library with the standard table. In this way, by determining the common table in multiple target databases in the same environment and then comparing the common table with the standard table, the comparison efficiency can be improved.

[0069] The present invention also provides an optional embodiment, which provides a database model comparison method, which can automatically compare the data models of distributed database clusters in different environments: mysql+keepalive+zookeeper, and output the results, provide a consistency mechanism to ensure the successful synchronization of each node / environment, simplify manual operations, and solve the problem of inconsistent data models in different environments and different nodes.

[0070] It should be noted that during the application cloud migration, there are different environments such as development testing, simulation testing, integration testing, and production. Due to differences in the online processes between the environments, there are problems with the models being out of sync. Previously, operations and maintenance personnel manually compared or manually checked and troubleshooted after a failure occurred, which was slow. For systems that have not been put into production, the progress of cloud migration is affected; for systems that have been put into production, the troubleshooting time is too long, affecting the application's external services. The present invention can automatically compare database tables and indexes on a regular basis and repair them in a timely manner, shortening the troubleshooting time, improving the speed of cloud migration and user experience, while also reducing the workload of operations and maintenance personnel.

[0071] Figure 2 is a schematic diagram of a model comparison method in the same environment according to an embodiment of the present invention. Figure 2 As shown, it at least includes: an information analysis module, a comparison module and a display module, and the above modules are used to perform the following steps:

[0072] Step S21, calling the information parsing module, through the database name input by the user (such as obtaining the model comparison instruction of the target database in the same environment), finds the storage path of the target database information of the target database in zookeeper from the configuration library, and finds the data node data_node corresponding to the target database from the storage path through the API interface opened by zookeeper, obtains the data host datahost information from data_node, and then searches for the corresponding configuration file mig_configs, obtains the information of the target database (such as zk information) in mig_configs, such as the instance set name and master-slave information corresponding to the standard library and shard library (such as the target database) of the library, and obtains the shard library name and shard library information on the shard library instance through regular expressions.

[0073] Step S22, parse the information obtained in step S21 according to a specific json parsing library to obtain the number of database nodes and sharding information (such as obtaining the target database information), and the target database information at least includes: database instance set information, standard library and sharding library information, wherein the sharding library information includes: sharding library A01, sharding library A02, and sharding library A03.

[0074] Step S23, before comparison, delete the special table that only exists in the standard library A.

[0075] Step 24, query the number and names of all standard tables in the standard library (such as base library A), loop through shard library A01, shard library A02, and shard library A03 to obtain the number and names of tables.

[0076] Step 25, collect metadata information of all standard tables of the database schema under the main node information_schema of the standard library (such as base library A), including: table structure (field name, field type, field length, field encoding), number of indexes, index columns, constraints, convert the data table structure information into feature representation to be processed, and encode information such as table name, field name, data type, etc. to compare the similarity between different table structures.

[0077] Step 26, cyclically collect metadata information of all tables to be compared of the main node information_schema of each shard library (such as the target database, i.e., shard library A01, shard library A021, and shard library A03), including: table structure (field name, field type, field length, field encoding), number of indexes, index columns, and constraints of all tables, in the same way as step S25.

[0078] Step 27, first compare the common table in the target database and save the difference; if all the information is consistent, do not save it.

[0079] Step 28, then compare the sub-tables in the target database, collect the quantity, table structure (field name, field type, field length, field encoding), number of indexes, and index columns of each table, and save the differences; if all the information is consistent, do not save it.

[0080] Step 29, output the different tables, table structures (field name, field type, field length, field encoding), number of indexes, and index columns saved in the above steps to Excel.

[0081] Alternatively, if Figure 2 As shown, the information analysis module is used to execute the above steps S21 and S22; the comparison module is used to execute the above steps S23 to S28; and the display module is used to execute the above step S29.

[0082] Figure 3 is a schematic diagram of a model comparison method in different environments according to an embodiment of the present invention. Figure 3 As shown, it at least includes: an information analysis module, a comparison module and a display module, and the above modules are used to perform the following steps:

[0083] Step S31, calling the information parsing module, through the database names of different environments input by the user (such as obtaining the model comparison instructions of the target databases of different environments), respectively find the storage path of the database information in zookeeper from the configuration library (such as the source base library A configuration library, the source base library B configuration library, the target base library A configuration library and the target base library B configuration library), through the API interface open by zookeeper, respectively find the data node data_node corresponding to each target database from the storage path of zookeeper corresponding to each target database, obtain the datahost information from the data_node, and then find the corresponding configuration file mig_configs, and then obtain the information of the target databases of different environments (such as zk information) from mig_configs.

[0084] Step S32, parsing the information obtained in step S31 according to a specific json parsing library to obtain target database information, which includes: database instance set information and standard library information.

[0085] Step S33, querying the number and names of all tables in the standard library in each target environment, and collecting the number and names of tables in the target database in each target environment.

[0086] Step S34, collect metadata information of all standard tables under the main node information_schema of the standard library in each target environment (such as the source base library A standard library or the source base library B standard library), including: the table structure (field name, field type, field length, field encoding), number of indexes, index columns, constraints, convert the data table structure information into the feature representation to be processed, and encode the table name, field name, data type and other information to compare the similarity between different table structures.

[0087] Step S35, collect metadata information of all tables under the main node information_schema of the target database of each target environment (such as target base database A or target base database B), including: table structure (field name, field type, field length, field encoding), number of indexes, index columns, and constraints of all tables, using the same method as step S34.

[0088] Step S36, comparing the data collected in step S34 and step S35.

[0089] Step S37, save and output the difference part of the comparison result; if all the information is consistent, do not save it.

[0090] Alternatively, if Figure 3 As shown, the information analysis module is used to execute the above steps S31 and S32; the comparison module is used to execute the above steps S33 to S36; and the display module is used to execute the above step S37.

[0091] The technical solution provided by this application is developed for distributed databases (such as udal+teledb), which can automatically search the zookeeper in the same environment or different environments at regular intervals to obtain the master-slave set information and shard information, and realize the comparison of database tables and index structures in the same environment and across environments, which can improve the convenience of use, greatly simplify the comparison operation, and deploy simply and quickly, which can reduce unnecessary time waste, reduce or even cancel manual operations, and reduce operation and maintenance costs;

[0092] The technical solution provided in this application supports model comparison in two scenarios: model comparison within the same environment and model comparison between different environments; the model comparison and management can run through the entire software implementation process.

[0093] The technical solution provided in this application focuses on system security and does not require senior administrator privileges, but only requires query privileges to execute; it supports visual display and displays all difference data.

[0094] According to an embodiment of the present invention, a database model comparison device embodiment is also provided. It should be noted that the database model comparison device can be used to execute the database model comparison method in the embodiment of the present invention, and the database model comparison method in the embodiment of the present invention can be executed in the database model comparison device.

[0095] Figure 4 is a schematic diagram of a database model comparison device according to an embodiment of the present invention. Figure 4 As shown, the device may include: an acquisition module 42, which is used to respond to the model comparison instruction, obtain at least one table to be compared from the target database, and obtain at least one standard table from the standard database, wherein the target database stores a target base table model, the target base table model is used to describe the table to be compared in the target database, and the target database has a standard database for model comparison, and the standard database pre-stores a standard base table model, and the standard base table model is used to describe the standard table in the standard database; a first determination module 44, which is used to determine the correspondence between the table to be compared and the standard table based on the table name, wherein the table to be compared and the standard table with a corresponding relationship have the same table name; a comparison module 46, which is used to compare the metadata information of the table to be compared with the standard table with a corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; a second determination module 48, which is used to determine the comparison result based on the table to be compared without a corresponding relationship and the table to be compared with a difference in metadata information.

[0096] It should be noted that the acquisition module 42 in this embodiment can be used to execute step S102 in the embodiment of the present application, the first determination module 44 in this embodiment can be used to execute step S104 in the embodiment of the present application, the comparison module 46 in this embodiment can be used to execute step S106 in the embodiment of the present application, and the second determination module 48 in this embodiment can be used to execute step S108 in the embodiment of the present application. The examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments.

[0097] In an embodiment of the present invention, in response to a model comparison instruction, at least one table to be compared is obtained from a target database, and at least one standard table is obtained from a standard database, wherein a target base table model is stored in the target database, and the target base table model is used to describe the table to be compared in the target database, and a standard database for model comparison exists in the target database, and a standard base table model is pre-stored in the standard database, and the standard base table model is used to describe the standard table in the standard database; the correspondence between the table to be compared and the standard table is determined based on the table name, wherein the table to be compared and the standard table with the corresponding relationship have the same table name; The metadata information of the table to be compared is compared with the standard table, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; based on the table to be compared for which there is no corresponding relationship and the table to be compared for which there is a difference in metadata information, the comparison result is determined, and the purpose of comparing the standard base table model in the target database with the standard base table model in the standard database is achieved by automatically acquiring and comparing the table to be compared in the target database and the standard base table model in the standard database, thereby achieving the technical effect of automatically comparing the model of the target database and the standard data, and then solving the technical problem that the database model cannot be automatically compared.

[0098] As an optional embodiment, the device also includes: an identification submodule, which is used to identify the instruction type of the model comparison instruction before obtaining at least one to-be-compared table from the target database and obtaining at least one standard table from the standard database in response to the model comparison instruction, wherein the instruction type includes: a first comparison instruction indicating that a model comparison is to be performed on at least one target database in the same environment, and a second comparison instruction indicating that a model comparison is to be performed on at least one target database in a different environment; a first determination submodule, which is used to determine the target standard database in the same environment when the model comparison instruction is the first comparison instruction, wherein the target database belonging to the same environment is the same environment database, and the target standard database is the standard database used for model comparison of the same environment database.

[0099] As an optional embodiment, the device also includes: a second determination submodule, used to determine different environments after identifying the instruction type of the model comparison instruction, when the model comparison instruction is a second comparison instruction, wherein the different environments at least include: a first target environment and a second target environment, the target database belonging to the first target environment is the first target database, and the target database belonging to the second target environment is determined to be the second target database; a third determination submodule, used to determine a first standard database belonging to the first target environment, wherein the first standard database is a standard database used for model comparison of the first target database; a fourth determination submodule, used to determine a second standard database belonging to the second target environment, wherein the second standard database is a standard database used for model comparison of the second target database.

[0100] As an optional embodiment, the device also includes: a fifth determination submodule, used to determine the preset configuration library corresponding to the target database; a search submodule, used to search the preset configuration library for the storage path of the target database information of the target database in the distributed application coordination service zookeeper; an acquisition submodule, used to acquire the target database information according to the storage path, wherein the target database information includes at least: a standard database corresponding to the target database, and instance setting information in the target database and the standard database, the instance setting information in the target database is used to determine the target base table model, and the instance setting information in the standard database is used to determine the standard base table model.

[0101] As an optional embodiment, the fifth determination submodule includes: an identification subunit, used to identify the target environment to which each target database belongs when there are multiple target databases; a first determination subunit, used to determine the preset configuration library belonging to the target environment when all of the multiple target databases belong to the target environment; and a second determination subunit, used to obtain the preset configuration library belonging to each target environment respectively when the multiple target databases belong to different target environments.

[0102] As an optional embodiment, determining the correspondence between the table to be compared and the standard table based on the table name includes: a first acquisition unit, used to acquire the table name of each table to be compared in the target database one by one as the name of the table to be compared; a comparison unit, used to compare the name of the table to be compared with the table name of each standard table in the standard database; a first determination unit, used to determine that there is a correspondence between the standard table with the same name as the table to be compared and the table to be compared when there is a standard table with the same name as the table to be compared in the standard database; a second determination unit, used to determine that there is no correspondence between the table to be compared corresponding to the name of the table to be compared when there is no standard table with the same name as the table to be compared in the standard database.

[0103] As an optional embodiment, the acquisition unit includes: a third determination unit, which is used to treat the tables to be compared with the same table names in the multiple target databases as a common table, and treat the tables to be compared with different table names in the multiple target databases as in-library sub-tables when there are multiple target databases and the multiple target databases belong to the same environment; a second acquisition unit, which is used to obtain the table names of the common table or the in-library sub-tables one by one as the names of the tables to be compared.

[0104] The embodiment of the present invention can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.

[0105] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.

[0106] In this embodiment, the computer terminal can execute the program code of the following steps in the database model comparison method: in response to the model comparison instruction, obtaining at least one table to be compared from the target database and obtaining at least one standard table from the standard database, wherein the target database stores a target base table model, the target base table model is used to describe the table to be compared in the target database, and the target database has a standard database for model comparison, the standard database pre-stores a standard base table model, and the standard base table model is used to describe the standard table in the standard database; determining the correspondence between the table to be compared and the standard table based on the table name, wherein the table to be compared and the standard table with a corresponding relationship have the same table name; performing metadata information comparison between the table to be compared and the standard table with a corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; determining the comparison result based on the table to be compared without a corresponding relationship and the table to be compared with a difference in metadata information.

[0107] Optionally, Figure 5 is a structural block diagram of a computer terminal according to an embodiment of the present invention. Figure 5 As shown, the computer terminal 500 may include: one or more (only one is shown in the figure) processors 502 , and a memory 504 .

[0108] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the database model comparison method and device in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, the above-mentioned database model comparison method is realized. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the terminal 500 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0109] The processor can call the information and application program stored in the memory through the transmission device to perform the following steps: in response to the model comparison instruction, obtain at least one table to be compared from the target database and at least one standard table from the standard database, wherein the target database stores a target base table model, the target base table model is used to describe the table to be compared in the target database, and the target database has a standard database for model comparison, and the standard database pre-stores a standard base table model, the standard base table model is used to describe the standard table in the standard database; determine the correspondence between the table to be compared and the standard table based on the table name, wherein the table to be compared and the standard table with a corresponding relationship have the same table name; compare the metadata information between the table to be compared and the standard table with a corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; determine the comparison result based on the table to be compared without a corresponding relationship and the table to be compared with a difference in metadata information.

[0110] Optionally, the processor may also execute the program code of the following steps: identifying the instruction type of the model comparison instruction, wherein the instruction type includes: a first comparison instruction instructing to perform a model comparison on at least one target database in the same environment, and a second comparison instruction instructing to perform a model comparison on at least one target database in a different environment; when the model comparison instruction is the first comparison instruction, determining a target standard database in the same environment, wherein the target database belonging to the same environment is a same environment database, and the target standard database is a standard database used to perform a model comparison on the same environment database.

[0111] Optionally, the processor may also execute the program code of the following steps: when the model comparison instruction is a second comparison instruction, determining different environments, wherein the different environments include at least: a first target environment and a second target environment, a target database belonging to the first target environment is a first target database, and determining a target database belonging to the second target environment is a second target database; determining a first standard database belonging to the first target environment, wherein the first standard database is a standard database used for model comparison of the first target database; determining a second standard database belonging to the second target environment, wherein the second standard database is a standard database used for model comparison of the second target database.

[0112] Optionally, the processor may also execute the following program code: determining a preset configuration library corresponding to the target database; searching, in the preset configuration library, for a storage path of target database information of the target database in the distributed application coordination service zookeeper; obtaining the target database information according to the storage path, wherein the target database information includes at least: a standard database corresponding to the target database, and instance setting information in the target database and the standard database, wherein the instance setting information in the target database is used to determine the target base table model, and the instance setting information in the standard database is used to determine the standard base table model.

[0113] Optionally, the processor may also execute program codes of the following steps: when there are multiple target databases, identifying the target environment to which each target database belongs; when all of the multiple target databases belong to the target environment, determining a preset configuration library belonging to the target environment; when the multiple target databases belong to different target environments, respectively determining a preset configuration library belonging to each target environment.

[0114] Optionally, the processor may also execute the program code of the following steps: obtaining the table name of each table to be compared in the target database one by one as the name of the table to be compared; comparing the name of the table to be compared with the table name of each standard table in the standard database; if there is a standard table with the same name as the table to be compared in the standard database, determining that there is a corresponding relationship between the standard table with the same name as the table to be compared and the table to be compared; if there is no standard table with the same name as the table to be compared in the standard database, determining that there is no corresponding relationship between the table to be compared corresponding to the name of the table to be compared.

[0115] Optionally, the processor may also execute the program code of the following steps: when there are multiple target databases and the multiple target databases belong to the same environment, the tables to be compared with the same table names in the multiple target databases are treated as common tables, and the tables to be compared with different table names in the multiple target databases are treated as sub-tables within the database; the table names of the common table or the sub-tables within the database are obtained one by one as the names of the tables to be compared.

[0116] According to an embodiment of the present invention, a database model comparison scheme is provided. In the embodiment of the present invention, in response to a model comparison instruction, at least one table to be compared is obtained from a target database, and at least one standard table is obtained from a standard database, wherein a target base table model is stored in the target database, and the target base table model is used to describe the table to be compared in the target database, and a standard database for model comparison exists in the target database, and a standard base table model is pre-stored in the standard database, and the standard base table model is used to describe the standard table in the standard database; the correspondence between the table to be compared and the standard table is determined based on the table name, wherein the table to be compared and the standard table with the corresponding relationship have the same table name; and the corresponding relationship is determined. The metadata information of the table to be compared is compared with the standard table, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; based on the table to be compared for which there is no corresponding relationship and the table to be compared for which there is a difference in metadata information, the comparison result is determined, and the purpose of comparing the standard base table model in the target database with the standard base table model in the standard database is achieved by automatically acquiring and comparing the table to be compared in the target database and the standard base table model in the standard database, thereby achieving the technical effect of automatically comparing the model of the target database and the standard data, and then solving the technical problem that the database model cannot be automatically compared.

[0117] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 5 The structure of the electronic device is not limited. For example, the computer terminal 500 may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations are shown.

[0118] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a non-volatile medium. The non-volatile storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0119] The embodiment of the present invention further provides a computer program product, including a computer program. Optionally, in this embodiment, the computer program is characterized in that when executed by a processor, the computer program implements the steps of the database model comparison method provided in the above embodiment.

[0120] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0121] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0122] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0126] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A database model comparison method, characterized in that: include: In response to the model comparison instruction, at least one table to be compared is obtained from the target database, and at least one standard table is obtained from the standard database, wherein the target database stores a target base table model, and the target base table model is used to describe the table to be compared in the target database, and the target database has a standard database for model comparison, and the standard database pre-stores a standard base table model, and the standard base table model is used to describe the standard table in the standard database; Determine a correspondence between the table to be compared and the standard table based on the table name, wherein the table to be compared and the standard table having the correspondence have the same table name; Comparing metadata information between the table to be compared and the standard table that have the corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; A comparison result is determined based on the to-be-compared table in which the corresponding relationship does not exist and the to-be-compared table in which the metadata information is different.

2. The method according to claim 1, characterized in that Before obtaining at least one table to be compared from the target database and obtaining at least one standard table from the standard database in response to the model comparison instruction, the method further includes: Identifying an instruction type of a model comparison instruction, wherein the instruction type includes: a first comparison instruction instructing to perform a model comparison on at least one target database in the same environment, and a second comparison instruction instructing to perform a model comparison on at least one target database in a different environment; When the model comparison instruction is the first comparison instruction, a target standard database in the same environment is determined, wherein the target database belonging to the same environment is a same environment database, and the target standard database is a standard database used for model comparison of the same environment database.

3. The method according to claim 2, characterized in that After identifying the instruction type of the model comparison instruction, the method further includes: In the case where the model comparison instruction is the second comparison instruction, determining the different environments, wherein the different environments at least include: a first target environment and a second target environment, the target database belonging to the first target environment is the first target database, and determining the target database belonging to the second target environment is the second target database; Determining a first standard database belonging to the first target environment, wherein the first standard database is a standard database used for performing model comparison on the first target database; A second standard database belonging to the second target environment is determined, wherein the second standard database is a standard database used for performing model comparison on the second target database.

4. The method according to claim 1, characterized in that: The method further comprises: Determine a preset configuration library corresponding to the target database; In the preset configuration library, searching for a storage path of the target database information of the target database in the distributed application coordination service zookeeper; The target database information is obtained according to the storage path, wherein the target database information at least includes: the standard database corresponding to the target database, and instance setting information in the target database and the standard database, the instance setting information in the target database is used to determine the target base table model, and the instance setting information in the standard database is used to determine the standard base table model.

5. The method according to claim 4, characterized in that Determining the preset configuration library corresponding to the target database includes: In the case where there are multiple target databases, identifying a target environment to which each target database belongs; In the case that all of the plurality of target databases belong to the target environment, determining a preset configuration library belonging to the target environment; In the case that a plurality of target databases belong to different target environments, the preset configuration library belonging to each target environment is determined respectively.

6. The method according to claim 1, characterized in that Determining the correspondence between the table to be compared and the standard table based on the table name includes: Obtaining the table name of each of the to-be-compared tables in the target database one by one as the name of the to-be-compared table; Compare the name of the table to be compared with the table name of each standard table in the standard database; In the case where the standard table with the same name as the table to be compared exists in the standard database, determining that the standard table with the same name as the table to be compared exists in the corresponding relationship with the table to be compared; In the case that the standard table having the same name as the table to be compared does not exist in the standard database, it is determined that the table to be compared corresponding to the name of the table to be compared does not have the corresponding relationship.

7. The method according to claim 6, characterized in that The table name of each table to be compared in the target database is obtained one by one, and the table name to be compared includes: In the case that there are multiple target databases and the multiple target databases belong to the same environment, the tables to be compared in the multiple target databases with the same table name are taken as a common table, and the tables to be compared in the multiple target databases with different table names are taken as in-library sub-tables; The table names of the common table or the sub-tables in the library are obtained one by one as the names of the tables to be compared.

8. A database model comparison device, characterized in that: include: an acquisition module, configured to acquire at least one table to be compared from a target database and at least one standard table from a standard database in response to a model comparison instruction, wherein the target database stores a target base table model, the target base table model is used to describe the table to be compared in the target database, the target database stores a standard database for model comparison, the standard database stores a standard base table model in advance, the standard base table model is used to describe the standard table in the standard database; A first determining module is used to determine the corresponding relationship between the table to be compared and the standard table based on the table name, wherein the table to be compared and the standard table with the corresponding relationship have the same table name; A comparison module, used for comparing metadata information between the table to be compared and the standard table in the corresponding relationship, wherein the metadata information is used to describe the characteristics of the table to be compared or the standard table; The second determination module is used to determine the comparison result based on the to-be-compared table in which the corresponding relationship does not exist and the to-be-compared table in which the metadata information is different.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is used to run a program stored in the processor, wherein the program executes the database model comparison method described in any one of claims 1 to 7 when running.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the database model comparison method described in any one of claims 1 to 7 are implemented.