Kettle-based data synchronization method and system, electronic equipment and storage medium

Kettle technology dynamically parses and executes the data conversion process, which solves the problem of low efficiency of manual data synchronization in the existing technology, achieves efficient and accurate data synchronization, and reduces the coupling between systems.

CN118606331APending Publication Date: 2024-09-06BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410649772.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In the existing technology, data synchronization between old and new systems mainly relies on manual methods, which results in inefficiency and error-prone. Especially when enterprise business is supported by large-base systems, the amount of data is large and there are many systems, and manual synchronization is difficult to meet efficient needs.

Method used

Using the Kettle-based data synchronization method, by obtaining Kettle configuration information and conversion script files, dynamically parsing and executing the data conversion process, data synchronization between the initial data source and the target data source is achieved, and timing and automated operations are supported.

Benefits of technology

It improves the efficiency and accuracy of data synchronization, reduces manual intervention, realizes efficient data conversion between any specified data sources, and enhances the decoupling between systems and the effectiveness of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606331A
    Figure CN118606331A
Patent Text Reader

Abstract

The invention discloses a kettle-based data synchronization method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining kettle configuration information in response to a configuration operation; the kettle configuration information comprises data sources and database information corresponding to the data sources, and the data sources comprise an initial data source and a target data source; obtaining a kettle conversion script file corresponding to the initial data; the initial data is obtained from an initial data source; the kettle conversion script file is used for indicating to convert the initial data into target data; and dynamically analyzing the kettle conversion script file according to the kettle configuration information, converting the initial data into the target data, and writing the target data into the target data source. Thus, the kettle conversion script file corresponding to the initial data is dynamically analyzed based on the kettle configuration information, and the target data obtained after the initial data is converted is obtained, so that data twisting between any specified initial data source and the target data source is achieved, and the data synchronization effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data updating, and in particular to a kettle-based data synchronization method, system, electronic device and storage medium. Background Art

[0002] As the business of an enterprise continues to grow, the system is constantly updated and iterated. The new system does not directly replace the old system. Usually, the new and old systems support the business in parallel. For the design of a new system, it is generally necessary to achieve compatibility between the new and old systems and data synchronization between the new and old systems. In other words, if the system is upgraded, it is inevitable to synchronize the data of the old system associated with it.

[0003] Currently, data synchronization between old and new systems is done manually. However, enterprise business is usually supported by a large number of systems, which means that there are many systems that need to be synchronized and the amount of data is large. Manual data synchronization is not only prone to errors but also extremely time-consuming, making data synchronization ineffective. Summary of the invention

[0004] The present application provides a kettle-based data synchronization method, system, electronic device and storage medium, which can realize data reversal between any specified data sources and improve the effectiveness of data synchronization.

[0005] In a first aspect, the present application further provides a kettle-based data synchronization method, which is applied to a kettle-based data synchronization system, and the method includes:

[0006] In response to the configuration operation, kettle configuration information is obtained; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source;

[0007] Obtaining a kettle conversion script file corresponding to initial data; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct to convert the initial data into target data;

[0008] The kettle conversion script file is dynamically parsed according to the kettle configuration information, the initial data is converted into the target data, and the target data is written into the target data source.

[0009] Optionally, dynamically parsing the kettle conversion script file according to the kettle configuration information, converting the initial data into the target data, and writing the target data into the target data source includes:

[0010] The kettle conversion script file is dynamically parsed according to the kettle configuration information according to a preset time interval, the initial data is converted into the target data, and the target data is written into the target data source.

[0011] Optionally, dynamically parsing the kettle conversion script file according to the kettle configuration information to convert the initial data into the target data includes:

[0012] Dynamically parse the kettle conversion script file according to the kettle configuration information to obtain the target conversion process;

[0013] According to the target conversion process, the initial data is converted into the target data.

[0014] Optionally, the kettle conversion script file includes conversion process configuration parameters, and dynamically parsing the kettle conversion script file according to the kettle configuration information to obtain a target conversion process includes:

[0015] The initial configuration parameters of the conversion process in the kettle conversion script file are replaced with the kettle configuration information to obtain the target conversion process.

[0016] Optionally, converting the initial data into the target data according to the target conversion process includes:

[0017] Based on the database information of the initial data source, acquiring the initial data from the initial data source;

[0018] The initial data is converted into the target data.

[0019] Optionally, the database information includes data type and link information, and the acquiring the initial data from the initial data source based on the database information of the initial data source includes:

[0020] After determining that the data type of the initial data source is consistent with the data type of the target data source, the initial data is acquired from the initial data source based on the link information of the initial data source.

[0021] Optionally, the method further comprises:

[0022] In response to a writing operation based on business requirements, the kettle conversion script file is generated.

[0023] In a second aspect, the present application provides a kettle-based data synchronization system, the system comprising a front-end system and a back-end system, wherein:

[0024] The front-end system is used to obtain kettle configuration information in response to a configuration operation; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source;

[0025] The front-end system is further used to obtain a kettle conversion script file corresponding to the initial data; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct to convert the initial data into target data;

[0026] The back-end system is used to dynamically parse the kettle conversion script file according to the kettle configuration information, convert the initial data into the target data, and write the target data into the target data source.

[0027] Optionally, the backend system is specifically used for:

[0028] The kettle conversion script file is dynamically parsed according to the kettle configuration information according to a preset time interval, the initial data is converted into the target data, and the target data is written into the target data source.

[0029] Optionally, the backend system is specifically used for:

[0030] Dynamically parse the kettle conversion script file according to the kettle configuration information to obtain the target conversion process;

[0031] According to the target conversion process, the initial data is converted into the target data.

[0032] Optionally, the kettle conversion script file includes conversion process configuration parameters, and the backend system is specifically used to:

[0033] The initial configuration parameters of the conversion process in the kettle conversion script file are replaced with the kettle configuration information to obtain the target conversion process.

[0034] Optionally, the backend system is specifically used for:

[0035] Based on the database information of the initial data source, acquiring the initial data from the initial data source;

[0036] The initial data is converted into the target data.

[0037] Optionally, the database information includes data type and link information, and the backend system is specifically used to:

[0038] After determining that the data type of the initial data source is consistent with the data type of the target data source, the initial data is acquired from the initial data source based on the link information of the initial data source.

[0039] Optionally, the front-end system is further used for:

[0040] In response to a writing operation based on business requirements, the kettle conversion script file is generated.

[0041] In a third aspect, the present application further provides an electronic device, the electronic device comprising a processor and a memory:

[0042] The memory is used to store computer programs;

[0043] The processor is used to execute the kettle-based data synchronization method provided in the first aspect according to the computer program.

[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the kettle-based data synchronization method provided in the first aspect above.

[0045] It can be seen that this application has the following beneficial effects:

[0046] The present application provides a data synchronization method, system, electronic device and storage medium based on kettle, which is applied to a data synchronization system based on kettle, in which, in response to a configuration operation, kettle configuration information is obtained; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source; a kettle conversion script file corresponding to the initial data is obtained; the initial data is obtained from the initial data source; the kettle conversion script file is used to indicate that the initial data is converted into target data; the kettle conversion script file is dynamically parsed according to the kettle configuration information, the initial data is converted into the target data, and the target data is written into the target data source. In this way, the initial data in the specified initial data source is obtained, the kettle conversion script file corresponding to the initial data is dynamically parsed based on the kettle configuration information, the target data after the initial data is converted is obtained, and the target data is written into the specified target data source, thereby realizing the data reversal between any specified initial data source and target data source, and improving the effectiveness of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0048] Figure 1 A flowchart of a kettle-based data synchronization method in an embodiment of the present application;

[0049] Figure 2 A schematic diagram of the structure of a kettle-based data synchronization system 200 provided in an embodiment of the present application;

[0050] Figure 3 A schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The multiple involved in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the words "first", "second", etc. are only used for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0052] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In addition, it should be noted that, for ease of description, only the parts related to the present application are shown in the accompanying drawings, not all structures.

[0053] Currently, data synchronization between old and new systems is done manually. However, enterprise business is usually supported by a large number of systems, which means that there are many systems that need to be synchronized and the amount of data is large. Manual data synchronization is not only prone to errors but also extremely time-consuming, making data synchronization ineffective.

[0054] An embodiment of the present application provides a kettle-based data synchronization method, system, electronic device and storage medium, the method is applied to a kettle-based data synchronization system, in which, in response to a configuration operation, kettle configuration information is obtained; the kettle configuration information includes a data source and database information corresponding to the data source, the data source includes an initial data source and a target data source; a kettle conversion script file corresponding to the initial data is obtained; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct the initial data to be converted into target data; the kettle conversion script file is dynamically parsed according to the kettle configuration information, the initial data is converted into the target data, and the target data is written into the target data source.

[0055] In this way, the initial data in the specified initial data source is obtained, the kettle conversion script file corresponding to the initial data is dynamically parsed based on the kettle configuration information, the target data after the initial data is converted is obtained, and the target data is written to the specified target data source, thereby realizing data reversal between any specified initial data source and target data source, thereby improving the effectiveness of data synchronization.

[0056] To facilitate understanding of the specific implementation of the kettle-based data synchronization method provided in the embodiment of the present application, it will be described below with reference to the accompanying drawings.

[0057] See also Figure 1 , Figure 1 A flowchart of a kettle-based data synchronization method provided in an embodiment of the present application is provided. The method can be applied to a kettle-based data synchronization system. The kettle-based data synchronization system can be, for example, Figure 2 A kettle-based data synchronization system 200 is shown.

[0058] In the embodiment of the present application, kettle (Pentaho Data Integration, PDI) is an open source tool for implementing Extract-Transform-Load (ETL), which may include the following steps:

[0059] S101: In response to a configuration operation, obtain kettle configuration information.

[0060] It should be noted that the kettle configuration information includes the data source and the database information corresponding to the data source, and the data source includes the initial data source and the target data source. The number of the initial data source can be one or more, and the number of the target data source can be one or more, which does not affect the implementation of the embodiment of the present application.

[0061] S102: Obtain a kettle conversion script file corresponding to the initial data.

[0062] It should be noted that the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct the conversion of the initial data into the target data.

[0063] As an example, the kettle conversion script file can be a .ktr file written by the front end. The .ktr file is a tool of kettle for saving XML format files of transformation (Transformation), that is, KettleTransformation file. In the embodiment of the present application, the .ktr file written in the front-end system, that is, the user can use the graphical user interface (Graphical User Interface, GUI) of kettle to design the conversion process by dragging and connecting different steps, and then after completing the design, save the conversion process as a .ktr file for subsequent rapid acquisition to achieve data synchronization. It should be noted that the writing of .ktr files by the front end is usually an iterative process, and the conversion process can be continuously adjusted and optimized according to business needs and data source characteristics to obtain the best data processing effect.

[0064] In a possible implementation, after obtaining the kettle conversion script file, the conversion logic corresponding to the kettle conversion script file may be adjusted accordingly according to business requirements, so as to obtain a kettle conversion script file that better meets business requirements.

[0065] In a possible implementation, the kettle conversion script file is pre-written based on business requirements, and the method provided in the embodiment of the present application may further include: generating a kettle conversion script file in response to a writing operation based on business requirements.

[0066] It should be noted that the kettle conversion script file includes a general kettle conversion script file and a customized kettle conversion script file. In one possible implementation, if the business requirement is common steps such as data extraction, data cleaning or data conversion, a general kettle conversion script file can be created in response to a writing operation based on general business requirements. In another possible implementation, if the ETL process needs to include specific data conversion logic, a customized kettle conversion script file can be created in response to a writing operation based on special business requirements, so that the corresponding kettle conversion script file can be quickly selected when the initial data is to be converted later, avoiding repeated creation of the same ETL process, and improving the efficiency of data conversion to a certain extent.

[0067] It should be noted that a customized kettle conversion script file can be created based on a blank template or on the basis of a general kettle conversion script file, neither of which affects the implementation of the embodiments of the present application; the general kettle conversion script file and the customized kettle conversion script file are not mutually exclusive, and a kettle conversion script file matching the initial data can be obtained according to actual business needs, such as a kettle conversion script file A and a customized kettle conversion script file B, or a kettle conversion script file B and a customized kettle conversion script file A, neither of which affects the implementation of the embodiments of the present application.

[0068] S103: Dynamically parse the kettle conversion script file according to the kettle configuration information, convert the initial data into target data, and write the target data into the target data source.

[0069] In a possible implementation, S103 may be executed according to a preset time interval, thereby realizing the timing and automation of data conversion, achieving real-time updating of data, reducing the need for manual intervention, and improving the efficiency of data conversion.

[0070] In a possible implementation, S103 provided in the embodiment of the present application may include S1031, dynamically parsing the kettle conversion script file according to the kettle configuration information to obtain the target conversion process; S1032, converting the initial data into target data according to the target conversion process.

[0071] In a possible implementation, the kettle conversion script file includes conversion process configuration parameters, and S1031 may include: replacing the conversion process initial configuration parameters in the kettle conversion script file with the kettle configuration information to obtain the target conversion process.

[0072] That is to say, while dynamically parsing the kettle conversion script file, the kettle engine will use the read kettle configuration information to replace the parameters in the kettle conversion script file. The kettle configuration information, for example, includes the database information of the initial data source A or the database information of the target data source B. Then, the target conversion process obtained by dynamic parsing can synchronize the data in the initial data source A to the target data source B. If the kettle configuration information includes the database information of the initial data source A' or the database information of the target data source B', then the target conversion process obtained by dynamic parsing can synchronize the data in the initial data source A' to the target data source B'. That is, through the method provided in the embodiment of the present application, there is no need to modify the kettle conversion script file itself, and the data conversion logic can be flexibly adjusted through different kettle configuration parameters, thereby realizing data synchronization between the corresponding initial data source and the target data source.

[0073] It should be noted that it is the reusability of the kettle conversion script file that reduces code duplication, makes the data conversion logic more modular, and thus reduces the coupling between systems.

[0074] In a possible implementation, S1032 may include: obtaining initial data from the initial data source based on the database information of the initial data source; converting the initial data into target data. It should be noted that the database information includes data types and link information. The method provided in the embodiment of the present application may include: after determining that the data type of the initial data source is consistent with the data type of the target data source, obtaining initial data from the initial data source based on the link information of the initial data source. In this way, after determining that the data types of the initial data source and the target data source are consistent, the conversion is performed, which can avoid the problem of data mismatch, ensure the accuracy of data synchronization to a certain extent, and improve the efficiency of data synchronization.

[0075] In a possible implementation, log recording can be performed after S103 so that problems arising during the data reversal process can be discovered and solved in a timely manner, that is, the problems are isolated at the data source level for processing, avoiding the impact on the system and reducing the dependence and coupling between systems to a certain extent.

[0076] In this way, through the method provided in the embodiment of the present application, the initial data in the specified initial data source is obtained, the kettle conversion script file corresponding to the initial data is dynamically parsed based on the kettle configuration information, the target data after the conversion of the initial data is obtained, and the target data is written to the specified target data source, thereby realizing data reversal between any specified initial data source and target data source, separating the business logic and data of the business system, reducing the coupling between systems, and being able to realize efficient data reversal between any specified data sources, thereby improving the accuracy and efficiency of data synchronization, that is, improving the effectiveness of data synchronization.

[0077] See also Figure 2 , Figure 2 A schematic diagram of a kettle-based data synchronization system 200 provided in an embodiment of the present application is provided. The system 200 includes a front-end system 201 and a back-end system 202, wherein:

[0078] The front-end system 201 is used to obtain kettle configuration information in response to a configuration operation; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source;

[0079] The front-end system 201 is further used to obtain a kettle conversion script file corresponding to the initial data; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct to convert the initial data into target data;

[0080] The backend system 202 is used to dynamically parse the kettle conversion script file according to the kettle configuration information, convert the initial data into the target data, and write the target data into the target data source.

[0081] Optionally, the backend system 202 is specifically used for:

[0082] The kettle conversion script file is dynamically parsed according to the kettle configuration information according to a preset time interval, the initial data is converted into the target data, and the target data is written into the target data source.

[0083] Optionally, the backend system 202 is specifically used for:

[0084] Dynamically parse the kettle conversion script file according to the kettle configuration information to obtain the target conversion process;

[0085] According to the target conversion process, the initial data is converted into the target data.

[0086] Optionally, the kettle conversion script file includes conversion process configuration parameters, and the backend system 202 is specifically used for:

[0087] The initial configuration parameters of the conversion process in the kettle conversion script file are replaced with the kettle configuration information to obtain the target conversion process.

[0088] Optionally, the backend system 202 is specifically used for:

[0089] Based on the database information of the initial data source, acquiring the initial data from the initial data source;

[0090] The initial data is converted into the target data.

[0091] Optionally, the database information includes data type and link information, and the backend system 202 is specifically used for:

[0092] After determining that the data type of the initial data source is consistent with the data type of the target data source, the initial data is acquired from the initial data source based on the link information of the initial data source.

[0093] Optionally, the front-end system 201 is further used for:

[0094] In response to a writing operation based on business requirements, the kettle conversion script file is generated.

[0095] It should be noted that the specific implementation of the system 200 and the technical effects achieved can be found in Figure 1 The relevant description in the method shown.

[0096] In addition, the present application embodiment also provides an electronic device 300, such as Figure 3 As shown, the electronic device 300 includes a processor 301 and a memory 302:

[0097] The memory 302 is used to store computer programs;

[0098] The processor 301 is used to execute according to the computer program Figure 1 The kettle-based data synchronization method provided.

[0099] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the kettle-based data synchronization method provided in an embodiment of the present application.

[0100] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0101] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, in which the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the goals of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0102] The above is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.

Claims

1. A kettle-based data synchronization method, characterized in that: Applied to a kettle-based data synchronization system, the method includes: In response to the configuration operation, kettle configuration information is obtained; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source; Obtaining a kettle conversion script file corresponding to initial data; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct to convert the initial data into target data; The kettle conversion script file is dynamically parsed according to the kettle configuration information, the initial data is converted into the target data, and the target data is written into the target data source.

2. The method according to claim 1, characterized in that: The dynamically parsing the kettle conversion script file according to the kettle configuration information, converting the initial data into the target data, and writing the target data into the target data source includes: The kettle conversion script file is dynamically parsed according to the kettle configuration information according to a preset time interval, the initial data is converted into the target data, and the target data is written into the target data source.

3. The method according to claim 1, characterized in that The dynamically parsing the kettle conversion script file according to the kettle configuration information to convert the initial data into the target data includes: Dynamically parse the kettle conversion script file according to the kettle configuration information to obtain the target conversion process; According to the target conversion process, the initial data is converted into the target data.

4. The method according to claim 3, characterized in that The kettle conversion script file includes conversion process configuration parameters, and the kettle conversion script file is dynamically parsed according to the kettle configuration information to obtain the target conversion process, including: The initial configuration parameters of the conversion process in the kettle conversion script file are replaced with the kettle configuration information to obtain the target conversion process.

5. The method according to claim 3, characterized in that: The converting the initial data into the target data according to the target conversion process includes: Based on the database information of the initial data source, acquiring the initial data from the initial data source; The initial data is converted into the target data.

6. The method according to claim 5, characterized in that The database information includes data type and link information, and the acquiring the initial data from the initial data source based on the database information of the initial data source includes: After determining that the data type of the initial data source is consistent with the data type of the target data source, the initial data is acquired from the initial data source based on the link information of the initial data source.

7. The method according to claim 1, characterized in that The method further comprises: In response to a writing operation based on business requirements, the kettle conversion script file is generated.

8. A kettle-based data synchronization system, characterized in that: The system comprises a front-end system and a back-end system, wherein: The front-end system is used to obtain kettle configuration information in response to a configuration operation; the kettle configuration information includes a data source and database information corresponding to the data source, and the data source includes an initial data source and a target data source; The front-end system is further used to obtain a kettle conversion script file corresponding to the initial data; the initial data is obtained from the initial data source; the kettle conversion script file is used to instruct to convert the initial data into target data; The back-end system is used to dynamically parse the kettle conversion script file according to the kettle configuration information, convert the initial data into the target data, and write the target data into the target data source.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 7 according to the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Kettle conversion task generation method and device applied to government affair field, equipment and medium

    CN120705207A

  • A kettle conversion task generation method, device and equipment applied to the government field and a medium

    CN120705207B