Data conversion method, device and electronic equipment
By selecting the target script from multiple scripts and calling preset programs for data conversion, the problem of high data conversion cost in traditional code methods is solved, and the conversion rules that dynamically adapt to changes are realized, which reduces the project's R&D and maintenance costs, and ensures that The stability and scalability of the project are achieved.
Patent Information
- Application Number
- CN202210583129.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-05-26
AI Technical Summary
In the prior art, data conversion costs are high. The traditional code method not only has a lot of work, but also requires updates to programs when the conversion rules change, resulting in high cost of project research and development and complex maintenance.
By determining the target source database of the data to be converted, select the corresponding target script from multiple scripts, call the target script based on the preset program to convert the data, use the conversion rules in the script to avoid modifying the public program part, and only update the The target script corresponding to the conversion rule.
The transformation rules that dynamically adapt to changes are realized, reducing the cost of R&D and maintenance of the project, and ensuring the stability and scalability of the project.
Smart Images

Figure CN114861606B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a data conversion method, device and electronic equipment. Background Art
[0002] Data conversion plays a vital role in data integration and data management activities. For various reasons, we may need to convert data. Data conversion includes: converting data types, removing null values or duplicate data, data semantic conversion, data granularity conversion, etc.
[0003] In the prior art, data conversion is usually achieved by using a program to convert the data to be converted using conversion rules. However, a data table in a database may have multiple fields that need to be converted, and the conversion rules for fields in different data tables may be different or change frequently. Therefore, the traditional code method to achieve data conversion is not only labor-intensive, but also requires the development and update of a new version of the program when the conversion rules change. Since program testing is relatively complex during the release process, the R&D cost of the project is high.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a data conversion method, device and electronic device to at least solve the technical problem of high conversion cost caused by using program code to write conversion rules to achieve data conversion in the prior art.
[0006] According to one aspect of an embodiment of the present invention, there is provided a data conversion method, comprising: determining at least one target source database corresponding to data to be converted; determining a target script corresponding to each target source database from a plurality of scripts, wherein any one of the plurality of scripts contains at least a conversion rule for converting data; calling the target script based on a preset program, and converting the data to be converted based on the target script to obtain target data, wherein the preset program is a common program in the program for converting data.
[0007] Furthermore, before determining the target script corresponding to each target source database from the multiple scripts, the method further includes: acquiring a conversion rule corresponding to at least one source database; and generating a script corresponding to each source database based on the conversion rule.
[0008] Furthermore, any one of the multiple scripts also includes extraction rules for extracting data, wherein the data to be converted is converted based on the target script to obtain the target data, including: extracting the data to be converted from at least one target source database based on the target script; converting the data to be converted based on the target script to obtain the target data.
[0009] Furthermore, the conversion rules include at least sub-rules corresponding to at least one data table in the source database, wherein the data to be converted is converted based on the target script to obtain the target data, including: determining a target sub-rule corresponding to at least one target data table in the target source database based on the target script; and converting the data to be converted in at least one target data table based on the target sub-rule to obtain the target data.
[0010] Furthermore, the conversion rules include at least sub-rules corresponding to at least one data table in the source database, wherein the data to be converted is converted based on the target script to obtain the target data, including: based on the target script, the data to be converted is converted in at least one or more of the following ways: field conversion of the data to be converted; data type conversion of the data to be converted; data format conversion of the data to be converted.
[0011] Furthermore, the data conversion method further includes: if a rule update instruction is detected and received, responding to the rule update instruction, obtaining a first script; and updating the script to be updated among the multiple scripts to be the first script.
[0012] According to another aspect of an embodiment of the present invention, a data conversion device is also provided, including: a first determination module, used to determine at least one target source database corresponding to the data to be converted; a second determination module, used to determine a target script corresponding to each target source database from multiple scripts, wherein any one of the multiple scripts contains at least a conversion rule for converting the data; a processing module, used to call the target script based on a preset program, and perform conversion processing on the data to be converted based on the target script to obtain target data, wherein the preset program is a common program in the program used to convert the data.
[0013] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data conversion method when running.
[0014] According to another aspect of an embodiment of the present invention, an electronic device is also provided, which includes one or more processors; a memory for storing one or more programs, so that when the one or more programs are executed by the one or more processors, the one or more processors are implemented to run the programs, wherein the programs are configured to execute the above-mentioned data conversion method when running.
[0015] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program / instruction, and the computer program / instruction implements the above data conversion method when executed by a processor.
[0016] In an embodiment of the present invention, a method of converting corresponding data by calling different scripts is adopted, by determining at least one target source database corresponding to the data to be converted, then determining a target script corresponding to each target source database from multiple scripts, calling the target script based on a preset program, and converting the data to be converted based on the target script to obtain target data. Among them, any one of the multiple scripts contains at least a conversion rule for converting data, and the preset program is a common program in the program for converting data.
[0017] In the above process, the preset program is the common part of the program for data conversion, and the target script is the unique part corresponding to different conversion rules in the program for data conversion. Therefore, when the conversion rules for converting data are different or change frequently, there is no need to modify the common part of the program for data conversion. It is only necessary to call the target script corresponding to the conversion rule. This avoids the shortcomings of the prior art of using program code to write conversion rules, complex codes, and difficult maintenance, thereby realizing conversion rules that dynamically adapt to changes and ensuring the stability of the project.
[0018] It can be seen that the solution provided by the present application achieves the purpose of data conversion based on the configuration script, thereby realizing the technical effect of dynamically adapting to changes in conversion rules, and further solving the technical problem of high conversion cost caused by using program code to write conversion rules to achieve data conversion in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0020] Figure 1 is a schematic diagram of an optional data conversion method according to an embodiment of the present invention;
[0021] Figure 2 is a schematic diagram of an optional data table field conversion method according to an embodiment of the present invention;
[0022] Figure 3 is a schematic diagram of an optional data conversion method according to an embodiment of the present invention;
[0023] Figure 4 A schematic diagram of an optional data conversion device according to an embodiment of the present invention;
[0024] Figure 5 A schematic diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0028] Example 1
[0029] According to an embodiment of the present invention, an embodiment of a data conversion method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 1 is a data conversion method according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0031] Step S101, determining at least one target source database corresponding to the data to be converted.
[0032] In step S101, at least one target source database corresponding to the data to be converted can be determined based on a system, a server, an electronic device, and the like. In the present embodiment, at least one target source database corresponding to the data to be converted can be determined by the electronic device. The target source database is the source database of the data to be converted, and the data to be converted can be obtained through the target source database. The data to be converted can come from the same target source database. For example, field 1, field 2, field 3, etc. come from table A1 of source library A. Optionally, according to different user needs, the data to be converted can also come from multiple target source databases. For example, the user needs to simultaneously convert the sub-segment information in table A1 of source library A and table B1 of source library B. Optionally, the data to be converted can be, but is not limited to, data information such as tables, fields, and target fields.
[0033] It should be noted that, by determining at least one target source database corresponding to the data to be converted, a target script corresponding to the target source database is subsequently determined.
[0034] Step S102: determining a target script corresponding to each target source database from a plurality of scripts, wherein any one of the plurality of scripts at least includes a conversion rule for converting data.
[0035] In step S102, the electronic device can determine a target script corresponding to each target source database from a plurality of scripts, the script being used to store relevant rules for program execution, and each script corresponding to a different rule. In this embodiment, the conversion rules for program execution are stored in the form of SQL scripts, and optionally, any one of the plurality of scripts at least includes a conversion rule for converting data.
[0036] Optionally, the conversion rule is the conversion logic of the converted data. According to different data conversion requirements, the conversion rules corresponding to the data to be converted are different. Accordingly, different conversion rules correspond to different SQL scripts. The data to be converted comes from at least one target source database, and each target source database corresponds to a corresponding SQL script.
[0037] For example, Figure 2As shown, the data of table A1 (TABLE_A1) of source library A is extracted as an example. First, determine that the extracted table object is TABLE_A1, and then determine the where condition and field information to be extracted according to the requirements. Taking into account the unified data storage standard under the data conversion conditions, for the extracted fields, in most cases, it is only necessary to take out the field data of the original table and then store it in the corresponding new table field. During this period, the extracted fields to be converted only have the field names changed, such as mapping "field 1" in TABLE_A1 to "standard field 1"; and in some special cases, field conversion processing is required, such as mapping the original table "field n" field to the "standard field n" field through the case-when statement. Of course, some fields may also need to be converted and mapped in data type and data format. The reference example of the configuration script is as follows:
[0038] -- Extract script configuration -- Start
[0039] / *Data conversion script A source library* /
[0040] select field1 standard field1,......,(case when fieldn=”Y”then 1else 0end) standard fieldn,......from TABLE_A1 where......;
[0041] select field1 standard field1,......,substr(fieldn,5,2) standard fieldn,......fromTABLE_A2 where.....; ......
[0043] / *Data conversion script B source library* /
[0044] select field1 standard field1,......,to_char(to_date(fieldn,"YYYY-MM-DD HH24:MI:SS"),"yyyymmdd") standard fieldn,......from TABLE_B1 where......; ......
[0046] --Extract script configuration--end
[0047] Optional, such as Figure 3 As shown, after the electronic device determines the target script corresponding to the target source database, it can also save the target script in a database, a cloud server or other storage area.
[0048] It should be noted that by determining the target script corresponding to each target source database from multiple scripts, the conversion rules are effectively reduced in the form of scripts to reduce the amount of code in the data conversion program.
[0049] Step S103, calling the target script based on a preset program, and performing conversion processing on the data to be converted based on the target script to obtain target data, wherein the preset program is a common program in the program used to convert data.
[0050] In step S103, the preset program is the data conversion program logic written in the background. The electronic device calls the data conversion task by running the program code. After receiving the data conversion request, the preset program extracts the target script by reading the database where the target script is located, and converts the data to be converted by parsing the script to obtain the target data. Figure 3 As shown, the target data can be stored in a standard database, wherein the standard database is used to store data with unified field standards.
[0051] Optionally, the electronic device can call the target script information according to a preset program to convert data to be converted with multiple different rules. For example, there are multiple tables in the source database that need to be converted, and there are differences between different table structures in different databases. When the data table is converted by running the program, the corresponding target script can be called based on the preset program according to the importance of the user's data conversion requirements, and the data to be converted is converted according to the order of priority.
[0052] Optionally, the electronic device can dynamically parse and complete data conversion according to the rules in the target script called by the preset program. For example, in the case of changes in the conversion rules, the changed new rules are configured based on the script to the corresponding target source database, and the determined target script is stored in the corresponding database. When performing the conversion, only the target script configured with the new rules needs to be called to convert the data through the preset program, without the need to rewrite new program code for data conversion.
[0053] It should be noted that by calling the target script based on the preset program and converting the data to be converted based on the target script, the conversion rules are decoupled from the background data conversion program code while achieving the same conversion function, which effectively reduces the amount of code in the data conversion program, improves the reusability of the project code, makes the program logic clearer, and reduces the maintenance cost.
[0054] Based on the scheme defined in the above steps S101 to S103, it can be known that in the embodiment of the present invention, the corresponding data is converted by calling different scripts, by determining at least one target source database corresponding to the data to be converted, and then determining the target script corresponding to each target source database from multiple scripts, calling the target script based on the preset program, and converting the data to be converted based on the target script to obtain the target data. Among them, any one of the multiple scripts contains at least a conversion rule for converting data, and the preset program is a common program in the program for converting data.
[0055] It is easy to notice that in the above process, the preset program is the common part for data conversion, and the target script is the unique part corresponding to different conversion rules in the program for data conversion. Therefore, when there are differences or frequent changes in the conversion rules for converting data, there is no need to modify the common part of the program for data conversion. It is only necessary to call the target script corresponding to the conversion rule. This avoids the shortcomings of the prior art of using program code to write conversion rules, complex codes, and difficult maintenance, thereby realizing conversion rules that dynamically adapt to changes and ensuring the stability of the project.
[0056] It can be seen that the solution provided by the present application achieves the purpose of data conversion based on configuration scripts, thereby realizing the technical effect of dynamically adapting to changing conversion rules, and further solving the technical problems of using program code to write conversion rules, complex codes, and difficult maintenance.
[0057] In an optional embodiment, before determining a target script corresponding to each target source database from a plurality of scripts, the electronic device may obtain a conversion rule corresponding to at least one source database, and generate a script corresponding to each source database based on the conversion rule.
[0058] Optionally, the conversion rule specifies a method for converting the data to be converted. The electronic device can obtain the conversion rules input by the R&D personnel and corresponding to the target source database, and determine the correspondence between the conversion rules and the target source database according to the identification information by marking the conversion rules with the corresponding target source database. The electronic device can also obtain the required conversion rules through the Internet or other databases, match the conversion rules to the corresponding target source database according to the correspondence between the conversion rules and the source database, and finally generate a script corresponding to each source database.
[0059] It should be noted that by generating scripts based on conversion rules, the complex and cumbersome data conversion rule program codes are presented in the form of scripts, which increases the scalability of the project.
[0060] Furthermore, in the process of converting the data to be converted based on the target script to obtain the target data, the electronic device can extract the data to be converted from at least one target source database based on the target script, thereby converting the data to be converted based on the target script to obtain the target data. Any one of the multiple scripts also includes an extraction rule for extracting data.
[0061] Optionally, the electronic device can configure the script of the extraction rule for extracting data, and configure the target script of the extraction rule for each target source database, extract the data to be converted in the target source database based on the extraction rule in the target script, and then convert the data to be converted based on the conversion rule in the target script to obtain the target data. For example, extract field 1 in table B2 in target source database B and perform field conversion, and perform the configuration script of the extraction rule select.....from.....where and the conversion rule substr on table B2 in target source database B. Field 1 can be extracted through the select.....from.....where rule in the target script, and data conversion is performed based on the substr rule. The reference example of the configuration script is as follows:
[0062] / *Data conversion script B source library* /
[0063] select field1 standard field1,......,substr(fieldn,10,2) standard fieldn,......fromTABLE_B2 where.....; ......
[0065] It should be noted that the script also includes extraction rules for extracting data, so that when needed, the data to be converted can be extracted from the target source database by configuring the system.
[0066] Furthermore, in the process of converting the data to be converted by the target script to obtain the target data, the electronic device first determines the target sub-rule corresponding to at least one target data table in the target source database based on the target script, and then converts the data to be converted in at least one target data table based on the target sub-rule, and finally obtains the target data. Among them, the conversion rule at least includes a sub-rule corresponding to at least one data table in the source database.
[0067] Optionally, the target source database may store multiple data tables. According to different conversion requirements of users, each data table may correspond to at least one sub-conversion rule. The electronic device may convert the data to be converted in the target data table according to the sub-rule corresponding to the target data table. For example, table A1 in source database A corresponds to the case when sub-rule to convert the data to be converted, table A2 in source database A corresponds to the substr sub-rule to convert the data to be converted, and table B1 in source database B corresponds to the to_char sub-rule to convert the data to be converted.
[0068] It should be noted that, by converting the data to be converted through the sub-rules of at least one data table in the database, it is avoided that the data table in the target source database can only be converted based on the same conversion rule, and accurate conversion of data is achieved.
[0069] Furthermore, in the process of the electronic device converting the data to be converted based on the target script, the conversion processing of the data to be converted can be performed in any one or more of the following ways: field conversion of the data to be converted; data type conversion of the data to be converted; data format conversion of the data to be converted.
[0070] Optionally, the target script corresponds to at least one data table in at least one target source database. When the electronic device converts the data to be converted according to the script, it can perform field conversion, data type conversion, data format conversion, or data conversion based on any combination of the above three methods. For example, when converting table A1 in the target source database A, only field conversion, or data type conversion, or data format conversion can be performed on table A1; field conversion can also be performed on the fields in table A1, and the data type of table A1 can be converted at the same time; the fields, data types, and data formats of table A1 can also be converted.
[0071] It should be noted that based on the target script, you can also delete null values or duplicate data, perform data semantic conversion, merge / splitting fields, etc. on the data to be converted. You can write configuration scripts according to the actual needs of the project to apply it to other data conversion scenarios.
[0072] In an optional embodiment, during the data conversion process, if the electronic device detects and receives a rule update instruction, it responds to the rule update instruction, obtains a first script, and updates the script to be updated among the multiple scripts to the first script.
[0073] Optionally, during the data conversion process, when the conversion field or mapping rule changes, the corresponding script needs to be updated. The user inputs an update instruction through the electronic device. After the electronic device detects the rule update instruction, it generates a first script storing the new rule and replaces the corresponding script to be updated with the first script. By modifying the configuration script, new requirements can be quickly and effectively adapted to achieve dynamic loading of projects.
[0074] It can be seen that the present invention provides a new data conversion method, which converts data for different tables by writing a configuration script. The configuration is transparent to the data conversion program, thereby realizing the synchronous conversion of data from the source library to the standard library. The data conversion work is realized by configuring the data extraction script on the front page, which increases the scalability of the project. When the conversion field or mapping rule changes, the new requirements can be quickly and effectively adapted by modifying the configuration to realize dynamic loading of the project. By performing field conversion in the SQL statement, the amount of code of the data conversion program is effectively reduced, the program logic is clearer, and the maintenance cost is low.
[0075] Example 2
[0076] According to an embodiment of the present invention, an embodiment of a data conversion device is provided, wherein: Figure 4 A schematic diagram of an optional data conversion device according to an embodiment of the present invention is shown in FIG. Figure 4 As shown, the device comprises:
[0077] The first determination module 401 is used to determine at least one target source database corresponding to the data to be converted; the second determination module 402 is used to determine the target script corresponding to each target source database from multiple scripts, wherein any one of the multiple scripts contains at least a conversion rule for converting the data; the processing module 403 is used to call the target script based on a preset program, and convert the data to be converted based on the target script to obtain the target data, wherein the preset program is a common program in the program for converting the data.
[0078] It should be noted that the above-mentioned first determination module 401, second determination module 402 and processing module 403 correspond to steps S101 to S103 in the above-mentioned embodiment, and the examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiment 1.
[0079] Optionally, the device further includes: an acquisition module and a generation module. The acquisition module is used to acquire a conversion rule corresponding to at least one source database before determining a target script corresponding to each target source database from a plurality of scripts; and the generation module is used to generate a script corresponding to each source database based on the acquired conversion rule.
[0080] Optionally, the processing module includes: an extraction module, used to extract data to be converted from at least one target source database based on a target script; and perform conversion processing on the data to be converted based on the target script to obtain target data.
[0081] Optionally, the processing module includes: a third determination module and a first processing module. The third determination module is used to determine a target sub-rule corresponding to at least one target data table in the target source database based on the target script; the first processing module is used to perform conversion processing on the data to be converted in the at least one target data table based on the target sub-rule to obtain the target data.
[0082] Optionally, the data conversion device includes: a second processing module, which is used to convert the data to be converted based on the target script in at least one or more of the following ways: field conversion of the data to be converted; data type conversion of the data to be converted; data format conversion of the data to be converted.
[0083] Optionally, the data conversion device includes: a detection module and an update module. The detection module is used to detect the receipt of a rule update instruction, respond to the rule update instruction, and obtain a first script; the update module is used to update the script to be updated among the multiple scripts to the first script.
[0084] Example 3
[0085] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data conversion method when running.
[0086] Example 4
[0087] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, wherein: Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned data conversion method when running.
[0088] Example 5
[0089] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program / instruction, and the computer program / instruction implements the above data conversion method when executed by a processor.
[0090] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0091] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0092] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0093] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0094] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0095] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, 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 methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0096] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A data conversion method, characterized in that: include: Determine at least one target source database corresponding to the data to be converted, wherein the target source database refers to a source database of the data to be converted; Determining a target script corresponding to each target source database from a plurality of scripts, wherein any one of the plurality of scripts at least includes a conversion rule for converting data; The target script is called based on a preset program, and the data to be converted is converted based on the target script to obtain target data, wherein the conversion rule recorded in the target script is the conversion logic of data conversion, and the preset program is the data conversion program logic written in the background, which is a common program in the program for converting data. The step of converting the data to be converted based on the target script includes: calling the target script corresponding to the data to be converted according to the importance of each data to be converted in the user's data conversion requirements, and converting the data to be converted according to the order indicated by the importance to obtain the target data.
2. The method according to claim 1, characterized in that Before determining the target script corresponding to each target source database from the plurality of scripts, the method further includes: Obtaining a transformation rule corresponding to at least one source database; A script corresponding to each source database is generated based on the conversion rule.
3. The method according to claim 1 or 2, characterized in that: Any one of the multiple scripts further includes an extraction rule for extracting data, wherein the data to be converted is converted based on the target script to obtain the target data, including: extracting the data to be converted from the at least one target source database based on the target script; The data to be converted is converted based on the target script to obtain the target data.
4. The method according to claim 3, characterized in that The conversion rule at least includes a sub-rule corresponding to at least one data table in the source database, wherein the data to be converted is converted based on the target script to obtain the target data, including: Determine a target sub-rule corresponding to at least one target data table in the target source database based on the target script; The data to be converted in the at least one target data table is converted based on the target sub-rule to obtain the target data.
5. The method according to claim 3, characterized in that: The method further comprises: Based on the target script, the data to be converted is converted in at least one or more of the following ways: Performing field conversion on the data to be converted; Performing data type conversion on the data to be converted; Perform data format conversion on the data to be converted.
6. The method according to claim 1, characterized in that The method further comprises: If a rule update instruction is detected, respond to the rule update instruction and obtain a first script; The to-be-updated script among the multiple scripts is updated to the first script.
7. A data conversion device, characterized in that: include: A first determination module is used to determine at least one target source database corresponding to the data to be converted, wherein the target source database refers to a source database of the data to be converted; A second determination module is used to determine a target script corresponding to each target source database from a plurality of scripts, wherein any one of the plurality of scripts at least includes a conversion rule for converting data; A processing module is used to call the target script based on a preset program, and perform conversion processing on the data to be converted based on the target script to obtain target data, wherein the conversion rule recorded in the target script is the conversion logic of data conversion, and the preset program is the data conversion program logic written in the background, which is a common program in the program for converting data. The processing module includes: a conversion submodule, which is used to call the target script corresponding to the data to be converted according to the importance of each data to be converted in the user's data conversion requirements, and convert the data to be converted according to the order indicated by the importance to obtain the target data.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the data conversion method described in any one of claims 1 to 6 when running.
9. An electronic device, characterized in that: The electronic device includes one or more processors; A memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the data conversion method described in any one of claims 1 to 6 when running.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the data conversion method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data format conversion method and device, storage medium and electronic equipment
CN113704281A