Data migration method, device, apparatus, and storage medium
By using a Java script parser to automatically complete the data migration between heterogeneous databases, the inefficiency and compatibility issues of existing technologies are resolved, and a highly efficient and traceable data migration process is achieved, avoiding any impact on the performance of the production environment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2022-11-30
- Publication Date
- 2026-06-12
Smart Images

Figure CN115757481B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and in particular to a data migration method, apparatus, device, and storage medium. Background Technology
[0002] Databases are an essential foundation for most financial industries. In the daily operation and maintenance of databases, data migration is often required, involving operations such as data export, import, and processing. Different types of databases support different structured query language script formats, and structured query language script format conversion must be performed between heterogeneous databases.
[0003] Currently, in the process of data migration, the usual practice is to first export the structured query language script from the primary database, then perform some manual format conversion and modification, and then import it into other types of heterogeneous databases. This manual method is inefficient. Summary of the Invention
[0004] This application provides a data migration method, apparatus, device, and storage medium to solve the problem of low data migration efficiency between existing heterogeneous databases.
[0005] In a first aspect, embodiments of this application provide a data migration method, including:
[0006] Obtain the source files in the first database and the database type of the first database;
[0007] Based on the database type, an input parser is determined. The input parser is used to parse the source file into key-value pairs and store them in a structured list according to a preset input template.
[0008] The structured list is obtained and input into the output parser, which is used to assemble the key-value pairs in the structured list into a file to be migrated according to a preset output template;
[0009] Obtain the file to be migrated and import it into a second database, which is a heterogeneous database with the first database.
[0010] In one possible design of the first aspect, obtaining the structured list includes:
[0011] Determine whether the size of the source file is greater than a preset threshold;
[0012] If the size of the source file is greater than a preset threshold, the source file will be divided into at least two sub-files;
[0013] The input parser parses the at least two sub-files into key-value pairs and stores them in a structured list.
[0014] In another possible design of the first aspect, the step of parsing the source file into key-value pairs and storing them in a structured list according to the input parser includes:
[0015] Scan and read the contents of each data line in the sub-file;
[0016] In each data row, identify the key and the value associated with that key.
[0017] Replace the placeholders in the input template with the key and the value associated with the key to obtain structured data;
[0018] The structured data is organized according to the order of each data row in the sub-file to obtain the structured list.
[0019] In another possible design of the first aspect, obtaining the file to be migrated includes:
[0020] The structured list is traversed to obtain the key and the value associated with each data row from the structured list;
[0021] The key contained in each data row and the value associated with the key are input to the output parser to assemble the file to be migrated.
[0022] In another possible design of the first aspect, the step of inputting the key contained in each data row and the value associated with the key to the output parser to assemble the file to be migrated includes:
[0023] Replace the placeholders in the output template with the key and the value associated with the key to assemble the file to be migrated.
[0024] In another possible design of the first aspect, the structured list includes at least one data row, the data row including at least one key-value pair, the key-value pair including a key and a value associated with the key.
[0025] In another possible design of the first aspect, the source file is a Structured Query Language.
[0026] Secondly, embodiments of this application provide a data migration apparatus, comprising:
[0027] The file acquisition module is used to acquire the source files in the first database and the database type of the first database;
[0028] The input parser calling module is used to determine the input parser according to the database type. The input parser is used to parse the source file into key-value pairs and store them in a structured list according to a preset input template.
[0029] The output parser calling module is used to obtain the structured list and input it into the output parser. The output parser is used to assemble the key-value pairs in the structured list into a file to be migrated according to a preset output template.
[0030] The file import module is used to obtain the file to be migrated and import the file to be migrated into a second database, wherein the database type of the second database is different from that of the first database.
[0031] Thirdly, embodiments of this application provide a computer device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method as described in any of the preceding claims.
[0032] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer instructions that, when executed by a processor, are used to implement the method described above.
[0033] The data migration method, apparatus, device, and storage medium provided in this application select an appropriate input parser based on the type of database to be migrated, parse the source file using an input template, and then select a specified output parser to output a compatible file to be migrated and import it into a second database. This invention solves the script compatibility problem between heterogeneous databases, eliminates the need for laborious manual modification of script formats, and improves data migration efficiency. Attached Figure Description
[0034] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application;
[0035] Figure 1 This is a schematic diagram illustrating a data migration scenario provided in an embodiment of this application.
[0036] Figure 2 A flowchart illustrating the data migration method provided in this application embodiment;
[0037] Figure 3 This is a schematic diagram of the workflow of the input parser provided in the embodiments of this application;
[0038] Figure 4A schematic diagram of a structured list provided for an embodiment of this application;
[0039] Figure 5 A schematic diagram of the workflow of the script processor provided in the embodiments of this application;
[0040] Figure 6 This is a schematic diagram of the workflow of the output parser provided in the embodiments of this application;
[0041] Figure 7 This is a schematic diagram of the structure of the data migration device provided in the embodiments of this application;
[0042] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of this application.
[0043] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0045] First, let me explain the terms used in this application:
[0046] A database is a repository for organizing, storing, and managing data according to a data structure. Databases enable data storage, sharing, organization, and unified management. Databases can be categorized into relational databases, non-relational databases, and distributed databases, among others.
[0047] Structured Query Language (SQL): A structured computer language written in a specific format that enables basic operations on databases.
[0048] Script: An executable file written in a specific descriptive language according to a certain format.
[0049] In data migration scenarios, many mature databases offer solutions that can export their unique data files. However, these solutions are typically limited to migrations between homogeneous databases. Migrating between heterogeneous databases often relies on SQL scripts. Since different databases adhere to different SQL standards, manual adjustments to the SQL scripts are necessary for the target database. Homogeneous database migrations generally involve exporting and importing their specific migration files, combined with appropriate commands. Heterogeneous database migrations usually involve exporting the SQL script, making some manual modifications, and then importing it into other databases. For scenarios requiring special handling, such as exporting a data file from one table and importing it into multiple heterogeneous tables, there are currently no mature products on the market. In some business scenarios, it's also necessary to process the exported scripts for business logic. Traditional solutions cannot automatically process exported data files; they can only import them into the target database and then execute the corresponding SQL statements on the target machine to implement certain data processing logic. This can impact database performance, especially in scenarios with large data volumes, complex processing logic, and long processing times. Specifically, it has the following disadvantages: 1) Manual processing is prone to errors and is not suitable for large-scale processing; 2) There are compatibility issues when migrating heterogeneous databases; 3) Online processing of complex logic consumes database server resources and can easily affect database performance.
[0050] To address the aforementioned problems, this invention relates to a Java-based general-purpose SQL script parser processor. It selects an appropriate input parser based on different scripts, combines it with an input template to complete script reading, and allows users to rewrite the processor to perform complex processing procedures. The processing result can be output using a specified output parser combined with an output template to produce a script that meets the requirements. This invention solves the script compatibility problem between heterogeneous databases, while also handling complex processing flows offline, achieving traceable and step-by-step debugging of processing results, and avoiding the problem of databases consuming computing resources and impacting performance in production environments.
[0051] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0052] Figure 1 This is a schematic diagram illustrating a data migration scenario provided in an embodiment of this application, such as... Figure 1As shown, database A and database B are heterogeneous databases. Heterogeneous databases refer to databases where the SQL language formats are different. During data migration, SQL script format conversion is required to ensure the data can still run on the other database. In this embodiment, the source script comes from database A. After being parsed by an input parser, it is processed by a script processor based on processing logic, and finally input to an output parser to be converted into a target script. After being migrated to database B, the target script can be used and run normally on database B.
[0053] Figure 2 This is a flowchart illustrating the data migration method provided in an embodiment of this application. This method can be applied to computer devices; taking a computer device as the executing entity as an example, such as... Figure 2 As shown, the method may include the following steps: Step S201, obtaining the source file in the first database and the database type of the first database.
[0054] In this embodiment, the first database refers to the database that needs to be migrated. Different databases have different specifications for SQL. For example, the second database (i.e., the database receiving the migrated data) mentioned later has different specifications for SQL compared to the first database. The first and second databases are heterogeneous. When migrating data from the first database to the second database, the migration needs to be achieved through SQL scripts. However, since different databases have different specifications for SQL, the SQL scripts need to be formatted according to the second database.
[0055] In this embodiment, the source file refers to the source SQL script of the first database, which is a structured query language. In this embodiment, the data in the first database can be exported as the source SQL script.
[0056] Step S202: Determine the input parser based on the database type. The input parser is used to parse the source file into key-value pairs and store them in a structured list according to a preset input template.
[0057] In this embodiment, different input parsers can be invoked based on the database type. For example, the invocation relationship can be set, such as the input parser for database of type H1 being S1 and the input parser for database of type H2 being S2.
[0058] The input template can be selected by the user based on the actual situation. The computer device can receive the selection signal from the user and thus determine the corresponding input template. For example, the format of the input template is as follows: {COL1} = {VAL1}, {COL2} = {VAL2}, {COL3} = {VAL3}, ..., {COLn} = {VALn}, where COLn and VALn will be replaced with content from the source SQL script.
[0059] In this embodiment, the input parser can parse the content of the SQL script into the input template, and then organize the resulting input template into a structured list. This structured list is stored in memory.
[0060] In this embodiment, reference Figure 1 The processing logic in the script processor can be rewritten, and the SQL processing logic can be redefined. The script processor loads the processing logic to perform business processing on the data parsed by the input parser.
[0061] Step S203: Obtain the structured list and input it into the output parser. The output parser is used to assemble the key-value pairs in the structured list into a file to be migrated according to the preset output template.
[0062] Step S204: Obtain the file to be migrated and import it into the second database. The database type of the second database is different from that of the first database.
[0063] In this embodiment, the computer device can read the output template (which can be pre-defined by the user). After the core logic processing is completed, the output parser assembles the output content according to the structured list and the output template. The output template has a corresponding format. By assembling the content from the structured list into the output template, the SQL script for the second database can be obtained, the format is converted, and the script is imported into the second database.
[0064] This application's embodiments select appropriate input parsers based on different scripts, combining them with input templates to complete script reading. Users can rewrite the processor to complete complex processing procedures, and the processing results can be output using specified output parsers combined with output templates to produce scripts that meet the requirements. This invention solves the script compatibility problem between heterogeneous databases, while processing complex workflows offline, achieving traceable and step-by-step debugging of processing results, and avoiding the problem of production environment databases consuming computing resources and affecting performance.
[0065] In other embodiments, determining the structured list can be achieved through the following steps: determining whether the size of the source file is greater than a preset threshold; if the size of the source file is greater than the preset threshold, then segmenting the source file into at least two sub-files; and parsing the at least two sub-files into key-value pairs according to the input parser and storing them in the structured list.
[0066] For example, Figure 3 This is a schematic diagram of the workflow of the input parser provided in the embodiments of this application, as follows: Figure 3 As shown, it includes the following steps: S301, loading the user-defined input template. S302, loading the source SQL script to be processed. S303, determining whether the source SQL script is a large file (i.e., whether the size of the SQL script exceeds a preset threshold, because loading the entire large file would cause memory overflow). S304, if it is a large file, reading and processing it in large segments (the segment size needs to be set according to the computer's performance; the default segment size is 1GB). S305, if it is not a large file, reading it all into memory at once. S306, parsing the content to obtain a structured representation of the input data. S307, organizing, optimizing, sorting, and outputting the structured data.
[0067] For example, in other embodiments, the structured list includes at least one data row, each data row including at least one key-value pair, the key-value pair including a key and a value associated with the key. For example, Figure 4 A schematic diagram of a structured list provided in an embodiment of this application, such as Figure 4 As shown, a list contains multiple elements, and each element can include multiple key-value pairs. The list can refer to the source SQL file, each element in the list refers to each row in the source SQL file, and the key-value pairs refer to the content contained in each row.
[0068] In this embodiment, each element in the list can be a graph object (also known as a MAP object, which maps keys to values) or an entity object. For example, the key-value pairs in the Map object are content parsed from the source SQL file by the input parser based on the input template.
[0069] This application embodiment reads the source SQL script in segments, which can avoid memory overflow of computer devices when the source SQL script is too large, and improve the stability of the script processing.
[0070] Based on the above embodiments, in some other embodiments, the above-mentioned "parse the source file into key-value pairs and store them in a structured list according to the input parser" can be implemented through the following steps: scan and read the contents of each data line in the sub-file; determine the key and the value associated with the key in the contents of each data line; replace the placeholders in the input template with the key and the value associated with the key to obtain structured data; and organize the structured data according to the arrangement order of each data line in the sub-file to obtain a structured list.
[0071] In this embodiment, the sub-files of the source SQL script can be scanned line by line. The content of each data line in the sub-file is retrieved and placeholders are replaced according to a specified input template to obtain structured data. Here, keys and values form key-value pairs; for example, refer to the above description. Figure 4 In the diagram, key1, key2, key3, and key4 are keys, and value1, value2, value3, and value4 are values. Different keys are associated with different values; for example, key1 is associated with value1. Placeholders can be divided into key placeholders and value placeholders. If the content of a data row is a key, the corresponding key placeholder in the input template is replaced; if the content of a data row is a value, the corresponding value placeholder in the input template is replaced.
[0072] In this embodiment, the input template and the output template have different formats. Correspondingly, the format of the input template can be the same as the SQL script format of the first database, and the format of the output template can be the same as the SQL script format of the second database.
[0073] This application embodiment uses an input template and an input parser to parse the source SQL script to obtain a structured list, which can solve the script compatibility problem between heterogeneous databases and improve the data migration efficiency between heterogeneous databases.
[0074] Furthermore, based on the above embodiments, in some embodiments, the acquisition of the file to be migrated can be specifically achieved through the following steps: traversing the structured list, obtaining the key and the value associated with the key contained in each data row from the structured list; inputting the key and the value associated with the key contained in each data row to the output parser to assemble the file to be migrated.
[0075] In this embodiment, after obtaining the structured list, it can be... Figure 1 The script processor shown processes the structured list, for example. Figure 5 This is a schematic diagram of the workflow of the script processor provided in the embodiments of this application, such as... Figure 5As shown, it includes the following steps: Step S501, iterate through the structured list. Step 502, determine if the structured list has been processed. Step 503, if not, extract each element from the list. Step 504, if processed, output to the output parser for parsing. Step 505, extract the key-value pairs from the elements. Step 506, the processor loads the processing logic file. This allows for complex business processing of the source SQL script offline, without consuming production environment computing resources or modifying production environment data, thus maximizing production environment stability. Step S507, assemble the processing results. Step S508, capture and handle exceptions generated during the execution of the processing logic.
[0076] This application embodiment selects the corresponding input parser according to different scripts, and completes script reading by combining the input template. Users can rewrite the processor to complete complex processing procedures. The processing result can be output by selecting a specified output parser and combining the output template to output a script that meets the requirements. At the same time, the complex processing flow is processed offline, so as to achieve the effect of traceable processing results and step-by-step debugging, avoiding the problem of database occupying computing resources and affecting performance in the production environment.
[0077] Based on the above embodiments, in some other embodiments, placeholders in the output template can be replaced with keys and values associated with the keys to assemble the file to be migrated.
[0078] In this embodiment, for example, the output template can be in the same format as the SQL script of the second database. Placeholders in the output template can also be divided into key placeholders and value placeholders, with each key placeholder associated with a value placeholder. Specifically, the key-value pairs in the structured list can be iterated and read, assembled into SQL statements according to the output template format, and a filename can be generated based on the timestamp. This data is then written to an SQL file as the file to be migrated.
[0079] This application's embodiments solve the script compatibility problem between heterogeneous databases by selecting the appropriate output parser based on different scripts and combining it with output templates to assemble SQL scripts, thereby improving the efficiency of data migration between heterogeneous databases.
[0080] Exemplary, in some embodiments, Figure 6 This is a schematic diagram illustrating the workflow of the output parser provided in an embodiment of this application. For example, the output parser can be various output parsers such as Oracle, relational database management systems (MySQL), and SQL Server. Figure 6As shown, it includes the following steps: Step S601, load the output template. The output parser assembles the output content according to the fixed format in the template. Step S602, loop through the structured list and retrieve the processed elements. Step S603, determine if the loop is complete. Step S604, retrieve the key-value pairs from the list. Step S605, assemble the structured query statement according to the output template. Step S606, generate a filename based on the timestamp. Step S607, write the processing result to the structured query statement file. This structured query statement file can be executed directly in the second database.
[0081] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0082] Figure 7 This is a schematic diagram of the structure of a data migration device provided in an embodiment of this application. The data migration device can be located in a computer device, such as... Figure 7 As shown, the data migration device 700 may specifically include a file acquisition module 710, an input parser invocation module 720, an output parser invocation module 730, and a file import module 740. The file acquisition module 710 acquires the source file and the database type of the first database from a first database. The input parser invocation module 720 determines the input parser based on the database type; the input parser parses the source file into key-value pairs according to a preset input template and stores them in a structured list. The output parser invocation module 730 acquires the structured list and inputs it to the output parser; the output parser assembles the key-value pairs in the structured list into a file to be migrated according to a preset output template. The file import module 740 acquires the file to be migrated and imports it into a second database, the database type of which is different from that of the first database.
[0083] Optionally, the output parser calling module can be used to: determine whether the size of the source file is greater than a preset threshold; if the size of the source file is greater than the preset threshold, then segment the source file into at least two sub-files; and parse the at least two sub-files into key-value pairs according to the input parser and store them in a structured list.
[0084] Optionally, the output parser calling module can be used to: scan and read the contents of each data line in the sub-file; determine the key and the value associated with the key in the contents of each data line; replace the placeholders in the input template with the key and the value associated with the key to obtain structured data; and organize the structured data according to the order of each data line in the sub-file to obtain a structured list.
[0085] Optionally, the file import module can be used to: traverse the structured list, obtain the key and associated value of each data row from the structured list; and input the key and associated value of each data row into the output parser to assemble the file to be migrated.
[0086] Optionally, the file import module can be used to replace placeholders in the output template with keys and values associated with those keys to assemble the file to be migrated.
[0087] Optionally, the structured list includes at least one data row, the data row includes at least one key-value pair, and the key-value pair includes a key and a value associated with the key.
[0088] Optionally, the source file is in Structured Query Language.
[0089] The apparatus provided in this application embodiment can be used to execute the methods in the above-described embodiments. Its implementation principle and technical effects are similar, and will not be repeated here.
[0090] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software via processing element calls; they can be fully implemented in hardware; or some modules can be implemented by processing element calls to software, while others are implemented in hardware. For example, the file import module can be a separate processing element, or it can be integrated into a chip in the above device. Alternatively, it can be stored as program code in the memory of the above device, and its function can be called and executed by a processing element. The implementation of other modules is similar. Moreover, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0091] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of this application. For example... Figure 8As shown, the computer device 800 includes at least one processor 810, a memory 820, a bus 830, and a communication interface 840. The processor 810, communication interface 840, and memory 820 communicate with each other via the bus 830. The communication interface 840 is used to communicate with other devices. The processor 810 executes programs, specifically performing the relevant steps in the methods described in the above embodiments. The processor may be a central processing unit, an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computer device may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs. The memory 820 is used to store computer instructions. The memory may include high-speed RAM memory and may also include non-volatile memory, such as at least one disk storage device.
[0092] This embodiment also provides a readable storage medium storing computer instructions. When at least one processor of a computer device executes the computer instructions, the computer device performs the data migration method provided in the various embodiments described above.
[0093] This embodiment also provides a program product including computer instructions stored in a readable storage medium. At least one processor of a computer device can read the computer instructions from the readable storage medium, and the at least one processor executes the computer instructions to cause the computer device to implement the data migration methods provided in the various embodiments described above.
[0094] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates an "or" relationship between the preceding and following related objects; in formulas, the character " / " indicates a "division" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0095] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. In the embodiments of this application, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A data migration method, characterized in that, include: Obtain the source files in the first database and the database type of the first database; Based on the database type, an input parser is determined. The input parser is used to parse the source file into key-value pairs and store them in a structured list according to a preset input template. The input template defines the format for extracting keys and values from the data rows of the source file. The structured list is obtained and input into the output parser. The output parser is used to assemble the key-value pairs in the structured list into a file to be migrated according to a preset output template. The output template defines the format for assembling key-value pairs into a script that conforms to the second database format. Obtain the file to be migrated and import it into a second database. The second database and the first database are heterogeneous databases.
2. The method according to claim 1, characterized in that, Obtaining the structured list includes: Determine whether the size of the source file is greater than a preset threshold; If the size of the source file is greater than a preset threshold, the source file will be divided into at least two sub-files; The input parser parses the at least two sub-files into key-value pairs and stores them in a structured list.
3. The method according to claim 2, characterized in that, The step of parsing the source file into key-value pairs and storing them in a structured list according to the input parser includes: Scan and read the contents of each data line in the sub-file; In each data row, identify the key and the value associated with that key. Replace the placeholders in the input template with the key and the value associated with the key to obtain structured data; The structured data is organized according to the order of each data row in the sub-file to obtain the structured list.
4. The method according to claim 3, characterized in that, The process of obtaining the file to be migrated includes: The structured list is traversed to obtain the key and the value associated with each data row from the structured list; The key contained in each data row and the value associated with the key are input to the output parser to assemble the file to be migrated.
5. The method according to claim 4, characterized in that, The step of inputting the key contained in each data row and the value associated with the key into the output parser to assemble the file to be migrated includes: Replace the placeholders in the output template with the key and the value associated with the key to assemble the file to be migrated.
6. The method according to any one of claims 1-5, characterized in that, The structured list includes at least one data row, the data row includes at least one key-value pair, the key-value pair includes a key and a value associated with the key.
7. The method according to any one of claims 1-5, characterized in that, The source file is in Structured Query Language.
8. A data migration device, characterized in that, include: The file acquisition module is used to acquire the source files in the first database and the database type of the first database; The input parser calling module is used to determine the input parser according to the database type. The input parser is used to parse the source file into key-value pairs and store them in a structured list according to a preset input template. The input template defines the format for extracting keys and values from the data rows of the source file. The output parser calling module is used to obtain the structured list and input it into the output parser. The output parser is used to assemble the key-value pairs in the structured list into a file to be migrated according to a preset output template. The output template defines the format of assembling key-value pairs into a script that conforms to the second database format. The file import module is used to obtain the file to be migrated and import the file to be migrated into a second database, wherein the database type of the second database is different from that of the first database.
9. A computer device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, are used to implement the method as described in any one of claims 1-7.