Data synchronization method and device, computer equipment and computer readable storage medium
By configuring synchronization objects, synchronization lists and mapping rules, data synchronization from source address to target address is achieved, and the problems of low data synchronization efficiency and small scope of application in the existing technology are solved, and batch synchronization of multiple tables or multiple libraries is realized.
Patent Information
- Application Number
- CN202311456174.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-05-06
AI Technical Summary
The existing data synchronization scheme is inefficient and has a small scope of application, so it is impossible to achieve batch synchronization of multiple tables or multiple libraries.
By responsive to data configuration operations, obtain synchronization objects based on the source data structure, configure synchronization lists and mapping rules, and realize data synchronization from source address to target address.
It realizes batch synchronization of different data particle dimensions, improves data synchronization efficiency, meets different personalized synchronization needs, and makes data synchronization more applicable.
Smart Images

Figure CN119938776A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of data synchronization, and in particular, relates to a data synchronization method, apparatus, computer equipment, and computer-readable storage medium. Background Art
[0002] With the development of Internet technology and the increasing demand of consumers for online shopping, the demand for data storage on major e-commerce platforms is also increasing. At present, both e-commerce platforms and merchants stationed on e-commerce platforms can store online data in their deployed databases, so as to build consumer portraits through big data models and provide data references for product development and marketing strategies. It can be seen that online data is a very important e-commerce resource. In order to prevent the data stored in the database from being destroyed or used for data analysis without authorization, a backup database / data lake can be added as the target storage based on the existing source data terminal database, and then the data in the source data terminal database can be synchronized to the target storage.
[0003] However, when implementing data synchronization, data synchronization can only be performed on a single table, a single database, or a small number of tables. The efficiency of data synchronization is low, and the data synchronization method is relatively simple. It can be seen that the existing data synchronization solution has the problem of a small scope of application. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a data synchronization method, apparatus, computer device and computer-readable storage medium to solve the problem that the existing data synchronization scheme has a single data synchronization, resulting in low data synchronization efficiency and a small scope of application.
[0005] A first aspect of an embodiment of the present application provides a data synchronization method, including:
[0006] In response to the data configuration operation, a synchronization object to be synchronized configured based on the source data structure is obtained, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node;
[0007] In response to the list configuration operation, a synchronization list of the synchronization object is obtained;
[0008] In response to the configuration operation of the mapping rule, the mapping rule configured for the synchronization object is obtained; and / or, the mapping rule is determined according to the classification of the leaf object corresponding to the synchronization object; the mapping rule is a mapping rule from the source address to the target address of the synchronization object; the number of levels of the source address is the same as or different from the number of levels of the target address;
[0009] A data synchronization operation is performed according to the synchronization object, the synchronization list, and the mapping rule.
[0010] In some embodiments of the present application, after the response data configuration operation is performed and the synchronization object to be synchronized configured based on the source data structure is obtained, the method further includes:
[0011] Query the source data structure to which the synchronization object belongs, and determine the node corresponding to the synchronization object;
[0012] If the synchronization object corresponds to a branch node, then the sub-synchronization objects corresponding to the nodes under the branch node are obtained; the sub-synchronization objects include: the hierarchical objects corresponding to the sub-branch nodes until the leaf objects corresponding to the leaf nodes;
[0013] If the synchronization list of the sub-synchronization object is a whitelist, the sub-synchronization object and the synchronization object are associated and saved.
[0014] In some embodiments of the present application, after the response list configuration operation is performed and the synchronization list of the synchronization object is obtained, the method further includes:
[0015] If the synchronization object has an associated sub-synchronization object, determining whether the sub-synchronization object has been configured with a synchronization list;
[0016] If the sub-synchronization object is not configured with a synchronization list, the synchronization list of the synchronization object is inherited through the sub-synchronization object;
[0017] If the sub-synchronization object has been configured with a synchronization list, the synchronization list of the synchronization object is overwritten by the synchronization list of the sub-synchronization object.
[0018] In some embodiments of the present application, after the configuration operation of the response mapping rule and the acquisition of the mapping rule configured for the synchronization object, the method further includes:
[0019] If the synchronization object has an associated sub-synchronization object, determining whether the sub-synchronization object has been configured with a mapping rule;
[0020] If the sub-synchronization object is not configured with a mapping rule, the mapping rule of the synchronization object is inherited by the sub-synchronization object;
[0021] If the sub-synchronization object has been configured with a mapping rule, the mapping rule of the synchronization object is overwritten by the mapping rule of the sub-synchronization object.
[0022] In some embodiments of the present application, the mapping rules are configured on the synchronization objects of each level node of the source data structure corresponding to the source data end, and the mapping rules are the mapping between the leaf objects corresponding to the synchronization objects in the source address and the target leaf objects in the target address.
[0023] In some embodiments of the present application, obtaining a mapping rule determined according to the classification of the leaf objects corresponding to the synchronization objects includes:
[0024] Obtain the leaf object corresponding to the synchronization object and the object properties of the leaf object;
[0025] Classifying the leaf objects according to the object attributes of the leaf objects to obtain target classifications;
[0026] Query the preset mapping table to obtain the mapping rules corresponding to the target classification.
[0027] In some embodiments of the present application, classifying the leaf objects according to the object attributes of the leaf objects to obtain target classification includes:
[0028] Classifying the leaf objects according to object attributes of the leaf objects;
[0029] If there is no matching category, the preset default category is set as the target category;
[0030] If there is a matching category, the matching category is set as the target category;
[0031] If there are at least two matching categories, the target category with the highest classification priority is obtained.
[0032] A second aspect of an embodiment of the present application provides a data synchronization device, including:
[0033] An object configuration module, for responding to a data configuration operation, obtaining a synchronization object to be synchronized based on a source data structure configuration, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node;
[0034] A list configuration module, used to respond to the list configuration operation and obtain the synchronization list of the synchronization object;
[0035] A rule determination module, for responding to a configuration operation of a mapping rule, obtaining a mapping rule configured for the synchronization object; and / or obtaining a mapping rule determined according to the classification of leaf objects corresponding to the synchronization object; the mapping rule is a mapping rule for the synchronization object from a source address to a target address; the number of levels of the source address is the same as or different from the number of levels of the target address;
[0036] The data synchronization module is used to perform data synchronization operations according to the synchronization object, the synchronization list, and the mapping rule.
[0037] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the computer device, wherein the processor implements the steps of the data synchronization method provided in the first aspect when executing the computer program.
[0038] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data synchronization method provided in the first aspect are implemented.
[0039] A data synchronization method, apparatus, computer device and computer-readable storage medium provided by an embodiment of the present application; A data synchronization method provided by an embodiment of the present application includes: responding to a data configuration operation, obtaining a synchronization object to be synchronized configured based on a source data structure, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node; responding to a list configuration operation, obtaining a synchronization list of the synchronization object; responding to a mapping rule configuration operation, obtaining a mapping rule configured for the synchronization object; and / or obtaining a mapping rule determined according to a classification of leaf objects corresponding to the synchronization object; the mapping rule is a mapping rule for the synchronization object from a source address to a target address; the layer of the source address The number of levels is the same as or different from the number of levels of the target address; data synchronization operations are performed according to the synchronization object, the synchronization list, and the mapping rule; in the embodiment of the present application, a source data structure of the source data in the source data end is pre-constructed. When the user performs data synchronization, the synchronization object to be synchronized in the source data structure is selected according to the data synchronization requirements. The synchronization object can be an instance, a database, a data model, a data table and other objects of different granularities, and then a synchronization list and a mapping rule are configured for the synchronization object. Finally, data synchronization is performed according to the configured information. In this way, batch synchronization of different data granularity dimensions can be achieved, which improves data synchronization efficiency, meets different personalized synchronization requirements, and makes data synchronization more applicable. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0041] Figure 1 It is a flow chart of an implementation of a data synchronization method provided in an embodiment of the present application;
[0042] Figure 2 is a schematic diagram of the source data structure of the data end in the embodiment of the present application;
[0043] Figure 3 This is a schematic diagram of data synchronization in the embodiment of the present application. Figure 1 ;
[0044] Figure 4 This is a schematic diagram of data synchronization in the embodiment of the present application. Figure 2 ;
[0045] Figure 5 This is a schematic diagram of data synchronization in the embodiment of the present application. Figure 3 ;
[0046] Figure 6 is a structural block diagram of a data synchronization device provided in an embodiment of the present application;
[0047] Figure 7 It is a structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] The data synchronization method provided in this embodiment is executed by a computer device, which can be a computer device that can access the source data terminal and the target data terminal. The source data terminal and the target data terminal can be configured in the same server or server cluster, and the computer device can interact with the source data terminal and the target data terminal respectively or configure tasks through a web page. Alternatively, the computer device can interact with the source data terminal and the target data terminal respectively or configure tasks through a client.
[0050] In actual applications, in order to meet the needs of diversified data storage and data empowerment, a new data end product, that is, the target data end, can usually be added on the basis of the source address to synchronize or back up the data stored in the source address, or even perform data analysis and other operations. However, when implementing data synchronization, data synchronization can only be performed on a single table, a single database, or a small number of tables. The efficiency of data synchronization is low, and the method of data synchronization is relatively simple. It can be seen that the existing data synchronization solution has the problem of a small scope of application.
[0051] Based on this, an embodiment of the present application provides a data synchronization method, which responds to a data configuration operation to obtain a synchronization object to be synchronized based on a source data structure configuration, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node; responds to a list configuration operation to obtain a synchronization list of the synchronization object; responds to a mapping rule configuration operation to obtain a mapping rule configured for the synchronization object; and / or obtains a mapping rule determined according to a classification of leaf objects corresponding to the synchronization object; the mapping rule is a mapping rule for the synchronization object from a source address to a target address; the number of levels of the source address is the same as the number of levels of the target address. Or different; perform data synchronization operations according to the synchronization object, the synchronization list, and the mapping rules; in the embodiment of the present application, a source data structure of the source data in the source data end is pre-constructed, and when the user performs data synchronization, the synchronization object to be synchronized in the source data structure is selected according to the data synchronization requirements. The synchronization object can be an instance, database, data model, data table and other objects of different granularities, and then configure the synchronization list and mapping rules for the synchronization object, and finally perform data synchronization according to the configured information, so that batch synchronization of different data granularity dimensions can be achieved, the data synchronization efficiency is improved, different personalized synchronization requirements are met, and the data synchronization has a wider scope of application.
[0052] A data synchronization method provided by this embodiment is described in detail below through a specific implementation method.
[0053] Figure 1 FIG. 1 shows a flow chart of a data synchronization method according to an embodiment of the present application. Figure 1 As shown, the data synchronization method includes the following steps 101-104:
[0054] 101. In response to a data configuration operation, a synchronization object to be synchronized configured based on a source data structure is obtained, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node.
[0055] In the embodiments of the present application, the data synchronization method is applied to a computer device, and the type of the computer device is not limited. For example, the computer device can be a user terminal or a server, etc. The computer device triggers a data configuration operation, wherein the manner in which the data configuration operation is triggered is not limited. For example, a user clicks on an option on a display interface of the computer device to actively trigger the data configuration operation; or a condition for data synchronization is pre-set in the computer device, and the computer device automatically triggers the data configuration operation when the data synchronization condition is met.
[0056] The computer device responds to the data configuration operation and outputs a data configuration page. The data configuration page contains a source data structure corresponding to the source data end. For example, the source data structure can be a tree structure, which is a nested structure of multiple levels. The outer layer and inner layer of a tree structure have similar structures. The source data structure can recursively represent the hierarchical relationship between data. Among them, a classic source data structure, a tree, can be simply represented as a root, a left subtree, and a right subtree. The left subtree and the right subtree have their own subtrees. In this embodiment, the root and the subtree nodes formed by the root are called branch nodes, and the nodes without branches are called leaf nodes.
[0057] The computer device first sorts out the relationship between all the data in the source data end to form a tree-shaped source data structure. Each node of the source data structure corresponds to a different data object, for example, Figure 2 Schematic diagram of the hierarchical structure on the data configuration page in the embodiment of the present application is shown. Figure 2 As shown in FIG. 1 , the general hierarchical structure in the data end may include “instance”, “database layer”, and “data table layer”. As for the data content in an instance, the source data structure may include two layers of “database layer” and “data table layer”. Figure 2 In the source data structure diagram shown, the "instance" can be considered as the upper node of the "database layer", and the "data table layer" can be considered as the node under the "database layer". That is, one or more databases can be deployed under one instance, such as Figure 2 In the example, "Database 1", "Database 2", ... "Database n" form the data table layer. Similarly, the "database layer" is the upper node of the "data table layer", so one or more groups of data tables can be deployed under one database. Figure 2 Under "Database 1", you can deploy "Data Table 1", "Data Table 2", ... "Data Table n".
[0058] In the embodiments of the present application, due to the different formats and data volumes of the data to be synchronized, for example, the data to be synchronized may be data in a database or data in a data table. In the embodiments of the present application, the data corresponding to each node in the source data structure selected by the user is called a synchronization object. Specifically, the user performs a selection operation on the data configuration page. The user can select the synchronization objects to be synchronized on the data configuration page. The synchronization objects include hierarchical objects corresponding to branch nodes and leaf objects corresponding to leaf nodes. That is, the synchronization objects in the present application may be instances, databases, and data tables, etc. The user selects the instance identifier or name, the database identifier or name, the data table identifier or table name, etc. on the data configuration page.
[0059] In some existing synchronization schemes, data synchronization configuration is only allowed for data tables in the data table layer, that is, the prior art only involves the identifiers or names of each data table in the data table layer. Due to the size limit of the configuration content, data synchronization configuration is only allowed for a single table, a single database, or a small number of tables. At the same time, in the existing synchronization schemes, the source data end and the target end are mapped to the same level, which limits the synchronization scope. In the embodiment of the present application, the data corresponding to each different node in the source data structure can be selected as the synchronization object, realizing data synchronization of different granularities, making the data synchronization operation more flexible.
[0060] In order to further reduce configuration operations, in the data synchronization solution provided in the embodiment of the present application, it is allowed to configure the synchronization object indicating synchronization from the source data end to the target data end, that is, the configuration can be configured not only for the data table in the data table layer, but also for the identifier or name of each data end in the database layer. Here, when the configuration is used to indicate that the synchronization object is the identifier or name of the data end, it means that all data tables under the data end are synchronized.
[0061] It is easy to understand that Figure 2 The source data structure diagram shown is only used to illustrate the source data structure of the source data terminal library. In actual use, it can also include a "mode" layer, also known as a "schema" layer (not shown in the figure).
[0062] In specific implementation, the computer device can access the server where the source data end is located through a web page or a client, and then obtain the source data structure of the source data in the source data end. The computer device generates corresponding tree structure options based on the source data structure for the user to select the synchronization object.
[0063] 102. In response to the list configuration operation, obtain the synchronization list of the synchronization object.
[0064] In the embodiment of the present application, the computer device responds to the list configuration operation, and the computer device obtains the synchronization list of the synchronization objects configured by the user. The synchronization list is also called the black and white list, wherein the black list refers to the data that does not need to be synchronized, and the white list refers to the data that needs to be synchronized; the user can configure the blacklist according to the proportion of the synchronization objects to the total data on the source data end. For example, if the proportion of data that does not need to be synchronized is less than 10%, the user can configure the blacklist, and the computer device sets the data except the blacklist as the synchronization objects; conversely, if the proportion of data that needs to be synchronized is less than 10%, the user can configure the whitelist, and the computer device sets the selected objects in the whitelist as the synchronization objects to be synchronized.
[0065] It is understandable that users cannot set a piece of data in both the blacklist and whitelist. This application provides an example of blacklist and whitelist settings. The parent-level object selects the descendant synchronization object through the whitelist or blacklist. A single synchronization object can only use one of the whitelist and blacklist methods. If the parent-level object is selected, its subordinate child synchronization objects can continue to select grandchild synchronization objects, and multiple levels are processed in this way. A single synchronization object can only use one child synchronization object selection method, and different synchronization objects can use different child synchronization object selection methods; for example:
[0066] If the parent object is not selected, all its descendant synchronization objects will not be selected.
[0067] If the parent-level object selects a child-synchronization object through a whitelist, the child-synchronization object in the whitelist will be selected, and other child-synchronization objects under the parent-level object will not be selected, and multiple levels are processed in this way; if the parent-level object selects a child-synchronization object through a blacklist, the child-synchronization object in the blacklist will not be selected, and other child-synchronization objects under the parent-level object will be selected, and multiple levels are processed in this way.
[0068] In the embodiment of the present application, a synchronization list is configured for the synchronization object, and the computer device only needs to perform synchronization operations on the synchronization objects in the white list, thereby reducing the occurrence of erroneous synchronization.
[0069] 103. In response to the configuration operation of the mapping rule, obtain the mapping rule configured for the synchronization object; and / or obtain the mapping rule determined according to the classification of the leaf object corresponding to the synchronization object; the mapping rule is the mapping rule of the synchronization object from the source address to the target address; the number of levels of the source address is the same as or different from the number of levels of the target address.
[0070] The computer device responds to the configuration operation of the mapping rule. The computer device determines the mapping rule of the synchronization object from the source address to the target address according to the configuration operation of the mapping rule. The embodiment of the present application provides at least three mapping rule determination methods, specifically including:
[0071] Implementation method 1: Users manually configure mapping rules for synchronization objects at each level in the source data structure; for example, for synchronization objects, by extracting variables, use expressions to define how to map the table under the object to the mapping rules on the target side. Through this mapping rule, objects of any multiple layers can be synchronized, such as synchronizing the entire postgres instance. Taking the synchronization from postgres to mysql as an example, the system will extract the three variables SOURCE_DATABASE, SOURCE_SCHEAM, and SOURCE_TABLE, and the sub-tables are represented as the source database name, source schema name, and source table name. Users can set the mapping rules at the instance level as: concat(SOURCE_DATABASE,".",SOURCE_TABLE) or concat(SOURCE_DATABASE,"_",SOURCE_SCHEAM,".",SOURCE_TABLE), thereby completing the mapping of all tables. Where concat represents string concatenation; for the merge synchronization of sub-databases and sub-tables, a SQL-like expression can be used to define the mapping rules. For example, it is necessary to synchronize 10 sub-tables including t_0, t_1, ..., t_9 to the t1 table on the target end. At the same time, in the embodiment of the present application, the user can set the mapping rules at the instance level as follows: case when SOURCE_OBJECT like "t_[0-9]$" then concat(SOURCE_DATABASE,'.t1'); else concat(SOURCE_DATABASE,'.',SOURCE_OBJECT)end.
[0072] In the embodiment of the present application, the synchronization object is explained by taking a table as an example, and 10 tables in the source address are synchronized to the target address, so that the merge of the same level can be achieved. In addition, in the present embodiment, a table splitting operation can also be performed, that is, the data in one data table is synchronized to at least two data tables. In this implementation, the data synchronization operation can be a one-to-one synchronization, that is, one table is synchronized from the source address to another target address; in addition, the data synchronization operation can be a one-to-many synchronization, that is, one table is synchronized from the source address to another at least two target addresses; in addition, the data synchronization operation can be a many-to-one synchronization, that is, at least two tables are synchronized from the source address to another target address; the data synchronization method in the embodiment of the present application is more convenient and flexible.
[0073] Implementation method 2: The computer device automatically configures the mapping rules of the synchronization object, that is, the computer device determines that the synchronization object is a data table, and the computer device classifies the data table according to the attributes of the data table. Different categories are preset in the computer device, and each category corresponds to a rule. The computer device matches the data table in the configuration order. If the match is successful, it means that the data table belongs to the category, and no subsequent rule matching is performed; if the match fails, the subsequent classification rule matching continues. Contains a default category; if the data table does not match the classification rule, the data table belongs to the default category. Each category has one and only one mapping expression.
[0074] Implementation method three: The embodiment of the present application can combine implementation method one and implementation method two, that is, it supports both the user to manually configure the mapping rules of the synchronization object and the computer device to automatically configure the mapping rules.
[0075] In the embodiment of the present application, the mapping rules are configured on the synchronization objects of the nodes at each level of the source data structure corresponding to the source data end, and the mapping rules are the mapping between the leaf objects corresponding to the synchronization objects in the source address and the target leaf objects in the target address. For example, the synchronization object is a database, and the leaf objects corresponding to the synchronization object are data tables, but the mapping rules on the database are the mapping rules between the various data tables contained in the database, that is, in the implementation of the present application, the mapping rules corresponding to the leaf objects of the lowest level contained in the level are configured on the synchronization objects of each level, so that the mapping between different granularities, different numbers of levels, and different target data ends can be realized. In other words, the data synchronization in the implementation of the present application can meet different needs.
[0076] That is, the mapping rule in the embodiment of the present application is the mapping relationship between the leaf node and the leaf object. The leaf object is the smallest synchronization object. By setting the mapping relationship between the smallest synchronization objects, the objects at each level above the leaf object can also be synchronized, so that integrated synchronization of different granularities can be achieved.
[0077] It should be noted that a leaf object can be a data table, or a data object that is smaller than a data table. In this embodiment, the smallest synchronization object is a data table object. The data table can be used as the smallest data unit of the synchronization object. Therefore, when determining the target synchronization mode of the synchronization object according to the configuration, the corresponding target synchronization mode can be determined based on the relevant parameters of the data table in the configuration. For example, according to the number of data tables, the mapping relationship between the data table and the target address, etc.
[0078] Specifically, the mapping rule includes the data end identifier or data table identifier corresponding to the synchronization object, and the data end identifier or data table identifier corresponding to the target address. Therefore, when performing data synchronization operations according to the mapping rule, the identifier corresponding to the synchronization object and the identifier corresponding to the target address can also be used to determine the corresponding synchronization mode as the target synchronization mode for data synchronization. Here, when the identifier corresponding to the synchronization object is a database identifier, the content of synchronization is all data tables under the database.
[0079] 104. Perform data synchronization operations according to the synchronization object, the synchronization list, and the mapping rule.
[0080] In this embodiment, the synchronization list is a whitelist, and the mapping rule is a mapping rule indicating the synchronization of the synchronization object from the source address to the target address. In the specific implementation, the synchronization object is in the whitelist, and the mapping rule specifically includes a first statement for indicating the determination of the synchronization object from the source address, and a second statement for pointing the synchronization object to the target address. Among them, the first statement may include key fields in a preset source language library, and different key fields represent different data determination methods. Similarly, the second statement may also include key fields in a preset source language library, representing different data synchronization pointing methods. The computer device performs data synchronization according to the synchronization object, the synchronization list, and the mapping rule.
[0081] In the embodiment of the present application, a source data structure of source data in the source data terminal is pre-constructed. When the user performs data synchronization, the synchronization object to be synchronized in the source data structure is selected according to the data synchronization requirements. The synchronization object can be an instance, a database, a data model, a data table and other objects of different granularities. Then, a synchronization list and a mapping rule are configured for the synchronization object. Finally, data synchronization is performed according to the configured information. In this way, batch synchronization of different data granularity dimensions can be achieved, the data synchronization efficiency is improved, different personalized synchronization requirements are met, and the application scope of data synchronization is wider.
[0082] Optionally, in one embodiment of the present application, the computer device configures a scenario of a sub-synchronization object according to the configured synchronization object association, and after step 101, the following may be specifically included:
[0083] 1. Query the source data structure to which the synchronization object belongs, and determine the node corresponding to the synchronization object;
[0084] 2. If the synchronization object corresponds to a branch node, obtain the sub-synchronization objects corresponding to the nodes under the branch node; the sub-synchronization objects include: the hierarchical objects corresponding to the sub-branch nodes until the leaf objects corresponding to the leaf nodes;
[0085] 3. If the synchronization list of the sub-synchronization object is a whitelist, the sub-synchronization object and the synchronization object are associated and saved.
[0086] In the embodiment of the present application, the granularity of the synchronization object can be as large as an instance or as small as a data table; when configuring the synchronization object, in order to facilitate the configuration operation, the computer device in the embodiment of the present application automatically configures according to the synchronization object that the user has configured. Specifically, the computer device queries the source data structure to which the synchronization object belongs to determine the node corresponding to the synchronization object; if the synchronization object corresponds to a branch node, that is, there are nodes at the next level corresponding to the branch node of the synchronization object, the computer device obtains the sub-synchronization objects corresponding to the nodes below the branch node; the sub-synchronization objects include: the hierarchical objects corresponding to the sub-branch nodes up to the leaf objects corresponding to the leaf nodes; if the synchronization list of the sub-synchronization object is a whitelist, the computer device associates and saves the sub-synchronization object and the synchronization object to facilitate subsequent synchronization operations.
[0087] Optionally, in one embodiment of the present application, the computer device determines the synchronization list of the sub-synchronization object according to the synchronization list of the configured synchronization object, and the following steps after step 102 may be specifically included:
[0088] 1. If the synchronization object has an associated sub-synchronization object, determine whether the sub-synchronization object has been configured with a synchronization list;
[0089] 2. If the sub-synchronization object is not configured with a synchronization list, the synchronization list of the synchronization object is inherited by the sub-synchronization object;
[0090] 3. If the sub-synchronization object has been configured with a synchronization list, the synchronization list of the synchronization object is overwritten by the synchronization list of the sub-synchronization object.
[0091] After the synchronization list of the synchronization object in the embodiment of the present application is determined, the computer device determines the synchronization list of the sub-synchronization object, that is, the computer device determines that the synchronization object has a sub-synchronization object. For example, if the synchronization object is a database, there is a sub-synchronization object data model and a data table, and the computer device queries whether the sub-synchronization object has a configured synchronization list. That is, the key fields in the preset source data terminal may include a whitelist declaration field and a blacklist declaration field. The user can choose different declaration fields to edit the configuration according to the actual data synchronization requirements, and then determine whether the sub-object is configured with a synchronization list according to the declaration fields in the configuration. For example, the whitelist can be a whitelist key field such as "in()", wherein the bracket "()" can be filled with the identifier of the data table to be synchronized. For another example, the blacklist can be a blacklist key field such as "not in()", wherein the bracket "()" can be filled with the identifier of the prohibited synchronization data table.
[0092] If the sub-synchronization object is not configured with a synchronization list, the computer device inherits the synchronization list of the synchronization object through the sub-synchronization object. That is, if the synchronization object is a database and the database has been configured with a whitelist, the sub-synchronization object: the data model and data table automatically inherit the whitelist; or if the synchronization object is a database and the database has been configured with a blacklist, the sub-synchronization object data model and data table automatically inherit the blacklist.
[0093] If the sub-synchronization object has been configured with a synchronization list, the computer device will overwrite the synchronization list of the synchronization object with the synchronization list of the sub-synchronization object. That is, if the synchronization object is a database and the database has been configured with a whitelist, the computer device will automatically control the synchronization list of the sub-synchronization object to overwrite the synchronization list of the synchronization object regardless of whether the data mode and data table of the sub-synchronization object are blacklists or whitelists.
[0094] In this embodiment, the computer device configures the synchronization list of the sub-synchronization object according to the synchronization list of the synchronization object, so as to facilitate the user configuration operation. In the specific implementation, the white list or the black list can be selected according to the data volume of the synchronization object. For example, when the difference between the total number of data tables in the source address and the number of data tables to be synchronized is greater than the preset threshold, it means that the number of tables to be synchronized is less than the number of data tables that do not need to be synchronized, and it is suitable to use the white list at this time. For another example, when the difference between the total number of data tables and the number of tables to be synchronized is less than the preset threshold, it means that the number of tables to be synchronized is greater than the number of data tables that do not need to be synchronized, and it is suitable to use the black list at this time to exclude the prohibited synchronization data.
[0095] Through the above examples, it can be seen that when the number of tables to be synchronized is relatively small compared to the number of data tables that do not need to be synchronized, the whitelist is selected, and when the number of tables to be synchronized is relatively large compared to the number of data tables that do not need to be synchronized, the blacklist is selected. This can achieve the configuration requirements of data synchronization with as little configuration as possible, thereby reducing the code content of the data synchronization configuration.
[0096] See also Figure 3 , Figure 3 The data synchronization diagram in this embodiment is shown. Figure 1 As an example of data synchronization, Figure 3 As shown, in the process of synchronizing data from source address S1 to target data end D1, data tables t1-t999 in source address S1 are data tables to be synchronized corresponding to the synchronization object, and data table t1000 is a table other than the data table to be synchronized, that is, data table t1000 is a data table prohibited from synchronization. Here, the content in the data table to be synchronized is the content of the synchronization object. Figure 3 The identification information may be the number of the data table, that is, t1, t2, ..., t999.
[0097] Figure 3As shown, when the content of data tables t1 to t999 needs to be synchronized to the target data terminal D1, if the data synchronization script is configured for data tables t1 to t999, 999 statements need to be configured, which may easily lead to more configurations and occupy the resources of the computer device. Figure 3 In the example shown, the total number of data tables is t1-t1000, that is, 1000, and the preset threshold is 500. At this time, the number of tables to be synchronized is 999, and the difference between the total number of data tables and the number of tables to be synchronized is 1, which is less than the preset threshold of 500. A blacklist can be used in the configuration to synchronize the contents of data tables t1-t999 to the target data terminal D1.
[0098] As another example, assume that the total number of data tables is t1-t1000, that is, 1000, and the preset threshold is 500. At this time, the number of tables to be synchronized is 100, and the difference between the total number of data tables and the number of tables to be synchronized is 900, which is greater than the preset threshold 500. A whitelist can be used in the configuration to synchronize the contents of data tables t1-t500 to the target data terminal D1.
[0099] Optionally, in one embodiment of the present application, the computer device determines the mapping rule of the sub-synchronization object according to the mapping rule of the configured synchronization object, and step 103 may specifically include:
[0100] 1. If the synchronization object has an associated sub-synchronization object, determine whether the sub-synchronization object has been configured with a mapping rule;
[0101] 2. If the sub-synchronization object is not configured with a mapping rule, the mapping rule of the synchronization object is inherited by the sub-synchronization object;
[0102] 3. If the sub-synchronization object has been configured with a mapping rule, the mapping rule of the synchronization object is overwritten by the mapping rule of the sub-synchronization object.
[0103] The computer device determines whether the synchronization object has an associated sub-synchronization object, and determines whether the sub-synchronization object has been configured with mapping rules. If the sub-synchronization object is not configured with mapping rules, the computer device inherits the mapping rules of the synchronization object through the sub-synchronization object. For example, the database is configured with mapping rules, but the data table is not configured with mapping rules. Since the mapping rules of the database are refined to the minimum synchronization data level corresponding to the leaf node, the computer device can determine the mapping rules of the lower-level data tables of the database based on the mapping rules of the database, and the computer device inherits the mapping rules of the database for the data table.
[0104] If the sub-synchronization object has been configured with mapping rules, the computer device will overwrite the mapping rules of the synchronization object with the mapping rules of the sub-synchronization object. That is, in the data synchronization method in this embodiment, the computer device will overwrite the mapping rules of the synchronization object with the mapping rules of the sub-synchronization object, which can meet the user's data synchronization needs.
[0105] Combination Figure 2 As shown in the schematic diagram of the source data structure, the source data structure may include two layers of structures, namely, the "database layer" and the "data table layer". The computer device may set mapping rules at each level of the source data structure. For the sake of distinction, we call the mapping rules of the "database layer" the mapping rules of the first level, and the mapping rules of the "data table layer" the mapping rules of the second level. Furthermore, if the source data structure is three levels, such as the postgres data end may include the database layer, the schema layer (schema) and the data table layer, the mapping rules of the corresponding level may also be configured for each data layer, which will not be elaborated here. In addition, if there are multiple data ends in the example, the above-mentioned different level mapping rules may also be used in the configuration of each data end.
[0106] In this embodiment, the synchronization object includes a first data table to be synchronized and a second data table to be synchronized. Here, the synchronization object can be understood as a data table set, which can include two other data table subsets, namely, a first data table set to be synchronized and a second data table set to be synchronized, wherein each data table in the first data table set to be synchronized is a first data table to be synchronized, and each data table in the second data table set to be synchronized is a second data table to be synchronized, and the computer device can merge the first data table to be synchronized and the second data table to be synchronized into one data table, or split the first data table to be synchronized and the second data table to be synchronized into more target addresses to form at least two target data tables.
[0107] It should be noted that in some data synchronization scenarios, when it is necessary to synchronize the synchronization object in the source address to two or more target data terminals, the existing data synchronization solutions do not support cross-data terminal synchronization. This embodiment determines the first data table to be synchronized and the second data table to be synchronized from the source address by considering the mapping rules of the first level and the mapping rules of the second level at the same time, and synchronizes the first data table to be synchronized to the first target table in the first target terminal, and synchronizes the second data table to be synchronized to the second target table in the second target terminal, thereby realizing the synchronization of the synchronization object in the source address to multiple target data terminals.
[0108] See also Figure 4 , Figure 4 The data synchronization diagram in this embodiment is shown. Figure 2 As an example of data synchronization, Figure 4As shown, all data tables (t1~t1000) in the source address S1 are data tables to be synchronized, among which the first part of the synchronization objects are data tables (t1~t999), which are synchronized to the target data end D1, and the second part of the synchronization objects are data table t1000, which are synchronized to the target data end D2.
[0109] If an existing configuration scheme is selected, it is necessary to configure synchronization tasks for the first part of the synchronization object, which is the data table (t1~t999) and the second part of the synchronization object, which is the data table t1000. Not only can data synchronization not be performed at the same time, but there are also many configurations, which is prone to errors. However, when using the scheme of this embodiment, the first-level mapping rule can be used to declare the data table (t1~t1000) in the source address S1 as the first data table to be synchronized, and the target table (t1~t1000) in the target data end D1 as the first target table. Then, the second-level mapping rule is used to declare the data table (t1000) in the source address S1 as the second data table to be synchronized, and the target table (t1000) in the target data end D1 as the second target table. In this way, while ensuring the accuracy of data synchronization, data synchronization operations across data ends can also be implemented, thereby improving data synchronization efficiency.
[0110] by Figure 4 Taking the schematic diagram shown as an example, in the specific implementation, variables can be pre-defined: SOURCE_DATABASE represents the source address name S1, and SOURCE_OBJECT represents the table names t1, t2, ..., t1000 in the source address. The corresponding first-level mapping rules can be:
[0111] objects:
[0112] databses:
[0113] name:S1
[0114] The mapping rule is configured at the source address S1, specifically, the mapping rule is configured on the source address S1. Here, the mapping rule is: the data table corresponding to the first part of the synchronization object in the source address S1 (t1~t1000) is mapped to the target table (t1~t1000) in the target data end D1. The mapping rule can be expressed as: S1.SOURCE_OBJECT->D1.SOURCE_OBJECT. Since S1.SOURCE_OBJECT represents all tables in the source address S1, it is only necessary to configure the mapping rule concat('D1.',SOURCE_OBJECT), where the concat function represents the concatenation of strings. The corresponding statement is "targetName:concat('d1.',SOURCE_OBJECT)". Since in Figure 4In the example, the data table t1000 in the source address S1 is mapped to the target table t1000 in the target data end D2. Therefore, based on the above statement, the second-level mapping rule needs to be configured. For example:
[0115] modifies:
[0116] name:t1000
[0117] targetName:D2.t1000
[0118] It is used to describe the conditions for determining the second data table to be synchronized from the first data table to be synchronized, that is, taking the one thousandth data table t1000 of the source address S1 as the second data table to be synchronized, and establishing a mapping relationship with the second target table t1000 in the target data end D2, that is, describing that the table to be synchronized t1000 in the source address S1 is mapped to the target table in the target data end D2 as D2.t1000.
[0119] In this embodiment, the first-level mapping rules, as higher-level nodes, can declare data tables that need to be synchronized in the largest possible scope. Combined with the second-level mapping rules to describe the conditions for determining the second data table to be synchronized from the first data table to be synchronized, the second data table to be synchronized can be distinguished from a smaller granularity based on the determination of the first data table to be synchronized, thereby providing an implementation method for meeting different data synchronization requirements.
[0120] In the steps of this embodiment, each set of data tables to be synchronized in the multiple sets of data tables to be synchronized in the source data end includes two or more data tables to be synchronized. Here, for a single set of data tables to be synchronized, the identification information of the two or more data tables to be synchronized has the same field. Based on this, the target mapping rule can be used to declare the two or more data tables to be synchronized corresponding to the identification information with the same field as synchronization objects, and then synchronized to the corresponding target table.
[0121] It should be noted that for data tables configured in the same data terminal, their identification information has certain similarities. In specific implementation, key fields that can summarize similar data tables can be configured in the preset source language library to summarize data terminals with the same fields in the identification information. The mapping rules use the above-mentioned key fields to summarize similar data tables for data synchronization.
[0122] Optionally, in one embodiment of the present application, the computer device determines a mapping rule according to the classification of the synchronization object corresponding to the leaf object, and step 103 may specifically include:
[0123] 1. Obtain the leaf object corresponding to the synchronization object and the object properties of the leaf object;
[0124] 2. Classify the leaf objects according to the object attributes of the leaf objects to obtain target classification;
[0125] 3. Query the preset mapping table to obtain the mapping rules corresponding to the target classification.
[0126] The computer device obtains the leaf object corresponding to the synchronization object, and the object attributes of the leaf object. The object attributes refer to the attributes of the data table. The object attributes of the data table refer to the columns in the table, also known as fields. Each attribute has a name and a data type, which is used to store the data in the table. The attributes define the characteristics of each record in the table. For example, in a "student" table, the attributes may include "name", "age", "gender", etc. The attributes may also have other attributes, such as constraints, which are used to limit the range of attribute values or ensure the integrity of the data. The computer device classifies according to the object attributes of the data table to obtain a target classification. Furthermore, a preset mapping table is preset in the computer device, and the preset mapping table contains mapping rules corresponding to different classifications. The computer device obtains the mapping rules corresponding to the target classification.
[0127] That is, the computer device classifies the leaf objects according to the object properties of the leaf objects; if there is no matching classification, the computer device sets the preset default classification as the target classification; if there is a matching classification, the computer device sets the matching classification as the target classification; if there are at least two matching classifications, the computer device obtains the target classification with the highest classification priority, wherein the setting method of the classification priority is not limited, that is, in the embodiment of the present application, the classification priority can be determined based on the matching degree of the classification or the assigned matching order.
[0128] In the embodiment of the present application, classification is performed according to object attributes, each classification has a rule, and a data table may match multiple rules. The rules match the data table in the configuration order. If the match is successful, it means that the data table belongs to the classification, and no subsequent rule matching is performed; if the match fails, the subsequent classification rule matching continues. Contains a default classification; if the data table does not match the classification rule, the data table belongs to the default classification. Each classification has one and only one mapping expression, so that the mapping rules can be automatically configured to facilitate data synchronization operations.
[0129] See also Figure 5 , Figure 5 The data synchronization diagram in this embodiment is shown. Figure 3 As an example of data synchronization, Figure 5As shown, the source address S1 contains 1000 data tables (t0_00, ..., t9_99), which need to be synchronized to the target table (t0, ..., t9) on the target data terminal D1. That is, every 10 data tables in the source address S1 are a set of tables to be synchronized, corresponding to a target table synchronized to the target data terminal D1.
[0130] In the specific implementation, one rule can be used to indicate that 1000 data tables (t0_00, ..., t0_99) in the source address S1 are mapped to the target end t0, that is, the data table name of the source address S1 is represented by the string "t0_" plus two numbers. The SQL-like syntax is used: the data table of the source address S1 that meets the condition of SOURCE_OBJECT like't0_%' is mapped to the target table D1.t0 of the target data end D1. Among them, "%" represents any string. SOURCE_OBJECT like't0_%' means that SOURCE_OBJECT starts with the string "t0_". Similarly, other data tables can also be expressed using the above mapping rules. Then, the above rules are combined together using the "case when" method to obtain the mapping rules corresponding to the classification.
[0131] In the specific implementation, you can also choose different ways to edit the configuration according to your needs, and then declare the set of tables to be synchronized corresponding to each target table in different ways.
[0132] As an embodiment, a mapping rule between each target table and the set of tables to be synchronized may be configured; each set of data tables to be synchronized may be determined from the source address according to the mapping rule, and each set of data tables to be synchronized may be synchronized to the corresponding target table.
[0133] In this embodiment, the mapping rule refers to a method for determining a set of tables to be synchronized from a source address. By using the mapping rule to determine a corresponding set of tables to be synchronized from a source address, synchronization configuration of multiple sets of tables to be synchronized can be achieved at the same time.
[0134] by Figure 5Taking the schematic diagram shown as an example, assuming that all data table names of the source address S1 are in this format: the target table in the target data end + underscore + two numbers, this format can be expressed using a standard regular expression: "^(.*)_[0-9]{2}$". Among them, "^" represents the beginning of the string, "(.*)" represents the remaining characters from the beginning to the underscore, and is represented by $1. [0-9] represents the numbers 0, 1, ... 9. "{2}" represents two consecutive previous rules (here: [0-9]), and "$" represents the end. The regular function regexp_match is used to determine whether the data table name of the source address S1 hits this regular expression. The first parameter is the data table name of the source address S1, and the second parameter is the mapping rule. If the mapping rule is hit, the target table name of the target data end is extracted, which is $1 here. In this way, each set of data tables to be synchronized corresponding to each target table is merged into one rule, thereby further simplifying the configuration.
[0135] In this example, if the source address S1 adds a sub-table, such as t100_00, t100_01, ..., t100_99, it can also be mapped to the target table t100 of the target data end D1 at the same time. That is, generating a mapping rule between each target table and the set of tables to be synchronized can meet the synchronization requirements of synchronizing the newly added data table in the source address to the target table of the target data end.
[0136] See also Figure 6 , Figure 6 1 is a structural block diagram of a data synchronization device provided in an embodiment of the present application. In this embodiment, the data synchronization device includes various units for executing Figures 1 to 5 For details, please refer to the steps in the corresponding embodiment. Figures 1 to 5 ,as well as Figures 1 to 5 For the convenience of explanation, only the parts related to this embodiment are shown. Figure 6 , a data synchronization device, comprising:
[0137] The object configuration module 201 is used to respond to the data configuration operation and obtain the synchronization object to be synchronized based on the source data structure configuration, wherein the synchronization object includes the hierarchical object corresponding to the branch node and the leaf object corresponding to the leaf node;
[0138] A list configuration module 202, for responding to the list configuration operation and obtaining a synchronization list of the synchronization object;
[0139] A rule determination module 203 is used to respond to the configuration operation of the mapping rule, obtain the mapping rule configured for the synchronization object; and / or obtain the mapping rule determined according to the classification of the leaf object corresponding to the synchronization object; the mapping rule is the mapping rule of the synchronization object from the source address to the target address; the number of levels of the source address is the same as or different from the number of levels of the target address;
[0140] The data synchronization module 204 is used to perform data synchronization operations according to the synchronization object, the synchronization list, and the mapping rule.
[0141] It should be understood that the data synchronization device provided in this embodiment is configured to execute Figures 1 to 5 The steps in the corresponding embodiments, and for Figures 1 to 5 Each step in the corresponding embodiment has been explained in detail in the above embodiment. Figures 1 to 5 ,as well as Figures 1 to 5 The relevant descriptions in the corresponding embodiments are not repeated here.
[0142] Figure 7 is a structural block diagram of a computer device provided in an embodiment of the present application. Figure 7 As shown, the computer device 5 of this embodiment includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50, such as a program of the data synchronization method. When the processor 50 executes the computer program 52, the steps in each embodiment of the above-mentioned data synchronization method are implemented, such as Figure 1 Alternatively, the processor 50 implements the above steps when executing the computer program 52 Figure 6 The functions of each unit in the corresponding embodiment. Please refer to Figure 6 The relevant descriptions in the corresponding embodiments are not repeated here.
[0143] Exemplarily, the computer program 52 may be divided into one or more units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 52 in the computer device 5. For example, the computer program 52 may be divided into an acquisition unit, a determination unit, and a synchronization unit, and the specific functions of each unit are as described above.
[0144] The computer device may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art will appreciate that Figure 7It is only an example of the computer device 5 and does not constitute a limitation of the computer device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0145] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0146] The memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or memory of the computer device 5. The memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the computer device 5. The memory 51 is used to store the computer program and other programs and data required by the computer device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
[0147] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data synchronization method, characterized in that: include: In response to the data configuration operation, a synchronization object to be synchronized configured based on the source data structure is obtained, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node; In response to the list configuration operation, a synchronization list of the synchronization object is obtained; In response to the configuration operation of the mapping rule, the mapping rule configured for the synchronization object is obtained; and / or, the mapping rule is determined according to the classification of the leaf object corresponding to the synchronization object; the mapping rule is a mapping rule from the source address to the target address of the synchronization object; the number of levels of the source address is the same as or different from the number of levels of the target address; A data synchronization operation is performed according to the synchronization object, the synchronization list, and the mapping rule.
2. The method according to claim 1, characterized in that After the response data configuration operation obtains the synchronization object to be synchronized configured based on the source data structure, the method further includes: Query the source data structure to which the synchronization object belongs, and determine the node corresponding to the synchronization object; If the synchronization object corresponds to a branch node, then the sub-synchronization objects corresponding to the nodes under the branch node are obtained; the sub-synchronization objects include: the hierarchical objects corresponding to the sub-branch nodes until the leaf objects corresponding to the leaf nodes; If the synchronization list of the sub-synchronization object is a whitelist, the sub-synchronization object and the synchronization object are associated and saved.
3. The method according to claim 1, characterized in that After the response list configuration operation is performed to obtain the synchronization list of the synchronization object, the method further includes: If the synchronization object has an associated sub-synchronization object, determining whether the sub-synchronization object has been configured with a synchronization list; If the sub-synchronization object is not configured with a synchronization list, the synchronization list of the synchronization object is inherited through the sub-synchronization object; If the sub-synchronization object has been configured with a synchronization list, the synchronization list of the synchronization object is overwritten by the synchronization list of the sub-synchronization object.
4. The method according to claim 1, characterized in that After the configuration operation of the response mapping rule is performed and the mapping rule configured for the synchronization object is obtained, the method further includes: If the synchronization object has an associated sub-synchronization object, determining whether the sub-synchronization object has been configured with a mapping rule; If the sub-synchronization object is not configured with a mapping rule, the mapping rule of the synchronization object is inherited by the sub-synchronization object; If the sub-synchronization object has been configured with a mapping rule, the mapping rule of the synchronization object is overwritten by the mapping rule of the sub-synchronization object.
5. The method according to claim 1, characterized in that The mapping rule is configured on the synchronization object of each level node of the source data structure corresponding to the source data end, and the mapping rule is a mapping between the leaf object corresponding to the synchronization object in the source address and the target leaf object in the target address.
6. The method according to any one of claims 1 to 5, characterized in that: The obtaining of a mapping rule determined according to the classification of the synchronization object corresponding to the leaf object includes: Obtain the leaf object corresponding to the synchronization object and the object properties of the leaf object; Classifying the leaf objects according to the object attributes of the leaf objects to obtain target classifications; Query the preset mapping table to obtain the mapping rules corresponding to the target classification.
7. The method according to claim 6, characterized in that The step of classifying the leaf objects according to the object attributes of the leaf objects to obtain target classifications includes: Classifying the leaf objects according to object attributes of the leaf objects; If there is no matching category, the preset default category is set as the target category; If there is a matching category, the matching category is set as the target category; If there are at least two matching categories, the target category with the highest classification priority is obtained.
8. A data synchronization device, characterized in that: The data synchronization device comprises: An object configuration module, for responding to a data configuration operation, obtaining a synchronization object to be synchronized based on a source data structure configuration, wherein the synchronization object includes a hierarchical object corresponding to a branch node and a leaf object corresponding to a leaf node; A list configuration module, used to respond to the list configuration operation and obtain the synchronization list of the synchronization object; A rule determination module, for responding to a configuration operation of a mapping rule, obtaining a mapping rule configured for the synchronization object; and / or obtaining a mapping rule determined according to the classification of leaf objects corresponding to the synchronization object; the mapping rule is a mapping rule for the synchronization object from a source address to a target address; the number of levels of the source address is the same as or different from the number of levels of the target address; The data synchronization module is used to perform data synchronization operations according to the synchronization object, the synchronization list, and the mapping rule.
9. A computer device, characterized in that: The computer device comprises: a memory, a processor, and a computer program stored in the memory and executable on the computer device, and the processor implements the data synchronization method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data synchronization method according to any one of claims 1 to 7 is implemented.