Script generation method, device, electronic device and storage medium

By automatically building data synchronization code scripts and using the configuration information input interface, users can visually input configuration information, solving the tedious problem of manually writing data synchronization codes, improving generation efficiency and accuracy, and reducing costs and technical thresholds.

CN117950641BActive Publication Date: 2024-10-25SINOCHEM AGRI HLDG
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410028767.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-08
Publication Date
2024-10-25
Estimated Expiration
2044-01-08

Smart Images

  • Figure CN117950641B_ABST
    Figure CN117950641B_ABST
Patent Text Reader

Abstract

The present invention provides a script generation method, device, electronic device and storage medium, which relate to the field of computer technology. The method includes: obtaining an information configuration instruction acting on a configuration information input interface; determining at least two configuration information based on the information configuration instruction; constructing a data synchronization code script based on the at least two configuration information, wherein the data synchronization code script is used to import data or export data; wherein the at least two configuration information include a resource name of a data resource to be synchronized and a data source type of an external data source, wherein the external data source is a data source of an original storage location of the data to be imported or a data source of a target storage location of the data to be exported; and the resource name is used as the script name of the data synchronization code script. The present invention can improve the generation efficiency and generation accuracy of data synchronization code scripts, and realize an efficient and accurate script generation method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a script generation method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of science and technology, the application scope of Hadoop (distributed system infrastructure) is becoming more and more extensive. In the application of Hadoop, Hadoop needs to transfer data with traditional databases, such as importing data from traditional databases into Hadoop's HDFS (Hadoop Distributed File System), or exporting HDFS data to traditional databases. Therefore, it is necessary to realize data transfer between different data sources, that is, to achieve data synchronization between different data sources.

[0003] At present, data synchronization code is manually written to form a data synchronization code script, so as to achieve data synchronization between different data sources through the data synchronization code script. However, according to different scenarios, such as the two different data sources between which data is transmitted, different data synchronization code scripts need to be written separately, and manual writing of data synchronization code is very cumbersome, resulting in reduced efficiency in generating data synchronization code scripts. Manual writing of data synchronization code requires users to have certain code writing skills, and is too dependent on manual experience, resulting in reduced accuracy in generating data synchronization code scripts. Summary of the invention

[0004] The present invention provides a script generation method, device, electronic device and storage medium, which are used to solve the defects of low generation efficiency and low generation accuracy of data synchronization code scripts in the prior art, and realize efficient and accurate script generation mode.

[0005] The present invention provides a script generation method, comprising:

[0006] Get information configuration instructions acting on the configuration information input interface;

[0007] Based on the information configuration instruction, determining at least two configuration information;

[0008] Based on the at least two pieces of configuration information, a data synchronization code script is constructed, where the data synchronization code script is used to import data or export data;

[0009] Among them, the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, the external data source is the data source of the original storage location of the data to be imported or the data source of the target storage location of the data to be exported; the resource name is used as the script name of the data synchronization code script.

[0010] According to a script generation method provided by the present invention, constructing a data synchronization code script based on the at least two configuration information includes:

[0011] Determine a data synchronization type and a plurality of preset configuration items corresponding to the data synchronization type, wherein the data synchronization type includes data import or data export, and the plurality of preset configuration items are configuration items required for building a script;

[0012] Matching the at least two pieces of configuration information with the plurality of preset configuration items;

[0013] If at least one preset configuration item that does not match the at least two pieces of configuration information is determined from the plurality of preset configuration items, determining configuration information corresponding to the at least one preset configuration item based on the data source type;

[0014] Building a data synchronization code script based on the at least two pieces of configuration information and the configuration information corresponding to the at least one preset configuration item;

[0015] If no preset configuration item that does not match the at least two pieces of configuration information is determined from the multiple preset configuration items, a script is constructed based on the at least two pieces of configuration information to obtain a data synchronization code script.

[0016] According to a script generation method provided by the present invention, the determining, based on the data source type, configuration information corresponding to the at least one preset configuration item includes:

[0017] Determine at least one first preset configuration item that can be configured based on the data source type from the at least one preset configuration item;

[0018] Based on the data source type, obtaining configuration information corresponding to the at least one first preset configuration item;

[0019] If at least one second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, determining preset information corresponding to the at least one second preset configuration item from a plurality of preset information required to construct the script;

[0020] Using the configuration information corresponding to the at least one first preset configuration item and the preset information corresponding to the at least one second preset configuration item as the configuration information corresponding to the at least one preset configuration item;

[0021] If no second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item is used as the configuration information corresponding to the at least one preset configuration item.

[0022] A script generation method provided by the present invention further includes:

[0023] Get the information update instruction acting on the configuration information update interface;

[0024] Based on the information update instruction, determine at least one configuration item to be updated, and new configuration information corresponding to the at least one configuration item to be updated;

[0025] Based on the at least one configuration item to be updated, determining at least one piece of information to be updated from the plurality of preset information;

[0026] The at least one information to be updated is updated to new configuration information corresponding to the at least one configuration item to be updated.

[0027] According to a script generation method provided by the present invention, the data synchronization code script is constructed based on the at least two configuration information, and the method also includes:

[0028] Constructing a mapping relationship between the resource name and the at least two pieces of configuration information;

[0029] Based on the mapping relationship, storing the at least two pieces of configuration information;

[0030] A data synchronization instruction is received, and based on the resource name indicated by the data synchronization instruction, the at least two pieces of configuration information stored are acquired.

[0031] According to a script generation method provided by the present invention, the at least two pieces of configuration information stored are obtained based on the resource name indicated by the data synchronization instruction, and then further includes:

[0032] If an information change instruction is received, determining at least one configuration item to be changed and new configuration information corresponding to the at least one configuration item to be changed based on the information change instruction;

[0033] Based on the at least one configuration item to be changed and the new configuration information corresponding to the at least one configuration item to be changed, the at least two configuration information are changed to obtain the at least two configuration information after the change, so as to construct a data synchronization code script based on the at least two configuration information after the change.

[0034] A script generation method provided by the present invention further includes:

[0035] Get the parameter configuration instructions for the new interface of the data source;

[0036] If the user who triggers the parameter configuration instruction has the authority to create a new data source, at least one configuration parameter is determined based on the parameter configuration instruction;

[0037] Based on the at least one configuration parameter, a data source is constructed.

[0038] The present invention also provides a script generating device, comprising:

[0039] An acquisition module, used to acquire information configuration instructions acting on the configuration information input interface;

[0040] A determination module, configured to determine at least two pieces of configuration information based on the information configuration instruction;

[0041] A construction module, used to construct a data synchronization code script based on the at least two pieces of configuration information, wherein the data synchronization code script is used to import data or export data;

[0042] Among them, the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, the external data source is the data source of the original storage location of the data to be imported or the data source of the target storage location of the data to be exported; the resource name is used as the script name of the data synchronization code script.

[0043] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the script generation methods described above is implemented.

[0044] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the script generation method described in any one of the above is implemented.

[0045] The script generation method, device, electronic device and storage medium provided by the present invention obtain an information configuration instruction acting on a configuration information input interface to determine at least two configuration information based on the information configuration instruction, and automatically construct a data synchronization code script based on the at least two configuration information, so that the user only needs to visually input the configuration information required to construct the data synchronization code script to automatically generate the data synchronization code script, thereby improving the convenience of generating the data synchronization code script, and further improving the efficiency of generating the data synchronization code; and by visually inputting the configuration information, the user only needs to input it according to the actual data synchronization task requirements, and the user does not need to have the ability to write code, thereby improving the fault tolerance rate, and further improving the accuracy of generating the data synchronization code script; and the user does not need to have the ability to write code, thereby reducing the cost of writing code, and further reducing the cost of generating the data synchronization code script; and the user does not need to have the ability to write code, thereby reducing the technical threshold for generating the data synchronization code script; and the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, thereby ensuring that the user inputs the resource name and the data source type, and further ensuring the successful generation of the data synchronization code script. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0047] Figure 1 One of the flowcharts of the script generation method provided by the present invention;

[0048] Figure 2 The second flowchart of the script generation method provided by the present invention;

[0049] Figure 3 A schematic diagram of the structure of the script generating device provided by the present invention;

[0050] Figure 4 This is a schematic structural diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] With the rapid development of science and technology, the application scope of Hadoop (Hive) is becoming more and more extensive. In the application of Hadoop, Hadoop needs to transfer data with traditional databases (such as Mysql, Oracle, SQL Server, DB2, GreenPlum, PosgreSQL, MongoDB, etc.), such as importing data from traditional databases into Hadoop's HDFS (Hadoop Distributed File System), or exporting HDFS data to traditional databases. Therefore, it is necessary to realize data transfer between different data sources, that is, to achieve data synchronization between different data sources.

[0053] At present, data synchronization code is manually written to form a data synchronization code script, so as to realize data synchronization of different data sources through the data synchronization code script. However, according to different scenarios, such as the two different data sources between data transmission, different data synchronization code scripts need to be written separately, and manual writing of data synchronization code is very cumbersome, resulting in reduced efficiency in generating data synchronization code scripts, and manual writing of data synchronization code requires users to have certain code writing capabilities, and over-reliance on manual experience leads to low fault tolerance, which in turn leads to reduced accuracy in generating data synchronization code scripts. In addition, manual writing of data synchronization code requires users to have certain code writing capabilities, and the writing cost is high, resulting in increased generation costs of data synchronization code scripts. In addition, manual writing of data synchronization code requires users to have certain code writing capabilities, resulting in certain technical barriers to the generation of data synchronization code scripts.

[0054] For example, the open source component Sqoop is used to build a Sqoop script, which is implemented by executing Sqoop import or export commands and translating the commands into mapreduce programs; specifically, the Sqoop import and export commands are written through shell commands provided by Sqoop itself. In order to realize data transmission between non-big data clusters and big data clusters, the existing technology requires writing command scripts first. According to different scenarios, each import or export command needs to be written separately, and the command scripts are complex, which makes the writing of script commands cumbersome and error-prone, and requires users to have certain Sqoop technical capabilities.

[0055] In view of the above problems, the present invention proposes the following embodiments. Figure 1 One of the flow charts of the script generation method provided by the present invention is as follows: Figure 1 As shown, the script generation method includes:

[0056] Step 110: Obtain information configuration instructions acting on the configuration information input interface.

[0057] In one embodiment, the method provided by the embodiment of the present invention may be applied to a server, and the configuration information input interface may be an interface on a client, that is, the information configuration instruction is received by the client and forwarded to the server.

[0058] Here, the configuration information input interface is used for the user to input the configuration information for building the data synchronization code script. In one embodiment, the configuration information input interface can be a WEB interface, which is more convenient for the user to input the configuration information, thereby improving the convenience and efficiency of generating the data synchronization code script.

[0059] Here, the information configuration instruction can be triggered by the user, such as on the client. The information configuration instruction indicates that there is configuration information. Based on this, the user can visually input the configuration information, that is, realize low-code and visual operation, thereby improving the generation efficiency of the data synchronization code script; and improving the fault tolerance rate, thereby improving the generation accuracy of the data synchronization code script; and reducing the technical threshold for the generation of the data synchronization code script, thereby reducing the writing cost, thereby reducing the generation cost of the data synchronization code script.

[0060] Step 120: Determine at least two configuration information based on the information configuration instruction.

[0061] Among them, the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, the external data source is the data source of the original storage location of the data to be imported or the data source of the target storage location of the data to be exported; the resource name is used as the script name of the data synchronization code script.

[0062] Here, the information configuration instruction indicates that there are at least two pieces of configuration information, so that at least two pieces of configuration information can be directly obtained.

[0063] In some embodiments, the user is required to input all the configuration information for building the data synchronization code script. Based on this, determine the data synchronization type and multiple preset configuration items corresponding to the data synchronization type, and the multiple preset configuration items are the configuration items required for building the script; match at least two configuration information with multiple preset configuration items; if at least one preset configuration item that does not match at least two configuration information is determined from multiple preset configuration items, return to step 110, such as outputting a prompt message to prompt the user to re-enter the configuration information, until no preset configuration item that does not match at least two configuration information is determined from multiple preset configuration items. For example, in the configuration information input interface, multiple preset configuration items are all required items.

[0064] In other embodiments, the user is not required to input all the configuration information for constructing the data synchronization code script. Based on this, it is determined whether at least two pieces of configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source. If they are included, no processing is required. If not, it returns to step 110, such as outputting a prompt message to prompt the user to re-enter the configuration information, until at least two pieces of configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source.

[0065] It should be noted that the resource name of the data resource to be synchronized and the data source type of the external data source are configuration information that the user must enter; for example, in the configuration information input interface, the configuration items corresponding to the resource name and the configuration items corresponding to the data source type are required items.

[0066] Here, the data resource to be synchronized may be a data resource to be imported or a data resource to be exported. The resource name is used as the script name of the data synchronization code script.

[0067] Furthermore, the resource name is globally unique, that is, the resource name is used to uniquely identify the data resource to be synchronized. In one embodiment, it is determined whether the resource name is unique. If it is unique, no processing is required. If it is not unique, it returns to step 110, such as outputting a prompt message to prompt the user to re-enter the configuration information until the resource name is unique.

[0068] Here, if you need to build a code script for data import, the external data source is the data source where the data to be imported is originally stored; if you need to build a code script for data export, the external data source is the data source where the data to be exported is to be imported, that is, the external data source is the data source where the data to be exported is to be stored. For example, if you need to build a code script for data import, the data source type can include but is not limited to: MySQL, Oracle, SQLServer, DB2, GreenPlum, PosgreSQL or MongoDB, etc., to support data import from multiple external data sources.

[0069] The at least two pieces of configuration information may also include, but are not limited to, at least one of the following: storage mode of data to be synchronized, data synchronization mode of data to be synchronized, connection information of external data sources, storage location information of data to be synchronized, target table name of data to be synchronized, whether to overwrite data, extended parameters, yarn queue information, etc. The data to be synchronized is data to be imported or data to be exported.

[0070] The storage method is an import method or an export method of the data to be synchronized. If the data to be synchronized is data to be imported, the storage method may include but is not limited to: Hive or HDFS, etc., to support multiple data storage forms. That is, the storage method is an import method of the data to be imported or an export method of the data to be exported.

[0071] The data synchronization method may include but is not limited to: single-table, multi-table or conditional data synchronization methods, to support multiple data synchronization methods. The single-table data synchronization method is to synchronize the data of a single table through the single-table method; the multi-table data synchronization method is to synchronize the data of multiple tables with the same structure at the same time through the multi-table method; the conditional data synchronization method is to pre-process the data and realize incremental synchronization through the conditional method.

[0072] The connection information of the external data source may include but is not limited to at least one of the following: database IP address, port, user name, password, etc.

[0073] The storage location information is the synchronization location information of the data to be synchronized. If the data to be synchronized is data to be imported, the storage location information may be a storage path (such as an HDFS path). If the data to be synchronized is data to be exported, the storage location information may be a stored database name.

[0074] The target table name is the storage table name of the data to be synchronized.

[0075] Whether to overwrite data specifies whether to overwrite existing data when executing the synchronization task.

[0076] The extended parameter can be set according to actual needs; for example, the extended parameter is num-mappers, which sets the number of map executions; the extended parameter is hive-drop-import-delims, which removes characters such as \r, \n, \013 or \010 in the data when importing data into HIVE; the extended parameter is null-non-string, which replaces null (empty) columns of non-String type with the specified string.

[0077] The YARN queue information is used to specify the execution queue of the YARN task.

[0078] In some embodiments, at least two input information indicated by the information configuration instruction are obtained; the at least two input information are corrected to obtain at least two configuration information for building the script. Based on this, considering that the configuration information input by the user may not be accurate, it is corrected, thereby improving the accuracy of generating the data synchronization code script. In one embodiment, at least two configuration information matching the at least two input information are determined from a plurality of preset configuration information; the plurality of preset configuration information is accurate configuration information set in advance.

[0079] Step 130: construct a data synchronization code script based on the at least two pieces of configuration information, where the data synchronization code script is used to import data or export data.

[0080] In some embodiments, the user is required to input all configuration information for constructing the data synchronization code script. Based on this, based on the at least two configuration information, the script is directly constructed to obtain the data synchronization code script.

[0081] In other embodiments, the user is not required to input all the configuration information for building the data synchronization code script. Based on this, determine the data synchronization type and multiple preset configuration items corresponding to the data synchronization type, the data synchronization type includes data import or data export, and the multiple preset configuration items are the configuration items required for building the script; match at least two configuration information with multiple preset configuration items; if at least one preset configuration item that does not match the at least two configuration information is determined from the multiple preset configuration items, determine the configuration information corresponding to the at least one preset configuration item; based on the at least two configuration information and the configuration information corresponding to the at least one preset configuration item, build the data synchronization code script; if the preset configuration item that does not match the at least two configuration information is not determined from the multiple preset configuration items, based on the at least two configuration information, perform script construction to obtain the data synchronization code script.

[0082] In one embodiment, based on multiple preset information required for building a script, configuration information corresponding to at least one preset configuration item is determined. Further, preset information corresponding to at least one second preset configuration item matching at least one preset configuration item is determined from multiple preset information required for building a script; if at least one first preset configuration item that does not match at least one second preset configuration item is determined from at least one preset configuration item, configuration information corresponding to at least one first preset configuration item is obtained based on the data source type; the configuration information corresponding to at least one first preset configuration item and the preset information corresponding to at least one second preset configuration item are used as the configuration information corresponding to at least one preset configuration item; if no first preset configuration item that does not match at least one second preset configuration item is determined from at least one preset configuration item, the configuration information corresponding to at least one second preset configuration item is used as the configuration information corresponding to at least one preset configuration item.

[0083] Furthermore, an information update instruction acting on the configuration information update interface is obtained; based on the information update instruction, at least one configuration item to be updated and new configuration information corresponding to the at least one configuration item to be updated are determined; based on the at least one configuration item to be updated, at least one information to be updated is determined from multiple preset information; and the at least one information to be updated is updated to the new configuration information corresponding to the at least one configuration item to be updated. Based on this, multiple preset information can be flexibly set according to actual needs, and the update method is a visual update method, that is, a low-code update method.

[0084] In one embodiment, a data synchronization instruction is received, and based on the resource name indicated by the data synchronization instruction, the at least two configuration information are obtained, so as to construct a data synchronization code script based on the at least two configuration information. That is, when a user executes a synchronization task, the data synchronization instruction can be triggered to obtain the at least two configuration information based on the resource name (globally unique) of the synchronization task, so as to generate a data synchronization code script when the synchronization task is executed, rather than generating the data synchronization code script in advance, so as to ensure that the data synchronization code script is generated only when data synchronization is needed, thereby reducing the waste of computing resources and storage resources.

[0085] Furthermore, if an information change instruction is received, at least one configuration item to be changed and new configuration information corresponding to at least one configuration item to be changed are determined based on the information change instruction; at least two configuration items are changed based on at least one configuration item to be changed and new configuration information corresponding to at least one configuration item to be changed, and at least two configuration items after the change are obtained, so as to construct a data synchronization code script based on the at least two configuration items after the change. Based on this, a data synchronization code script is generated when the synchronization task is executed, rather than generating the data synchronization code script in advance, to ensure that it is generated only when data synchronization is required, and supports visual changes to configuration information when data synchronization is required, so that there is no need to re-enter the configuration information, thereby improving the generation efficiency of the data synchronization code script.

[0086] Exemplarily, the parser parses the configuration information into a standard Sqoop script, and the compiler translates the Sqoop script into a mapreduce program to achieve data synchronization through the MR computing engine.

[0087] The script generation method provided by the embodiment of the present invention obtains an information configuration instruction acting on the configuration information input interface, and determines at least two configuration information based on the information configuration instruction, and automatically constructs a data synchronization code script based on the at least two configuration information, so that the user only needs to visually input the configuration information required to construct the data synchronization code script, and the data synchronization code script can be automatically generated, thereby improving the convenience of generating the data synchronization code script, and further improving the efficiency of generating the data synchronization code; and by visually inputting the configuration information, the user only needs to input it according to the actual data synchronization task requirements, and the user does not need to have the code writing ability, thereby improving the fault tolerance rate, and further improving the generation accuracy of the data synchronization code script; and the user does not need to have the code writing ability, thereby reducing the code writing cost, and further reducing the generation cost of the data synchronization code script; and the user does not need to have the code writing ability, thereby reducing the technical threshold for generating the data synchronization code script; and the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, thereby ensuring that the user inputs the resource name and the data source type, and further ensuring the successful generation of the data synchronization code script.

[0088] Based on any of the above embodiments, in the method, the above step 130 includes the following steps 131 to 135:

[0089] Step 131, determining a data synchronization type and a plurality of preset configuration items corresponding to the data synchronization type, wherein the data synchronization type includes data import or data export, and the plurality of preset configuration items are configuration items required for constructing a script.

[0090] Here, the data synchronization type indicates whether the data synchronization code script to be constructed is a data import script or a data export script. That is, the data synchronization type includes a data import type or a data export type.

[0091] In one embodiment, a data synchronization instruction is received, and the data synchronization type is determined based on the data synchronization instruction, that is, the data synchronization instruction indicates whether it is a data import task or a data export task. In addition, based on the resource name indicated by the data synchronization instruction, the at least two configuration information are obtained to build a data synchronization code script based on the at least two configuration information. That is, when a user executes a synchronization task, the data synchronization instruction can be triggered to obtain the at least two configuration information based on the resource name (globally unique) of the synchronization task, so as to generate a data synchronization code script when the synchronization task is executed, rather than generating the data synchronization code script in advance, to ensure that it is generated only when data synchronization is needed, thereby reducing the waste of computing resources and storage resources.

[0092] Furthermore, if an information change instruction is received, at least one configuration item to be changed and new configuration information corresponding to at least one configuration item to be changed are determined based on the information change instruction; at least two configuration items are changed based on at least one configuration item to be changed and new configuration information corresponding to at least one configuration item to be changed, and at least two configuration items after the change are obtained, so as to construct a data synchronization code script based on the at least two configuration items after the change. Based on this, a data synchronization code script is generated when the synchronization task is executed, rather than generating the data synchronization code script in advance, to ensure that it is generated only when data synchronization is required, and supports visual changes to configuration information when data synchronization is required, so that there is no need to re-enter the configuration information, thereby improving the generation efficiency of the data synchronization code script.

[0093] Here, the multiple preset configuration items are all the configuration items required to build the data synchronization code script. The multiple preset configuration items are set in advance for different data synchronization types. It should be understood that the configuration items required for the data import code script and the data export code script may be different.

[0094] The multiple preset configuration items may include but are not limited to at least one of the following: a configuration item corresponding to the resource name of the data resource to be synchronized, a configuration item corresponding to the data source type of the external data source, a configuration item corresponding to the storage method of the data to be synchronized, a configuration item corresponding to the data synchronization method of the data to be synchronized, a configuration item corresponding to the connection information of the external data source, a configuration item corresponding to the storage location information of the data to be synchronized, a configuration item corresponding to the target table name of the data to be synchronized, a configuration item corresponding to whether to overwrite the data, a configuration item corresponding to the extended parameter, a configuration item corresponding to the yarn queue information, and the like.

[0095] Step 132: Match the at least two pieces of configuration information with the multiple preset configuration items.

[0096] Specifically, at least two configuration information are matched with multiple preset configuration items to determine whether the at least two configuration information cover all of the multiple preset configuration items. If not, at least one preset configuration item that does not match the at least two configuration information can be determined from the multiple preset configuration items. If covered, no preset configuration item that does not match the at least two configuration information is determined from the multiple preset configuration items.

[0097] Step 133: If at least one preset configuration item that does not match the at least two pieces of configuration information is determined from the plurality of preset configuration items, configuration information corresponding to the at least one preset configuration item is determined based on the data source type.

[0098] Here, at least one preset configuration item is a configuration item required to build the data synchronization code, but the user has not entered the configuration information corresponding to at least one preset configuration item. Based on this, it is necessary to determine the configuration information corresponding to at least one preset configuration item before the data synchronization code script can be successfully built.

[0099] Here, the data source type can be used to determine the configuration information corresponding to individual preset configuration items, that is, the configuration information corresponding to individual preset configuration items is stored in advance based on the data source type, so that the stored configuration information can be obtained based on the data source type. For example, if the preset configuration item is a configuration item corresponding to the connection information of an external data source, the connection information corresponding to the configuration item can be obtained based on the data source type, such as directly obtaining the database IP address, port, user name, password, etc.

[0100] In one embodiment, at least one preset configuration item can be configured based on the data source type, that is, configuration information corresponding to all preset configuration items can be obtained based on the data source type. In other words, the preset configuration items among the multiple preset configuration items, except for all the first preset configuration items that can be configured based on the data source type, all require user input.

[0101] In another embodiment, at least one first preset configuration item that can be configured based on the data source type is determined from at least one preset configuration item; based on the data source type, configuration information corresponding to the at least one first preset configuration item is obtained; if at least one second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, preset information corresponding to the at least one second preset configuration item is determined from multiple preset information required to build the script; the configuration information corresponding to the at least one first preset configuration item and the preset information corresponding to the at least one second preset configuration item are used as the configuration information corresponding to the at least one preset configuration item; if the second preset configuration item that does not match the at least one first preset configuration item is not determined from the at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item is used as the configuration information corresponding to the at least one preset configuration item.

[0102] Step 134: construct a data synchronization code script based on the at least two pieces of configuration information and the configuration information corresponding to the at least one preset configuration item.

[0103] Here, the configuration information corresponding to at least two configuration information and at least one preset configuration item is already all the configuration information required to build a data synchronization code script. Based on this, the data synchronization code script can be directly constructed based on the configuration information corresponding to at least two configuration information and at least one preset configuration item.

[0104] Step 135: If no preset configuration item that does not match the at least two configuration information is determined from the multiple preset configuration items, a script is constructed based on the at least two configuration information to obtain a data synchronization code script.

[0105] If no preset configuration item that does not match at least two configuration information is determined from multiple preset configuration items, that is, at least two configuration information already include all configuration information required to construct the data synchronization code script, based on this, based on the at least two configuration information, the script is directly constructed to obtain the data synchronization code script.

[0106] The script generation method provided in the embodiment of the present invention determines the data synchronization type and multiple preset configuration items corresponding to the data synchronization type, and the data synchronization type includes data import or data export, so as to ensure the accuracy of determining the multiple preset configuration items, and further ensure that the data synchronization code script is successfully created, that is, the generation accuracy of the data synchronization code script is improved; if at least one preset configuration item that does not match at least two configuration information is determined from the multiple preset configuration items, based on the data source type, the configuration information corresponding to the at least one preset configuration item is determined, so as to construct the data synchronization code script based on the at least two configuration information and the configuration information corresponding to the at least one preset configuration item, so as to ensure that the script is generated only after all the configuration information for creating the data synchronization code script is obtained, and further ensure that the data synchronization code script is successfully created, that is, the generation accuracy of the data synchronization code script is improved.

[0107] Based on any of the above embodiments, in the method, determining the configuration information corresponding to the at least one preset configuration item based on the data source type includes:

[0108] Determine at least one first preset configuration item that can be configured based on the data source type from the at least one preset configuration item;

[0109] Based on the data source type, obtaining configuration information corresponding to the at least one first preset configuration item;

[0110] If at least one second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, determining preset information corresponding to the at least one second preset configuration item from a plurality of preset information required to construct the script;

[0111] Using the configuration information corresponding to the at least one first preset configuration item and the preset information corresponding to the at least one second preset configuration item as the configuration information corresponding to the at least one preset configuration item;

[0112] If no second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item is used as the configuration information corresponding to the at least one preset configuration item.

[0113] Considering that determining configuration information based on the data source type is more accurate than determining configuration information from preset information, based on this, at least one first preset configuration item that can be configured based on the data source type is first determined from at least one preset configuration item.

[0114] Here, the data source type can be used to determine the configuration information corresponding to at least one first preset configuration item, that is, the configuration information corresponding to at least one first preset configuration item is stored in advance based on the data source type, so that the stored configuration information can be obtained based on the data source type. For example, if the preset configuration item is a configuration item corresponding to the connection information of an external data source, the connection information corresponding to the configuration item can be obtained based on the data source type, such as directly obtaining the database IP address, port, user name, password, etc.

[0115] If there are preset configuration items in at least one preset configuration item that cannot be configured based on the data source type, that is, at least one second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, and preset information corresponding to the at least one second preset configuration item is determined from the multiple preset information required to build the script.

[0116] Here, the plurality of preset information includes configuration information that cannot be configured based on the data source type. Further, the plurality of preset information may not include the resource name of the data resource to be synchronized and the data source type of the external data source, because these two items are required. The preset information can also be set in advance for direct use later.

[0117] The multiple preset information may include but is not limited to at least one of the following: storage method of the data to be synchronized, data synchronization method of the data to be synchronized, connection information of the external data source, storage location information of the data to be synchronized, target table name of the data to be synchronized, whether to overwrite data, extended parameters and yarn queue information, etc.

[0118] Here, if at least one second preset configuration item that does not match at least one first preset configuration item is determined from at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item and the preset information corresponding to the at least one second preset configuration item, and at least two configuration information are already all the configuration information required to construct the data synchronization code script; if a second preset configuration item that does not match at least one first preset configuration item is not determined from at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item, and at least two configuration information are already all the configuration information required to construct the data synchronization code script.

[0119] The script generation method provided by an embodiment of the present invention, through the above-mentioned manner, if at least one second preset configuration item that does not match at least one first preset configuration item is determined from at least one preset configuration item, the preset information corresponding to the at least one second preset configuration item is determined from multiple preset information required to build the script, thereby ensuring that the script is generated only after all configuration information for creating the data synchronization code script is obtained, thereby ensuring that the data synchronization code script is successfully created, that is, improving the generation accuracy of the data synchronization code script.

[0120] Based on any of the above embodiments, the method further includes the following steps 140 to 170.

[0121] Step 140: Obtain information update instructions acting on the configuration information update interface.

[0122] In one embodiment, the method provided by the embodiment of the present invention may be applied to a server, and the configuration information update interface may be an interface on a client, that is, the information update instruction is received by the client and forwarded to the server.

[0123] Here, the configuration information update interface is used for users to update preset information. In one embodiment, the configuration information update interface can be a WEB interface, so that it is more convenient for users to update preset information, thereby improving the convenience and efficiency of updating the preset information.

[0124] Here, the information update instruction can be triggered by the user, such as on the client. The information update instruction indicates that there is at least one configuration item to be updated and at least one new configuration information corresponding to the configuration item to be updated. Based on this, the user can visually update the preset configuration information, that is, realize low-code and visual operations, thereby improving the updating efficiency of the preset information; and improving the fault tolerance rate, thereby improving the updating accuracy of the preset information; and reducing the technical threshold for updating the preset information, thereby reducing the writing cost, and thereby reducing the generation cost of the data synchronization code script.

[0125] Step 150: Determine at least one configuration item to be updated and new configuration information corresponding to the at least one configuration item to be updated based on the information update instruction.

[0126] The at least one configuration item to be updated may include but is not limited to at least one of the following: a configuration item corresponding to the storage method of the data to be synchronized, a configuration item corresponding to the data synchronization method of the data to be synchronized, a configuration item corresponding to the connection information of the external data source, a configuration item corresponding to the storage location information of the data to be synchronized, a configuration item corresponding to the target table name of the data to be synchronized, a configuration item corresponding to whether to overwrite the data, a configuration item corresponding to the extended parameter, a configuration item corresponding to the yarn queue information, and the like.

[0127] Step 160: Based on the at least one configuration item to be updated, determine at least one piece of information to be updated from the plurality of preset information.

[0128] Here, the configuration item to be updated is a configuration item to be updated, based on which, information to be updated corresponding to at least one configuration item to be updated can be determined from a plurality of preset information.

[0129] Step 170: Update the at least one information to be updated to new configuration information corresponding to the at least one configuration item to be updated.

[0130] Specifically, at least one to-be-updated information is replaced with new configuration information corresponding to at least one to-be-updated configuration item, that is, the multiple preset information used subsequently includes the new configuration information corresponding to at least one to-be-updated configuration item.

[0131] The script generation method provided by the embodiment of the present invention, through the above-mentioned manner, the user only needs to visually input the configuration information that needs to be updated, and multiple preset information can be automatically updated, thereby improving the convenience of updating the preset information, and then improving the updating efficiency of the preset information; and to visually input the configuration information, the user only needs to input it according to the actual data synchronization task needs, and the user does not need to have code writing ability, thereby improving the fault tolerance rate, and then improving the generation accuracy of the data synchronization code script; and the user does not need to have code writing ability, thereby reducing the code writing cost, and then reducing the generation cost of the data synchronization code script; and the user does not need to have code writing ability, thereby reducing the technical threshold for generating data synchronization code scripts; and multiple preset information can be updated according to actual needs, rather than being immutable, thereby ensuring the successful generation of the data synchronization code script, that is, improving the generation accuracy of the data synchronization code script.

[0132] Based on any of the above embodiments, Figure 2 The second flowchart of the script generation method provided by the present invention is as follows: Figure 2 As shown, before the above step 130, the method further includes:

[0133] Step 210: construct a mapping relationship between the resource name and the at least two pieces of configuration information.

[0134] Step 220: store the at least two pieces of configuration information based on the mapping relationship.

[0135] Here, at least two pieces of configuration information are stored based on the mapping relationship, so that the at least two pieces of configuration information stored can be subsequently acquired based on the resource name.

[0136] In one embodiment, at least two configuration information are stored in a MySQL database. Exemplarily, at least two configuration information are stored in a MySQL database through a springboot program.

[0137] Step 230: Receive a data synchronization instruction, and obtain the at least two stored configuration information based on the resource name indicated by the data synchronization instruction.

[0138] Here, the data synchronization instruction can be triggered by the user, so that when the user executes a synchronization task, the data synchronization instruction can be triggered to obtain the at least two configuration information based on the resource name (globally unique) of the synchronization task, so as to generate a data synchronization code script when the synchronization task is executed, rather than generating the data synchronization code script in advance, to ensure that it is generated only when data synchronization is needed, thereby reducing the waste of computing resources and storage resources.

[0139] The script generation method provided in an embodiment of the present invention can generate a data synchronization code script when the synchronization task is executed, rather than generating the data synchronization code script in advance, to ensure that it is generated only when data synchronization is needed, thereby reducing the waste of computing resources and storage resources.

[0140] Based on any of the above embodiments, after acquiring the at least two pieces of configuration information stored based on the resource name indicated by the data synchronization instruction, the method further includes:

[0141] If an information change instruction is received, determining at least one configuration item to be changed and new configuration information corresponding to the at least one configuration item to be changed based on the information change instruction;

[0142] Based on the at least one configuration item to be changed and the new configuration information corresponding to the at least one configuration item to be changed, the at least two configuration information are changed to obtain the at least two configuration information after the change, so as to construct a data synchronization code script based on the at least two configuration information after the change.

[0143] Here, the information change instruction can be triggered by the user, such as on the client. The information change instruction indicates that there is at least one configuration item to be changed and at least one new configuration information corresponding to the configuration item to be changed. Based on this, the user can visualize the configuration information entered before the change, that is, to achieve low-code and visual operations, thereby improving the efficiency of updating the configuration information; and improving the fault tolerance rate, thereby improving the accuracy of updating the configuration information; and reducing the technical threshold for updating the configuration information, thereby reducing the writing cost, and thereby reducing the cost of generating the data synchronization code script.

[0144] The at least one configuration item to be changed may include but is not limited to at least one of the following: a configuration item corresponding to the resource name of the data resource to be synchronized, a configuration item corresponding to the data source type of the external data source, a configuration item corresponding to the storage method of the data to be synchronized, a configuration item corresponding to the data synchronization method of the data to be synchronized, a configuration item corresponding to the connection information of the external data source, a configuration item corresponding to the storage location information of the data to be synchronized, a configuration item corresponding to the target table name of the data to be synchronized, a configuration item corresponding to whether to overwrite the data, a configuration item corresponding to the extended parameter, a configuration item corresponding to the yarn queue information, and the like.

[0145] Specifically, based on at least one configuration item to be changed, at least one piece of information to be changed is determined from at least two pieces of configuration information, and the at least one piece of information to be changed is replaced with new configuration information corresponding to the at least one configuration item to be changed.

[0146] Furthermore, after at least two pieces of configuration information are changed, a data synchronization code script may be immediately constructed based on the at least two pieces of configuration information after the changes.

[0147] The script generation method provided by the embodiment of the present invention, through the above-mentioned method, the user only needs to visually input the configuration information that needs to be changed, and the previously input configuration information can be automatically changed, thereby improving the convenience of changing the configuration information, and then improving the efficiency of changing the configuration information; and to visually input the configuration information, the user only needs to input it according to the actual data synchronization task needs, and the user does not need to have code writing ability, thereby improving the fault tolerance rate, and then improving the generation accuracy of the data synchronization code script; and the user does not need to have code writing ability, thereby reducing the code writing cost, and then reducing the generation cost of the data synchronization code script; and the user does not need to have code writing ability, thereby reducing the technical threshold for generating data synchronization code scripts; and the previously input configuration information can be updated according to actual needs, instead of being unchanged, thereby ensuring the successful generation of the data synchronization code script, that is, improving the generation accuracy of the data synchronization code script; and supports visual changes in configuration information when data synchronization is required, so that there is no need to re-enter more configuration information, thereby improving the generation efficiency of the data synchronization code script.

[0148] Based on any of the above embodiments, the method further includes:

[0149] Get the parameter configuration instructions for the new interface of the data source;

[0150] If the user who triggers the parameter configuration instruction has the authority to create a new data source, at least one configuration parameter is determined based on the parameter configuration instruction;

[0151] Based on the at least one configuration parameter, a data source is constructed.

[0152] In one embodiment, the method provided by the embodiment of the present invention may be applied to a server, and the data source newly added interface may be an interface on a client, that is, the parameter configuration instruction is received by the client and forwarded to the server.

[0153] Here, the data source adding interface is used for the user to visually add a new data source. In one embodiment, the data source adding interface can be a WEB interface, so that it is more convenient for the user to input the new data source, thereby improving the convenience and efficiency of adding a new data source.

[0154] Here, the parameter configuration instruction can be triggered by the user, such as on the client. The parameter configuration instruction indicates that there is at least one configuration parameter. Based on this, the user can visually input the configuration parameters, that is, realize low-code and visual operation, thereby improving the efficiency of adding new data sources; and improving the fault tolerance rate, thereby improving the accuracy of adding new data sources; and reducing the technical threshold for adding new data sources, thereby reducing the writing cost, and thereby reducing the cost of adding new data sources.

[0155] It should be noted that for the management of data sources, the components in data source management are business components. Each tenant member has the right to use the data source configured by the administrator, and the data source configured by the tenant can only be used by users under the tenant. Specifically, the administrator has the right to create, edit, delete and view details of all data sources, and the data source configured by the administrator is granted use permission to all users by default and only has use permission. Ordinary users have the right to edit, delete and view the data source created by the user. Based on this, if the user who triggers the parameter configuration instruction has the permission to create a new data source, at least one configuration parameter is determined based on the parameter configuration instruction.

[0156] Exemplarily, if a new MySQL data source is added, at least one configuration parameter includes the resource name of the data source (the resource name for configuring MySQL, which is a unique identifier), the database IP address (host name) (the full domain name or IP address of the machine where MySQL is located), the port (MySQL communication port), the user name (the user name used to log in to the MySQL database), the password (the password corresponding to the user name when logging in to the MySQL database), the database name (the database name of the MySQL connection) and the JDBC (Java Database Connectivity, Java database connection) connection parameters (parameters required when JDBC connects to MySQL), etc.

[0157] Exemplarily, if an Oracle data source is added, at least one configuration parameter includes the resource name of the data source (configure the Oracle resource name, which is a unique identifier), the database IP address (host name) (the full domain name or IP address of the machine where Oracle is located), the port (Oracle communication port), the user name (the user name used to log in to the Oracle database), the password (the password corresponding to the user name when logging in to the Oracle database), the instance name (the name of the database connected by Oracle), the tablespace (the logical division of the database, a tablespace can only belong to one database) and the JDBC connection parameters (parameters required when JDBC connects to Oracle), etc.

[0158] For example, if a new FTP data source is added, at least one configuration parameter includes the resource name of the data source (the resource name of the configured FTP, which is a unique identifier), the database IP address (host name) (enter the full domain name or IP address of the machine where FTP is located), the port (FTP communication port), the user name (the user name used to log in to FTP), the password (the password corresponding to the user name when logging in to FTP), etc.

[0159] Exemplarily, if a new SQL Server data source is added, at least one configuration parameter includes the resource name of the data source (the resource name for configuring SQL Server, which is a unique identifier), the database IP address (host name) (the full domain name or IP address of the machine where SQL Server is located), the port (SQL Server communication port), the user name (the user name used to log in to the SQL Server database), the password (the password corresponding to the user name when logging in to the SQL Server database), the database name (the database name to which SQL Server connects), and the JDBC connection parameters (parameters required when JDBC connects to SQL Server), etc.

[0160] Exemplarily, if a new DB2 data source is added, at least one configuration parameter includes the resource name of the data source (the resource name for configuring DB2, which is a unique identifier), the database IP address (host name) (the full domain name or IP address of the machine where DB2 is located), the port (DB2 communication port), the user name (the user name used to log in to the DB2 database), the password (the password corresponding to the user name when logging in to the DB2 database), the database name (the database name for the DB2 connection), the table space (the logical division of the database, a table space can only belong to one database) and the JDBC connection parameters (parameters required when JDBC connects to DB2), etc.

[0161] In addition, other newly added data sources can set the required configuration parameters according to actual needs, which will not be described here one by one.

[0162] The script generation method provided by the embodiment of the present invention can automatically construct the data source in the above manner only by visually inputting the configuration information for constructing the data source, thereby improving the convenience of adding the data source, and further improving the efficiency of adding the data source; and by visually inputting the configuration information, the user only needs to input according to the actual task requirements, and the user does not need to have the ability to write code, thereby improving the fault tolerance rate, and further improving the accuracy of adding the data source; and the user does not need to have the ability to write code, thereby reducing the cost of writing code, and further reducing the cost of adding the data source; and the user does not need to have the ability to write code, thereby reducing the technical threshold for adding the data source.

[0163] The script generating device provided by the present invention is described below. The script generating device described below and the script generating method described above can be referred to each other.

[0164] Figure 3 A schematic diagram of the structure of the script generation device provided by the present invention, such as Figure 3 As shown, the script generating device comprises:

[0165] An acquisition module 310 is used to acquire information configuration instructions acting on the configuration information input interface;

[0166] A determination module 320, configured to determine at least two configuration information based on the information configuration instruction;

[0167] A construction module 330, configured to construct a data synchronization code script based on the at least two pieces of configuration information, wherein the data synchronization code script is used to import data or export data;

[0168] Among them, the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, the external data source is the data source of the original storage location of the data to be imported or the data source of the target storage location of the data to be exported; the resource name is used as the script name of the data synchronization code script.

[0169] The script generation device provided by the embodiment of the present invention obtains an information configuration instruction acting on the configuration information input interface, and determines at least two configuration information based on the information configuration instruction, and automatically constructs a data synchronization code script based on the at least two configuration information, so that the user only needs to visually input the configuration information required to construct the data synchronization code script, and the data synchronization code script can be automatically generated, thereby improving the convenience of generating the data synchronization code script, and further improving the efficiency of generating the data synchronization code; and by visually inputting the configuration information, the user only needs to input it according to the actual data synchronization task requirements, and the user does not need to have the ability to write code, thereby improving the fault tolerance rate, and further improving the accuracy of generating the data synchronization code script; and the user does not need to have the ability to write code, thereby reducing the cost of writing code, and further reducing the cost of generating the data synchronization code script; and the user does not need to have the ability to write code, thereby reducing the technical threshold for generating the data synchronization code script; and the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, thereby ensuring that the user inputs the resource name and the data source type, and further ensuring the successful generation of the data synchronization code script.

[0170] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the script generation method, which includes: obtaining an information configuration instruction acting on the configuration information input interface; determining at least two configuration information based on the information configuration instruction; constructing a data synchronization code script based on the at least two configuration information, wherein the data synchronization code script is used to import data or export data; wherein the at least two configuration information include the resource name of the data resource to be synchronized and the data source type of the external data source, wherein the external data source is the data source of the original storage location of the data to be imported or the data source of the target storage location of the data to be exported; the resource name is used as the script name of the data synchronization code script.

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

[0172] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the script generation method provided by the above-mentioned methods, the method comprising: obtaining an information configuration instruction acting on a configuration information input interface; based on the information configuration instruction, determining at least two configuration information; based on the at least two configuration information, constructing a data synchronization code script, the data synchronization code script being used to import data or export data; wherein the at least two configuration information include a resource name of a data resource to be synchronized and a data source type of an external data source, the external data source being a data source of an original storage location of the data to be imported or a data source of a target storage location of the data to be exported; the resource name is used as a script name of the data synchronization code script.

[0173] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0174] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a 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 device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these 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 invention.

Claims

1. A script generation method, It is characterized in that include: Get information configuration instructions acting on the configuration information input interface; Based on the information configuration instruction, determining at least two configuration information; Based on the at least two pieces of configuration information, a data synchronization code script is constructed, where the data synchronization code script is used to import data or export data; The at least two pieces of configuration information include a resource name of the data resource to be synchronized and a data source type of an external data source, wherein the external data source is a data source of an original storage location of the data to be imported or a data source of a target storage location of the data to be exported; the resource name is used as a script name of the data synchronization code script; The step of constructing a data synchronization code script based on the at least two pieces of configuration information includes: Determine a data synchronization type and a plurality of preset configuration items corresponding to the data synchronization type, wherein the data synchronization type includes data import or data export, and the plurality of preset configuration items are configuration items required for building a script; Matching the at least two pieces of configuration information with the plurality of preset configuration items; If at least one preset configuration item that does not match the at least two pieces of configuration information is determined from the plurality of preset configuration items, determining configuration information corresponding to the at least one preset configuration item based on the data source type; Building a data synchronization code script based on the at least two pieces of configuration information and the configuration information corresponding to the at least one preset configuration item; If no preset configuration item that does not match the at least two pieces of configuration information is determined from the multiple preset configuration items, a script is constructed based on the at least two pieces of configuration information to obtain a data synchronization code script.

2. The script generation method according to claim 1, It is characterized in that The determining, based on the data source type, configuration information corresponding to the at least one preset configuration item includes: Determine at least one first preset configuration item that can be configured based on the data source type from the at least one preset configuration item; Based on the data source type, obtaining configuration information corresponding to the at least one first preset configuration item; If at least one second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, determining preset information corresponding to the at least one second preset configuration item from a plurality of preset information required to construct the script; Using the configuration information corresponding to the at least one first preset configuration item and the preset information corresponding to the at least one second preset configuration item as the configuration information corresponding to the at least one preset configuration item; If no second preset configuration item that does not match the at least one first preset configuration item is determined from the at least one preset configuration item, the configuration information corresponding to the at least one first preset configuration item is used as the configuration information corresponding to the at least one preset configuration item.

3. The script generation method according to claim 2, It is characterized in that Also includes: Get the information update instruction acting on the configuration information update interface; Based on the information update instruction, determine at least one configuration item to be updated, and new configuration information corresponding to the at least one configuration item to be updated; Based on the at least one configuration item to be updated, determining at least one piece of information to be updated from the plurality of preset information; The at least one information to be updated is updated to new configuration information corresponding to the at least one configuration item to be updated.

4. The script generation method according to claim 1, It is characterized in that The step of constructing a data synchronization code script based on the at least two pieces of configuration information may also include: Constructing a mapping relationship between the resource name and the at least two pieces of configuration information; Based on the mapping relationship, storing the at least two pieces of configuration information; A data synchronization instruction is received, and based on the resource name indicated by the data synchronization instruction, the at least two pieces of configuration information stored are acquired.

5. The script generation method according to claim 4, It is characterized in that The step of acquiring the at least two pieces of configuration information stored based on the resource name indicated by the data synchronization instruction further includes: If an information change instruction is received, determining at least one configuration item to be changed and new configuration information corresponding to the at least one configuration item to be changed based on the information change instruction; Based on the at least one configuration item to be changed and the new configuration information corresponding to the at least one configuration item to be changed, the at least two configuration information are changed to obtain the at least two configuration information after the change, so as to construct a data synchronization code script based on the at least two configuration information after the change.

6. The script generation method according to claim 1, It is characterized in that Also includes: Get the parameter configuration instructions for the new interface of the data source; If the user who triggers the parameter configuration instruction has the authority to create a new data source, at least one configuration parameter is determined based on the parameter configuration instruction; Based on the at least one configuration parameter, a data source is constructed.

7. A script generating device, It is characterized in that include: An acquisition module, used to acquire information configuration instructions acting on the configuration information input interface; A determination module, configured to determine at least two pieces of configuration information based on the information configuration instruction; A construction module, used to construct a data synchronization code script based on the at least two pieces of configuration information, wherein the data synchronization code script is used to import data or export data; The at least two pieces of configuration information include a resource name of the data resource to be synchronized and a data source type of an external data source, wherein the external data source is a data source of an original storage location of the data to be imported or a data source of a target storage location of the data to be exported; the resource name is used as a script name of the data synchronization code script; The building blocks are also used to: Determine a data synchronization type and a plurality of preset configuration items corresponding to the data synchronization type, wherein the data synchronization type includes data import or data export, and the plurality of preset configuration items are configuration items required for building a script; Matching the at least two pieces of configuration information with the plurality of preset configuration items; If at least one preset configuration item that does not match the at least two pieces of configuration information is determined from the plurality of preset configuration items, determining configuration information corresponding to the at least one preset configuration item based on the data source type; Building a data synchronization code script based on the at least two pieces of configuration information and the configuration information corresponding to the at least one preset configuration item; If no preset configuration item that does not match the at least two pieces of configuration information is determined from the multiple preset configuration items, a script is constructed based on the at least two pieces of configuration information to obtain a data synchronization code script.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the script generation method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the script generation method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Synchronization script generation method, device and equipment and computer readable storage medium

    CN110019533A

  • Code generation method and device, equipment and computer readable storage medium

    CN113296749A

  • Simulation scene setting method and device, equipment and storage medium

    CN114676556A

  • System changing method and device and electronic equipment

    CN117111984A