A data migration method and apparatus
By identifying, processing, and loading data items into the new system during the data migration process, the problems of large workload, low accuracy, and slow speed in existing technologies are solved, achieving efficient and accurate data migration.
Patent Information
- Application Number
- CN202110516630.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-12
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2041-05-12
AI Technical Summary
Existing technologies involve a large workload, complex content, low accuracy, slow speed, and long time consumption during data migration.
The data items are determined according to the set data migration scope. The data to be migrated is obtained from the old system through the mapping relationship, processed into a specific format file, and loaded into the new system after processing and verification.
It reduced the workload of staff, simplified the work content, improved the accuracy and speed of data migration, and reduced migration time.
Smart Images

Figure CN113111051B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of automatic programming, and in particular, to a data migration method and device. BACKGROUND
[0002] In the current scheme of migrating data from an old system to a new system, due to the differences in database design, table structure design and overall architecture design between the old and new systems, the staff needs to fully understand the related database design, database table structure and business logic of the old and new systems, analyze the design differences between the old and new systems, determine the specific scheme of data migration, and realize data migration.
[0003] In the process of implementing the present application, the inventors have found that the prior art at least has the following problems:
[0004] The workload of the staff is large, the work content is complex, the accuracy of data migration is low, the migration speed is slow, and the time consumption is long. SUMMARY
[0005] Therefore, the embodiments of the present application provide a data migration method and device, which can reduce the workload of the staff, simplify the work content, improve the accuracy of data migration, improve the migration speed, and reduce the migration time.
[0006] To achieve the above object, according to an aspect of the embodiments of the present application, a data migration method is provided.
[0007] A data migration method comprises: determining a data item according to a set data migration range; obtaining corresponding to-be-migrated data from a first system according to the data item; processing the to-be-migrated data into content of the data item according to a preset processing logic; and loading the content of the data item to a second system.
[0008] Optionally, the determining of the data item according to the set data migration range comprises: determining the data item according to a page and / or a function included in the set data migration range.
[0009] Optionally, the determining of the data item according to the page and / or the function included in the set data migration range comprises: splitting the set data migration range into data migration blocks according to the page and / or the function included in the set data migration range; and determining the data item in each data migration block.
[0010] Optionally, the obtaining, from the first system, corresponding to-be-migrated data according to the data item comprises: obtaining a first mapping relationship between the data item and a database table name and a database field name in the first system in advance; and obtaining, from the first system, corresponding to-be-migrated data according to the database table name and the database field name in the first system according to the first mapping relationship.
[0011] Optionally, the processing, according to preset processing logic, of the to-be-migrated data into the content of the data item comprises: unloading the to-be-migrated data into a first format file; converting the first format file to obtain a temporary file comprising to-be-processed data item content; and processing the to-be-processed data item content in the temporary file according to a processing rule of the data item to obtain the content of the data item.
[0012] Optionally, the data corresponding to the to-be-migrated data in the first format file has a unique identifier, and the unique identifier is a data migration master serial number, which is obtained by encoding data in the set data migration range.
[0013] Optionally, the converting of the first format file to obtain the temporary file comprising to-be-processed data item content comprises: converting the first format file into an executable second format file; and executing the second format file to generate the temporary file comprising to-be-processed data item content.
[0014] Optionally, the first format file is an XML format file or a Json format file, and the second format file is a standard SQL file.
[0015] Optionally, after the processing, according to a processing rule of the data item, of the to-be-processed data item content in the temporary file to obtain the content of the data item, the method further comprises: verifying the content of the data item according to a verification rule of the data item, and determining that the verification is passed.
[0016] Optionally, for each of the data items, the method further comprises: determining a data rule in the data item, a quantity of the data items, the verification rule, and the processing rule.
[0017] Optionally, the loading of the content of the data item into the second system comprises: obtaining a second mapping relationship between the data item and a database table name and a database field name in the second system in advance; and loading the content of the data item into a corresponding database table in the second system according to the database table name and the database field name in the second system according to the second mapping relationship.
[0018] According to another aspect of the embodiment of the present application, a data migration device is provided.
[0019] The data migration device comprises a data item determination module, a data acquisition module, a data processing module and a loading module. The data item determination module is configured to determine data items according to a set data migration range. The data acquisition module is configured to acquire corresponding data to be migrated from a first system according to the data items. The data processing module is configured to process the data to be migrated into contents of the data items according to a preset processing logic. The loading module is configured to load the contents of the data items into a second system.
[0020] Optionally, the data item determination module is further configured to determine the data items according to pages and / or functions included in the set data migration range.
[0021] Optionally, the data item determination module is further configured to split the set data migration range into data migration blocks according to pages and / or functions included in the set data migration range, and determine data items in each data migration block.
[0022] Optionally, the data acquisition module is further configured to acquire a first mapping relationship between the data items and database table names and database field names in the first system in advance, and acquire corresponding data to be migrated from the first system according to the database table names and the database field names in the first system according to the first mapping relationship.
[0023] Optionally, the data processing module is further configured to unload the data to be migrated into a first format file, convert the first format file to obtain a temporary file including contents of data items to be processed, and process the contents of the data items to be processed in the temporary file according to a processing rule of the data items to obtain the contents of the data items.
[0024] Optionally, data corresponding to the data to be migrated in the first format file has a unique identifier, the unique identifier is a data migration master serial number, and the data migration master serial number is obtained by encoding data in the set data migration range.
[0025] Optionally, the data processing module is further configured to convert the first format file into an executable second format file, and execute the second format file to generate the temporary file including the contents of the data items to be processed.
[0026] Optionally, the first format file is an XML format file or a Json format file, and the second format file is a standard SQL file.
[0027] Optionally, the device further comprises a verification module configured to verify the contents of the data items according to a verification rule of the data items, and determine that the verification is passed.
[0028] Optionally, the data item determining module is further configured to determine a data rule in the data item, a quantity of the data item, the check rule, and the processing rule.
[0029] Optionally, the loading module is further configured to acquire a second mapping relationship between the data item and a database table name and a database field name in the second system, and load the content of the data item into a corresponding database table in the second system according to the second mapping relationship and the database table name and the database field name in the second system.
[0030] According to another aspect of the embodiments of the present application, an electronic device is provided.
[0031] An electronic device includes one or more processors; a memory for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the data migration method provided by the embodiments of the present application.
[0032] According to another aspect of the embodiments of the present application, a computer readable medium is provided.
[0033] A computer readable medium, on which a computer program is stored, the computer program, when executed by a processor, implements the data migration method provided by the embodiments of the present application.
[0034] One of the above embodiments has the following advantages or beneficial effects: determining the data item according to the set data migration range; obtaining the corresponding data to be migrated from the first system according to the data item; processing the data to be migrated into the content of the data item according to the preset processing logic; and loading the content of the data item into the second system. This can reduce the workload of the staff, simplify the work content, improve the accuracy of data migration, improve the migration speed, and reduce the migration time.
[0035] The further effects of the above non-conventional optional mode will be described in the following combined with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0036] The accompanying drawings are used to better understand the present application, and do not constitute an improper limitation on the present application. Among them:
[0037] Figure 1 is a main step schematic diagram of the data migration method according to one embodiment of the present application;
[0038] Figure 2 is a flow schematic diagram of the data migration according to one embodiment of the present application;
[0039] Figure 3is a main module schematic diagram of a data migration device according to an embodiment of the present application;
[0040] Figure 4 is an exemplary system architecture diagram to which embodiments of the present application can be applied;
[0041] Figure 5 is a structural schematic diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0042] The exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, and should be considered as merely exemplary. Thus, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted from the following description.
[0043] Figure 1 is a main step schematic diagram of a data migration method according to an embodiment of the present application.
[0044] As shown in Figure 1 , the data migration method of an embodiment of the present application mainly includes the following steps S101 to S104.
[0045] Step S101: determining data items according to a set data migration range.
[0046] Determining data items according to a set data migration range can include: determining data items according to pages and / or functions included in the set data migration range.
[0047] Determining data items according to pages and / or functions included in the set data migration range can include: splitting the set data migration range into data migration blocks according to the pages and / or functions included in the set data migration range; and determining data items in each data migration block.
[0048] For each determined data item, an embodiment of the present application can further determine data rules in the data item, the number of data items, check rules and processing rules.
[0049] Among them, the data item is the smallest unit that can be divided by the data migration range.
[0050] Step S102: obtaining corresponding to-be-migrated data from a first system according to the data items.
[0051] According to the data item, the corresponding to-be-migrated data is acquired from the first system, which can include: acquiring a first mapping relationship between the predetermined data item and a database table name and a database field name in the first system; and acquiring the corresponding to-be-migrated data from the first system according to the database table name and the database field name in the first system according to the first mapping relationship.
[0052] Step S103: processing the to-be-migrated data into the content of the data item according to a preset processing logic.
[0053] Processing the to-be-migrated data into the content of the data item according to the preset processing logic can include: unloading the to-be-migrated data into a first format file; converting the first format file to obtain a temporary file including the content of the to-be-processed data item; and processing the content of the to-be-processed data item in the temporary file according to a processing rule of the data item to obtain the content of the data item.
[0054] The data corresponding to the to-be-migrated data in the first format file (i.e., the data unloaded into the first format file) has a unique identifier, which is a data migration master serial number, and the data migration master serial number can be obtained by encoding the data in a set data migration range.
[0055] Converting the first format file to obtain the temporary file including the content of the to-be-processed data item can include: converting the first format file into an executable second format file; and executing the second format file to generate the temporary file including the content of the to-be-processed data item.
[0056] The first format file can be an XML (Extensible Markup Language) format or a Json (JavaScript Object Notation) format file, and the second format file can be a standard SQL (Structured Query Language) file, where Json is a lightweight data exchange format, and SQL is a database query and programming language.
[0057] After processing the content of the to-be-processed data item in the temporary file according to the processing rule of the data item to obtain the content of the data item, the method can further include: verifying the content of the data item according to a verification rule of the data item and determining that the verification is passed. For example, verifying the content of the data item can include verifying whether the content of the data item meets a certain data rule in the data item, such as verifying whether the content of the data item meets a set length requirement, and the like.
[0058] Step S104: loading the content of the data item to the second system.
[0059] Loading the content of the data item into the second system can include: obtaining a second mapping relationship between the predetermined data item and a database table name, a database field name in the second system; and loading the content of the data item into a corresponding database table in the second system according to the second mapping relationship and the database table name and the database field name in the second system.
[0060] The first system can be an old system, and the second system can be a new system. The data migration is to migrate data from the old system to the new system.
[0061] In one embodiment, the set data migration range is split into data migration blocks according to pages and / or functions included in the set data migration range, and each data migration block is refined to determine a data item. From the perspective of a user, the overall range of data migration is determined according to pages (such as query pages, detail display pages, and the like) in the user's perspective and functions (such as import, export, and print functions) needed by the user, so as to obtain the set data migration range. From the determined overall range of data migration, the overall range of data migration is split into data migration blocks according to pages and functions, wherein one data migration page or function can be divided into one or more data migration blocks. Each data migration block is refined to determine a data migration item (i.e., a data item), wherein one data migration block can be refined into one or more data migration items.
[0062] In one embodiment, a data migration master serial number is obtained by encoding data in the set data migration range, and the data migration master serial number is a unique identifier. The data corresponding to the data to be migrated in the first format file has a unique identifier. Each page and / or each function in the determined overall range of data migration is numbered to generate a data migration master serial number, and the data migration master serial number has global uniqueness. The data to be migrated can be determined by the data migration master serial number and the migration data item.
[0063] In one embodiment, for each data item, data rules in the data item, the number of data items, check rules and processing rules are determined. The data rules in the data item can include single-item data rules and multi-item data rules, wherein the single-item data rules are data rules related to a single data item, such as whether the data item content can be empty, whether it must be a number, whether the length meets the requirements, data content filling requirements, etc. The multi-item data rules are data rules related to two or more data items, such as whether the corresponding relationship between the second-to-last digit of the ID number data item and the gender data item is correct, etc. The processing rules and the check rules can be determined by the data rules; for the data item, the data item content, the processing rules and the check rules, a data item table, a data item content table, a data item processing table and a data item check rule table can be established respectively, as shown in Tables 1, 2, 3 and 4, wherein the data item id is the unique identifier of the data item.
[0064] Table 1: Data item table
[0065] Serial number Data item id Data item name
[0066] Table 2: Data item content table
[0067]
[0068] Table 3: Data item processing table
[0069] Serial number Data item id Processing rule
[0070] Table 4: Data item check table
[0071] Serial number Data item id Check rule Error prompt
[0072] In one embodiment, a first mapping relationship between the data item and the database table name and the database field name in the first system is determined in advance, and the first mapping relationship is used to obtain the corresponding data to be migrated from the first system according to the database table name and the database field name in the first system. For each data migration item, the source of the data migration item in the old system (i.e. the first system) is determined in advance, the source specifically includes the database table name and the database field name, and a mapping relationship table of the old system and the data item is generated, as shown in Table 5, wherein the first mapping relationship is recorded.
[0073] Table 5: Mapping relationship table of old system and data item
[0074]
[0075] In one embodiment, a second mapping relationship between data items and database table names and database field names in the second system is predetermined. This second mapping relationship is used to load the content of the data items into the corresponding database tables in the second system according to the database table names and database field names in the second system. For each data migration item, the destination of the data migration item in the new system (i.e., the second system) is predetermined. The destination specifically includes the database table name and database field name. A mapping relationship table between the new system and the data items is generated, as shown in Table 6, which records the second mapping relationship.
[0076] Table 6. Mapping Relationship between the New System and Data Items
[0077]
[0078] Figure 2 This is a schematic diagram of a data migration process according to an embodiment of the present invention.
[0079] like Figure 2 As shown, embodiments of the present invention may include a data unloading unit, a conversion unit, a processing unit, a verification unit, and a loading unit.
[0080] In the data unloading unit, a first mapping relationship is obtained between predetermined data items and database table names and database field names in the first system; based on the first mapping relationship, the corresponding data to be migrated is obtained from the first system according to the database table names and database field names in the first system; the data to be migrated is unloaded (i.e., saved) into a first format file. Specifically, based on the mapping relationship table between the old system and data items, the data in the old system is unloaded into XML or JSON format files (i.e., the first format file).
[0081] In the conversion unit, the first format file is converted into an executable second format file; the second format file is executed to generate a temporary file containing the data items to be processed. Specifically, XML or JSON format files are processed to convert them into standard SQL files (i.e., the second format file), and the SQL file is executed in the database to generate a temporary file. If the conversion fails, the unloading unit is re-executed after checking and adjusting.
[0082] In the processing unit, the content of the data items to be processed in the temporary file is processed according to the processing rules of the data items to obtain the content of the data items. Specifically, the content of the data items to be processed in the temporary file is processed according to the processing rules in the data item processing table. If the processing fails, the unloading unit is re-executed after checking and adjusting. The processing may include standard data conversion, special symbol processing, etc., and the processing rules may include relevant rules such as standard data conversion and special symbol processing.
[0083] In the checking unit, the content of the data item is checked according to the checking rule of the data item, and it is determined that the checking is passed (for example, the content of the data item is checked to meet the requirement of the checking rule). Specifically, the processed data item content is checked according to the checking rule in the data item checking rule table, and if the checking is not passed, an error prompt is displayed, and the unloading unit is re-executed after checking and adjustment.
[0084] In the loading unit, a second mapping relationship between the predetermined data item and the database table name and the database field name in the second system is obtained; according to the second mapping relationship, the content of the data item is loaded into the corresponding database table in the second system according to the database table name and the database field name in the second system. Specifically, according to the mapping relationship table of the new system and the data item, the content of the data item that is processed and passed the checking is loaded into the corresponding database table in the new system, and if the loading fails, the unloading unit is re-executed after checking and adjustment.
[0085] In one embodiment, by changing the first mapping relationship and / or the second mapping relationship of the data item, data migration from one or more first systems to one or more second systems can be achieved.
[0086] In one embodiment, the processing rule of the data item is determined by the staff of the old system, and the checking rule is determined by the staff of the new system. The staff of the old system can not need to learn the content architecture of the new system, and the staff of the new system can not need to learn the content architecture of the old system. The staff of the two systems are respectively responsible for their own work content. Therefore, the embodiment of the present application can greatly reduce the workload of the staff, simplify the work content, and improve the efficiency and accuracy of data migration.
[0087] The data migration method of the embodiment of the present application cuts in from the perspective of the user, determines the range of the migrated data, determines the checking rule of each data item, and can process and check the data in the dimension of the migrated data item (i.e. data item). The designers and developers (i.e. staff) can be responsible for part of the respective system, without the need for a large amount of cross-learning of the content of the opposite system. The learning content is relatively less, and the staff of the new and old systems only need to complete the source and destination of the respective data item, greatly improving the accuracy of data migration, and can complete complex data migration work in a short time, with strong operability.
[0088] Figure 3 It is the main module schematic diagram of the data migration device according to one embodiment of the present application.
[0089] As Figure 3 shown, the data migration 300 of one embodiment of the present application mainly includes a data item determination module 301, a data acquisition module 302, a data processing module 303, and a loading module 304.
[0090] The data item determination module 301 is used to determine data items according to the set data migration range;
[0091] The data acquisition module 302 is used to acquire the corresponding data to be migrated from the first system based on the data items;
[0092] The data processing module 303 is used to process the data to be migrated into the content of data items according to the preset processing logic;
[0093] Load module 304 is used to load the contents of data items into the second system.
[0094] In one embodiment, the data item determination module is specifically used to: determine data items according to the pages and / or functions included in the set data migration scope.
[0095] In one embodiment, the data item determination module is specifically used to: divide the set data migration range into data migration blocks according to the pages and / or functions included in the set data migration range; and determine the data items in each data migration block.
[0096] In one embodiment, the data acquisition module is specifically used to: acquire a first mapping relationship between a predetermined data item and a database table name and a database field name in the first system; and acquire the corresponding data to be migrated from the first system according to the first mapping relationship and the database table name and database field name in the first system.
[0097] In one embodiment, the data processing module is specifically used to: unload the data to be migrated into a first format file; convert the first format file to obtain a temporary file containing the content of the data items to be processed; and process the content of the data items to be processed in the temporary file according to the data item processing rules to obtain the content of the data items.
[0098] In one embodiment, the data corresponding to the data to be migrated in the first format file has a unique identifier, which is the mainstream watermark for data migration. The mainstream watermark for data migration is obtained by encoding the data within the set data migration range.
[0099] In one embodiment, the data processing module is specifically used to: convert a first format file into an executable second format file; and execute the second format file to generate a temporary file containing the contents of the data items to be processed.
[0100] In one embodiment, the first format file is an XML or JSON file, and the second format file is a standard SQL file.
[0101] In one embodiment, a verification module is further included, which is used to: verify the content of the data item according to the verification rules of the data item, and determine that the verification is successful.
[0102] In one embodiment, the data item determination module is specifically used to: determine the data rules, the number of data items, the verification rules, and the processing rules in the data item.
[0103] In one embodiment, the loading module is specifically used to: obtain a second mapping relationship between a predetermined data item and the database table name and database field name in the second system; and load the content of the data item into the corresponding database table in the second system according to the second mapping relationship and the database table name and database field name in the second system.
[0104] Furthermore, the specific implementation details of the data migration device in this embodiment of the invention have been described in detail in the data migration method above, so the details will not be repeated here.
[0105] Figure 4 An exemplary system architecture 400 is shown that can be applied to the data migration method or data migration apparatus of the present invention.
[0106] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, a network 404, and a server 405. Network 404 serves as the medium for providing communication links between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0107] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, and 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0108] Terminal devices 401, 402, and 403 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0109] Server 405 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 401, 402, and 403 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal device.
[0110] It should be noted that the data migration method provided by the embodiments of the present application is generally executed by the server 405, and accordingly, the data migration apparatus is generally arranged in the server 405.
[0111] It should be understood that, Figure 4 The number of terminal devices, networks and servers in the system is merely illustrative. Any number of terminal devices, networks and servers can be provided according to implementation needs.
[0112] Reference is made below to Figure 5 which shows a structural schematic diagram of a computer system 500 suitable for implementing a terminal device or a server of the embodiments of the present application. Figure 5 The terminal device or server shown is merely an example and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0113] As shown in Figure 5 , the computer system 500 includes a central processing unit (CPU) 501 which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or programs loaded from a storage portion 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the system 500 are also stored in the RAM 503. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0114] The following components are connected to the I / O interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable recording medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 510 as needed, so that a computer program read therefrom is installed in the storage portion 508 as needed.
[0115] In particular, the processes described above with reference to the flow charts can be implemented as a computer software program in accordance with the embodiments disclosed herein. For example, embodiments disclosed herein include a computer program product which includes a computer program tangibly embodied on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flow charts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 509 and / or installed from the removable media 511. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the system of the present application are executed.
[0116] It should be noted that the computer readable medium shown in the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as a carrier wave in a propagated data signal, which carries computer readable program code. Such a propagated data signal can take many forms, including but not limited to, an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that can send, propagate or transfer a program for use by or in connection with an instruction execution system, device or apparatus. The program code contained on the computer readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire line, optical cable, RF, or any suitable combination of the above.
[0117] The computer program product of the present application can include a computer readable medium, which can be a storage medium or memory medium including, but not limited to, optical media (e.g., CD-ROM), magnetic media (e.g., floppy disks, magnetic tapes, and hard disk drives), magneto-optical media (e.g., floptical disks), and compact discs (e.g., CD-Read Only Memory, CD-RAM, and CD-RW). The computer program product can also include a propagated signal.
[0118] The modules described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The modules described can be arranged in a processor, for example, can be described as: a processor includes a data item determining module, a data obtaining module, a data processing module, and a loading module. In some cases, the names of the modules do not constitute a limitation on the modules themselves, for example, the data item determining module can also be described as: a module for determining a data item according to a set data migration range.
[0119] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include: determining a data item according to a set data migration range; obtaining corresponding to-be-migrated data from a first system according to the data item; processing the to-be-migrated data into content of the data item according to preset processing logic; and loading the content of the data item to a second system.
[0120] According to the technical solutions of the embodiments of the present application, a data item is determined according to a set data migration range; corresponding to-be-migrated data is obtained from a first system according to the data item; the to-be-migrated data is processed into content of the data item according to preset processing logic; and the content of the data item is loaded to a second system. The workload of the staff can be reduced, the work content can be simplified, the accuracy of data migration can be improved, the migration speed can be improved, and the migration time can be reduced.
[0121] The foregoing detailed description has set forth various embodiments of the devices and / or processes via the use of specific terminology. However, embodiments thereof can be practiced with the exact description not being presented in detail. The term "device" should be understood to encompass devices operating in various modes, such as active mode, sleep mode, hibernate mode, and the like. The terms "coupled" and "connected," along with derivatives thereof, can be used. It should be understood that these terms are not intended as synonyms for each other. Rather, particular circuitry that can be said to be coupled to, or connected with, other circuitry can be some of the other circuitry that can communicate in some way, while other circuitry can be some of the other circuitry that can not be in communication with that particular circuitry.
Claims
1. A data migration method, characterized by, The method comprises the following steps: determining data items according to a set data migration range, comprising: cutting in from a user's perspective, determining the overall range of data migration according to the pages in the user's perspective and the functions needed by the user, thereby obtaining the set data migration range; wherein the pages in the user's perspective comprise query pages and detail display pages, and the functions needed by the user comprise importing, exporting and printing; obtaining corresponding to-be-migrated data from a first system according to the data items, comprising: obtaining a first mapping relationship between the data items and database table names and database field names in the first system in advance, and obtaining corresponding to-be-migrated data from the first system according to the database table names and the database field names in the first system according to the first mapping relationship; unloading the to-be-migrated data into a first format file, converting the first format file to obtain a temporary file comprising to-be-processed data item content, processing the to-be-processed data item content in the temporary file according to a processing rule of the data items to obtain the content of the data items, and the processing rule comprises standard data conversion and special symbol processing; verifying whether the content of the data items conforms to data rules in the data items according to a verification rule of the data items, and determining that the verification is passed, wherein the data rules in the data items comprise single-item data rules and multi-item data rules, the single-item data rules are related to a single data item, and the multi-item data rules are related to two or more data items, the processing rule of the data items is determined by a staff of the first system, and the verification rule is determined by a staff of a second system; loading the content of the data items into the second system, comprising: obtaining a second mapping relationship between the data items and database table names and database field names in the second system in advance, and loading the content of the data items into corresponding database tables in the second system according to the database table names and the database field names in the second system according to the second mapping relationship, wherein the first system is an old system, the second system is a new system, and data migration is migrating data from the old system to the new system.
2. The method of claim 1, wherein, The method comprises the following steps: determining the data items according to the pages and / or functions included in the set data migration range.
3. The method of claim 2, wherein, The method comprises the following steps: splitting the set data migration range into data migration blocks according to the pages and / or functions included in the set data migration range; determining the data items in each data migration block.
4. The method according to claim 1, wherein the data corresponding to the to-be-migrated data in the first format file has a unique identifier, the unique identifier is a data migration master serial number, and the data migration master serial number is obtained by encoding the data in the set data migration range.
5. The method of claim 1, wherein, The method comprises the following steps: converting the first format file into an executable second format file. execute the second format file to generate the temporary file including the content of the data item to be processed.
6. The method of claim 5, wherein, The first format file is an XML format file or a Json format file, and the second format file is a standard SQL file.
7. The method of claim 1, wherein, For each determined data item, the method further includes determining a data rule in the data item, a quantity of the data item, the check rule, and the processing rule.
8. A data migration apparatus, characterized by comprising: Comprise: a data item determination module configured to determine data items according to a set data migration range, including: cutting in from a user perspective, determining the overall range of data migration according to the pages in the user perspective and the functions needed by the user, thereby obtaining the set data migration range; wherein the pages in the user perspective include query pages and detail display pages, and the functions needed by the user include import, export, and printing; a data acquisition module configured to unload the data to be migrated into a first format file, convert the first format file to obtain a temporary file including the content of the data item to be processed, and process the content of the data item to be processed in the temporary file according to a processing rule of the data item to obtain the content of the data item; the processing rule includes standard data conversion and special symbol processing; a data processing module configured to process the data to be migrated into the content of the data item according to a preset processing logic; a loading module configured to load the content of the data item into a second system, including: obtaining a second mapping relationship between the data item and a database table name and a database field name in the second system in advance, and loading the content of the data item into a corresponding database table in the second system according to the second mapping relationship and the database table name and the database field name in the second system; the first system is an old system, the second system is a new system, and data migration is the migration of data from the old system to the new system; The device is further configured to: after processing the content of the data item to be processed in the temporary file according to the processing rule of the data item, check whether the content of the data item conforms to a data rule in the data item according to a check rule of the data item, and determine that the check is passed; the data rule in the data item includes a single-item data rule and a multi-item data rule, wherein the single-item data rule is a data rule related to a single data item, and the multi-item data rule is a data rule related to two or more data items; the processing rule of the data item is determined by a staff of the first system, and the check rule is determined by a staff of the second system.
9. The apparatus of claim 8, wherein, The data item determination module is further configured to: determine the data items according to the pages and / or functions included in the set data migration range.
10. An electronic device, comprising: Comprise: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-7.
11. A computer readable medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the method of any one of claims 1-7. The computer program is executed by the processor to implement the method of any one of claims 1-7.
Citation Information
Patent Citations
A data migration method for upgrading a water company's operating charging system
CN109284293A