Data change method, device, computer equipment and storage medium
By judging and processing the variability and storage methods of data tables to be changed, the cloud platform data is changed between different cloud platforms, solving the problem that data cannot be changed in the existing technology, and improving the efficiency of data resource management.
Patent Information
- Application Number
- CN202110739257.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-06-30
AI Technical Summary
Existing cloud platforms cannot make data changes between different cloud platforms, resulting in inconvenience in IT asset management and financial accounting, and the problem of virtual asset allocation allocation errors cannot be changed.
By obtaining the data change request, we judge whether the data table to be changed is mutable, and according to its data storage method, we use the corresponding data change logic to change the data table to be changed from the original cloud service platform to the target cloud service platform.
It realizes reliable and efficient changes in cloud platform data between different cloud platforms, improves the management efficiency of cloud platform data resources, and avoids virtual asset allocation errors.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud technology, and in particular to a data change method, device, computer equipment and storage medium. Background Art
[0002] A cloud platform refers to a comprehensive management platform that includes virtualized resource pools such as computing, networking, storage, and security. The cloud platform mainly includes cloud hosts, cloud disks, network devices, and cloud databases. Existing cloud platforms are under fixed projects and asset items for specific users after they are purchased by users, that is, from the date of creation, and cannot be changed between different cloud platforms. For example, when changing cloud platform data from a public cloud platform to a private cloud platform, it is impossible to classify it under a specific project or specific user, which brings great inconvenience to IT asset management and financial accounting. Once there is an error in the allocation of virtual assets, there is no way to change it, which is not conducive to the management of data resources on the cloud platform. Summary of the invention
[0003] Embodiments of the present invention provide a data change method, apparatus, computer equipment and storage medium to solve the problem that cloud platform data cannot be changed between different cloud platforms, which is not conducive to the management of data resources of the cloud platform.
[0004] A data change method, comprising:
[0005] Obtaining a data change request, wherein the data change request includes an original platform identifier, a target platform identifier, and an identifier of data to be changed;
[0006] Obtaining, from the original cloud service platform corresponding to the original platform identifier, a data table to be changed corresponding to the data to be changed identifier, and determining whether the data table to be changed is modifiable;
[0007] If the data table to be changed is changeable, obtaining the data storage mode of the data table to be changed;
[0008] The data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier by using the data change logic corresponding to the data storage method.
[0009] Further, the determining whether the data table to be changed is changeable includes:
[0010] Obtaining the foreign key constraint relationship and business logic constraint relationship of the data table to be changed;
[0011] Based on the foreign key constraint relationship and the business logic constraint relationship, it is determined whether the data table to be changed is modifiable.
[0012] Further, the adopting of the data change logic corresponding to the data storage mode to change the to-be-changed data table to the target cloud service platform corresponding to the target platform identifier includes:
[0013] If the data storage method is direct storage, the to-be-changed data table is changed to the data storage area of the target cloud service platform corresponding to the target platform identifier, a first data change notification is generated, and the first data change notification is sent to the target cloud service platform;
[0014] If the data storage method is redis cache storage, the data table to be changed is changed to the data cache area of the target cloud service platform corresponding to the target platform identifier, a second data change notification is generated, and the second data change notification is sent to the cache service corresponding to the data table to be changed.
[0015] Furthermore, the step of changing the to-be-changed data table to the target cloud service platform corresponding to the target platform identifier further includes:
[0016] Use the change data interface to obtain target change data;
[0017] The data change service is used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier based on the target change data.
[0018] Furthermore, before adopting the change data interface to obtain the target change data, the method further includes:
[0019] Based on the cloud service platform standards, obtain the target resource class;
[0020] Based on the target resource class, the change data interface is obtained.
[0021] Further, the step of changing the to-be-changed data table to a target cloud service platform corresponding to the target platform identifier includes:
[0022] Based on the original platform identifier, obtaining an ID to be changed and a data table to be changed associated with the ID to be changed;
[0023] Determine a data change script according to the original platform identifier, the target platform identifier and the identifier of the data to be changed;
[0024] The data change script is executed to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0025] Further, after the data table to be changed is changed based on the data change logic corresponding to the data storage mode, the method includes:
[0026] Get the target change data table;
[0027] Detect whether the target change data table is abnormal, and obtain and display the abnormality detection result.
[0028] A data changing device, comprising:
[0029] A request acquisition module, used to acquire a data change request, wherein the data change request includes an original platform identifier, a target platform identifier, and an identifier of data to be changed;
[0030] A data acquisition module, used to acquire the to-be-changed data table corresponding to the to-be-changed data identifier from the original cloud service platform corresponding to the original platform identifier, and determine whether the to-be-changed data table is modifiable;
[0031] A storage mode module, used for obtaining the data storage mode of the data table to be changed if the data table to be changed is changeable;
[0032] The data change module is used to adopt the data change logic corresponding to the data storage method to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0033] Furthermore, the data acquisition module includes:
[0034] A relationship acquisition submodule, used to acquire the foreign key constraint relationship and the business logic constraint relationship of the data table to be changed;
[0035] The data judgment submodule is used to judge whether the data table to be changed is modifiable based on the foreign key constraint relationship and the business logic constraint relationship.
[0036] Furthermore, the data change module includes:
[0037] A first notification submodule is used for changing the data table to be changed to the data storage area of the target cloud service platform corresponding to the target platform identifier if the data storage mode is direct storage, generating a first data change notification, and sending the first data change notification to the target cloud service platform;
[0038] The second notification submodule is used to change the data table to be changed to the data cache area of the target cloud service platform corresponding to the target platform identifier if the data storage method is redis cache storage, generate a second data change notification, and send the second data change notification to the cache service corresponding to the data table to be changed.
[0039] Furthermore, the data change module also includes:
[0040] The data interface submodule is used to obtain target change data using the change data interface;
[0041] The change service submodule is used to adopt the data change service to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier based on the target change data.
[0042] Furthermore, the data changing device further comprises:
[0043] Resource class acquisition module, used to obtain target resource class based on cloud service platform standards;
[0044] The interface acquisition module is used to acquire the change data interface based on the target resource class.
[0045] Furthermore, the data change module also includes:
[0046] A data table acquisition submodule, used for acquiring an ID to be changed and a data table to be changed associated with the ID to be changed based on the original platform identifier;
[0047] A change script submodule, used to determine a data change script according to the original platform identifier, the target platform identifier and the identifier of the data to be changed;
[0048] The script execution submodule is used to execute the data change script to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0049] Furthermore, the data changing device further comprises:
[0050] Target data table module, used to obtain target change data table;
[0051] The anomaly detection module is used to detect whether the target change data table is abnormal, and obtain and display the anomaly detection result.
[0052] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data changing method when executing the computer program.
[0053] A computer-readable storage medium stores a computer program, and the computer program implements the above-mentioned data changing method when executed by a processor.
[0054] The above-mentioned data change method, device, computer equipment and storage medium first obtain a data change request, and according to the original platform identifier in the data change request, obtain the data table to be changed corresponding to the data identifier to be changed from the original cloud service platform corresponding to the original platform identifier, and judge whether the data table to be changed is changeable, so as to avoid changing the user's non-changeable data table, so as to ensure the reliability of the data table to be changed during the change process; then, when the data table to be changed is changeable, the data storage method of the data table to be changed is obtained, and the data change logic corresponding to the data storage method is adopted to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier, so that the data table to be changed is reliably and efficiently changed to the target cloud service platform corresponding to the target platform identifier. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0056] Figure 1 is a flow chart of a data changing method in one embodiment of the present invention;
[0057] Figure 2 is another flow chart of a data changing method in one embodiment of the present invention;
[0058] Figure 3 is another flow chart of a data changing method in one embodiment of the present invention;
[0059] Figure 4 is another flow chart of a data changing method in one embodiment of the present invention;
[0060] Figure 5 is another flow chart of a data changing method in one embodiment of the present invention;
[0061] Figure 6 is another flow chart of a data changing method in one embodiment of the present invention;
[0062] Figure 7 is another flow chart of a data changing method in one embodiment of the present invention;
[0063] Figure 8 is a schematic diagram of a data changing device in one embodiment of the present invention;
[0064] Fig. 9 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0066] Figure 1 The flowchart of the data change method in this embodiment is shown. The data change method is applied in the cloud service platform to change the cloud platform data stored in the cloud service platform, to solve the problem that the cloud platform data cannot be changed between different cloud service platforms, which is not conducive to the management of the data resources of the cloud service platform, and to improve the management efficiency of the cloud service platform data. Figure 1 As shown, the data changing method includes steps S11 to S14, which are described in detail as follows:
[0067] S11: Obtain a data change request, where the data change request includes an original platform identifier, a target platform identifier, and an identifier of the data to be changed.
[0068] Among them, the data change request is a request to change the data to be changed. The data to be changed is the data stored in the cloud service platform. Optionally, the cloud service platform can be OpenStack, cloudstack and VMware, etc. The data to be changed is the cloud platform data to be changed on the cloud service platform. For example, the data to be changed is the cloud platform data corresponding to the virtual resources on the cloud service platform. The data to be changed can be, for example, a data table to be changed. Optionally, the virtual resources can be virtual hosts, cloud disks, network devices and cloud databases, etc. It can be understood that the data to be changed is the data corresponding to the virtual resources under the user's project on different cloud service platforms.
[0069] In a specific embodiment, changing the data to be changed may be changing the data corresponding to virtual resources between different cloud service platforms. Exemplarily, migrating the data corresponding to virtual resources on heterogeneous cloud platforms, for example, migrating the data corresponding to virtual resources from a public cloud to a private cloud.
[0070] Among them, the original platform identifier is the identifier corresponding to the cloud service platform where the data to be changed is located. Exemplarily, the original platform identifier can be the original cloud service platform ID of the cloud service platform where the data to be changed is located. The target platform identifier is the identifier corresponding to the cloud service platform where the data to be changed is located after the change. Exemplarily, the target platform identifier can be the target cloud service platform ID of the cloud service platform where the data to be changed is located after the change. The data to be changed identifier is the identifier corresponding to the data to be changed. Optionally, the data to be changed identifier includes a user ID and a virtual resource ID corresponding to the user ID. Exemplarily, the user ID is used to determine the user corresponding to the data to be changed, and the virtual resource ID is used to determine the virtual resource that needs to be changed corresponding to the user. The virtual resource ID can be the ID of the data table to be changed.
[0071] In this example, by obtaining a data change request, the original cloud service platform where the data to be changed is located can be determined based on the original platform identifier. Then, the data to be changed is determined based on the data to be changed identifier. Finally, the target cloud service platform where the data to be changed is located after the change is determined based on the target platform identifier, so that the data to be changed can be changed to the cloud service platform corresponding to the target platform identifier in subsequent steps.
[0072] S12: Obtaining a to-be-changed data table corresponding to the to-be-changed data identifier from the original cloud service platform corresponding to the original platform identifier, and determining whether the to-be-changed data table is modifiable.
[0073] The original cloud service platform is the cloud service platform corresponding to the original platform identifier.
[0074] Specifically, after step S11, that is, after obtaining the data change request, the original cloud service platform is determined according to the original platform identifier in the data change request, and according to the data identifier to be changed, the data table to be changed corresponding to the data identifier to be changed is obtained from the original cloud service platform, and by judging whether the data table to be changed is changeable, the reliability of the data table to be changed during the change process is ensured. For example, it is avoided to change the user's unchangeable data table. Optionally, the unchangeable data table can be an immutable field or a cascaded data table in a data table. Exemplarily, the immutable fields of the user's billing service-related tables in the cloud service platform or the data tables cascaded with the billing service-related tables cannot be directly changed to avoid billing errors, so as to ensure the reliability of the data table to be changed during the change process.
[0075] In a specific embodiment, by judging whether there is a specific association relationship between the data table to be changed and other data tables in the original cloud service platform, if the data table to be changed has a specific association relationship with other data tables in the original cloud service platform, the data table to be changed is not modifiable. If the data table to be changed does not have a specific association relationship with other data tables in the original cloud service platform, the data table to be changed is modifiable, and the data table to be changed can be changed. Optionally, the specific association relationship can be a foreign key association relationship and a business logic association relationship between the data table to be changed and other data tables in the original cloud service platform.
[0076] In this example, the data table to be changed corresponding to the data identifier to be changed is obtained from the original cloud service platform corresponding to the original platform identifier, and it is determined whether the data table to be changed is changeable to avoid changing the user's unchangeable data table, so as to ensure the reliability of the data table to be changed during the change process.
[0077] S13: If the data table to be changed is changeable, the data storage mode of the data table to be changed is obtained.
[0078] The data storage method is the storage method of the data table to be changed in the original cloud service platform.
[0079] Specifically, when it is determined that the data table to be changed is changeable, the data storage mode of the data table to be changed is obtained. It should be noted that since the data table to be changed has different data storage modes, different data storage modes need to be processed in different ways to avoid errors in the process of changing the data table to be changed, and improve the accuracy and reliability of the process of changing the data table to be changed.
[0080] Optionally, the data storage method may be that the data table to be changed is directly stored in a database corresponding to the original cloud service platform, or the data table to be changed is stored in a cache service of the original cloud service platform.
[0081] In this embodiment, if the data table to be changed is changeable, the data storage method of the data table to be changed is obtained, so that in subsequent steps, different data storage methods can be used to change the data to be changed in different data storage methods, thereby achieving the purpose of improving the accuracy and reliability of the data table to be changed during the change process.
[0082] S14: Using the data change logic corresponding to the data storage method, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier.
[0083] The data change logic is a processing logic for changing the data table to be changed. The data change logic can change the data table to be changed according to the data storage mode of the data table to be changed.
[0084] Specifically, for different data storage methods, the data change logic corresponding to the data storage method needs to be adopted to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier, so as to avoid errors in the process of changing the data table to be changed.
[0085] In this example, for different data storage methods, the data table to be changed is changed using the data change logic corresponding to the data storage method, so that the data table to be changed can be changed reliably and efficiently to the target cloud service platform corresponding to the target platform identifier. In other words, the data change logic can change the data table to be changed in different data storage methods to the target cloud service platform corresponding to the target platform identifier, which can avoid errors in the process of changing the data table to be changed and improve the accuracy and reliability of the change process of the data table to be changed.
[0086] In this embodiment, first, a data change request is obtained, and according to the original platform identifier in the data change request, the data table to be changed corresponding to the data identifier to be changed is obtained from the original cloud service platform corresponding to the original platform identifier, and it is determined whether the data table to be changed is changeable, so as to avoid changing the user-unchangeable data table, so as to ensure the reliability of the data table to be changed during the change process; then, when the data table to be changed is changeable, the data storage method of the data table to be changed is obtained, and the data change logic corresponding to the data storage method is adopted to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier, so that the data table to be changed is reliably and efficiently changed to the target cloud service platform corresponding to the target platform identifier.
[0087] In one embodiment, if Figure 2 As shown, in step S12, judging whether the data table to be changed is changeable includes:
[0088] S21: Obtain the foreign key constraint relationship and business logic constraint relationship of the data table to be changed.
[0089] S22: Based on the foreign key constraint relationship and the business logic constraint relationship, determine whether the data table to be changed is modifiable.
[0090] Among them, the foreign key constraint relationship is the foreign key relationship between the data table to be changed and other data tables in the original cloud service platform. The business logic constraint relationship is the business logic relationship between the data table to be changed and other data tables in the original cloud service platform.
[0091] Specifically, by obtaining the foreign key constraint relationship and the business logic constraint relationship of the data table to be changed, it is possible to determine whether the data table to be changed is modifiable based on the foreign key constraint relationship and the business logic constraint relationship.
[0092] As an example, if the derived data entity in transaction A is data table a to be changed, and the derived data entity in transaction B is data table b, data table b is derived from data table a to be changed, and data table a to be changed is decisive for the existence and attributes of data table b, so data table a to be changed can be changed, that is, data table a to be changed is modifiable.
[0093] As another example, if the data table a to be changed is a foreign key constraint of the data table c, the data table a to be changed cannot be changed directly, that is, the data table a to be changed is not modifiable.
[0094] In this embodiment, the foreign key constraint relationship and the business logic constraint relationship of the data table to be changed can be obtained first; then, based on the foreign key constraint relationship and the business logic constraint relationship, it can be determined whether the data table to be changed is modifiable, and the data table to be changed can be changed according to whether the data table to be changed is modifiable, so as to avoid changing the data table that cannot be changed by the user, so as to ensure the reliability of the data table to be changed during the change process.
[0095] In one embodiment, if Figure 3 As shown, in step S14, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier by using the data change logic corresponding to the data storage method, including:
[0096] S31: If the data storage method is direct storage, the data table to be changed is changed to the data storage area of the target cloud service platform corresponding to the target platform identifier, a first data change notification is generated, and the first data change notification is sent to the target cloud service platform.
[0097] S32: If the data storage method is redis cache storage, the data table to be changed is changed to the data cache area of the target cloud service platform corresponding to the target platform identifier, a second data change notification is generated, and the second data change notification is sent to the cache service corresponding to the data table to be changed.
[0098] Among them, the data storage area is the area where the data table is directly stored. The data cache area is the area where the data table is cached. The first data change notification is a notification formed after the data table to be changed is changed in which the data storage method is direct storage. The second data change notification is a notification formed after the data table to be changed is changed in which the data storage method is redis (Remote Dictionary Server, remote dictionary service, referred to as redis) cache storage. The cache service is a service on the original cloud service platform, which is used to cache the data table to be changed.
[0099] In a specific embodiment, the data storage method may be direct storage. For example, direct storage may be storing the data table to be changed directly in the data cache area of the original cloud service platform. If the data storage method is direct storage, the data table to be changed stored in the database of the original cloud service platform is directly modified. At the same time, in order to avoid errors in the data management system of the target cloud service platform after the data table to be changed is changed, a first data change notification needs to be sent to the target cloud service platform to instruct the target cloud service platform to refresh the old data table.
[0100] In a specific embodiment, the data storage method may be redis cache storage. Exemplarily, redis cache storage may be a redis service that caches the data table to be changed in the data cache area of the original cloud service platform. If the data storage method is redis cache storage, the data table to be changed stored in the redis service of the original cloud service platform is modified. At the same time, in order to avoid errors in the data management system of the target cloud service platform after the data table to be changed is changed, a second data change notification needs to be sent to the cache service of the target cloud service platform to instruct the cache service of the target cloud service platform to refresh the old data table.
[0101] It should be noted that the corresponding data table of the target cloud service platform with specific functions needs to be initialized. For example, for a target cloud service platform with a billing function, the billing items of the target cloud service platform with a billing function need to be initialized to avoid billing errors.
[0102] In this embodiment, if the data storage method is direct storage, the data table to be changed is changed to the data storage area of the target cloud service platform corresponding to the target platform identifier, a first data change notification is generated, and the first data change notification is sent to the target cloud service platform; if the data storage method is direct storage, the data table to be changed is changed to the data cache area of the target cloud service platform corresponding to the target platform identifier, a first data change notification is generated, and the first data change notification is sent to the target cloud service platform to improve the security and reliability of the data table to be changed during the change process.
[0103] In one embodiment, if Figure 4 As shown, in step S14, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier, and further includes:
[0104] S41: Use the change data interface to obtain target change data.
[0105] S42: Using the data change service, based on the target change data, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier.
[0106] The data change interface is an interface for obtaining target change data. The target change data is data for changing the data table to be changed. The data change service is a service for changing the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0107] In a specific embodiment, the data change interface may be a wsgi interface in the target cloud service platform. For example, if the target cloud service platform is an OpenStack platform, the wsgi interface of the OpenStack platform can obtain the target change data entered by the user for modification operation at the transmission front end. As another example, the data change service may be a data change API (Application Programming Interface, API for short). For example, the data change API service update_source_id is implemented inside the OpenStack platform. The API service update_source_id exists inside the nova service used to implement computing power in the OpenStack platform. The API service update_source_id changes the data table to be changed to the target cloud service platform corresponding to the target platform identifier through the interface of the database service conduct in the OpenStack platform, thereby realizing the change of the data table to be changed. It should be noted that the data change service is used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier. The change method of the data table to be changed is an invasive change method with high reliability.
[0108] In this embodiment, a data change interface can be used to obtain target change data, and then a data change service can be used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier based on the target change data.
[0109] In one embodiment, if Figure 5 As shown, before step S41, that is, before adopting the change data interface to obtain the target change data, it includes:
[0110] S51: Based on the cloud service platform standard, obtain the target resource class.
[0111] S52: Based on the target resource class, obtain a change data interface.
[0112] The cloud service platform standard is a standard for obtaining the target resource class. The target resource class standard is a class for obtaining the change data interface.
[0113] In a specific embodiment, the original cloud service platform may be an OpenStack platform, and the cloud service platform standard may be a novaclient console specification standard in the OpenStack platform. The target resource class may be a base.Resource class. The base.Resource class is inherited through the novaclient console specification standard in the OpenStack platform, so that a change data interface can be obtained according to the base.Resource class.
[0114] In this embodiment, the target resource class is obtained based on the cloud service platform standard, and based on the target resource class, the purpose of obtaining the change data interface is achieved.
[0115] In one embodiment, if Figure 6 As shown, in step S14, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier, including:
[0116] S61: Based on the original platform identifier, obtain the ID to be changed and the data table to be changed associated with the ID to be changed.
[0117] S62: Determine a data change script according to the original platform identifier, the target platform identifier and the identifier of the data to be changed.
[0118] S63: Execute the data change script to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0119] The ID to be changed is the ID of the user to be changed. The ID to be changed can be, for example, a tenant ID on the cloud service platform, which is used to change the tenant on the cloud service platform. The data change script is a user-defined script used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0120] As an example, based on the original platform identifier, obtain the ID to be changed and the data table to be changed associated with the ID to be changed. For example, through the original platform identifier, obtain the ID to be changed and the data table to be changed associated with the ID to be changed from the original cloud service platform corresponding to the original platform identifier.
[0121] As another example, when the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier through a data change script, the original cloud service platform, the data table to be changed associated with the ID to be changed, and the target cloud service platform can be determined based on the original platform identifier, the target platform identifier, and the data identifier to be changed. Then, the data change script is determined based on the change relationship between the original cloud service platform, the data table to be changed associated with the ID to be changed, and the target cloud service platform.
[0122] As another example, a data change script is executed to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier. Exemplarily, the data change script may be a script formed by SQL statements, and the script formed by SQL statements changes the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0123] It should be noted that the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier by using a data change script, and the change method of the data table to be changed is a non-invasive change method.
[0124] In this embodiment, based on the original platform identifier, the ID to be changed and the data table to be changed associated with the ID to be changed are obtained; according to the original platform identifier, the target platform identifier and the data identifier to be changed, the data change script is determined; the data change script is executed to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier. The change method of the data table to be changed is a non-invasive change method with high security.
[0125] In one embodiment, if Figure 7 As shown, after step S14, after the data table to be changed is changed based on the data change logic corresponding to the data storage method, the following steps are included:
[0126] S71: Obtain a target change data table.
[0127] S72: Detect whether the target change data table is abnormal, and obtain and display the abnormality detection result.
[0128] The target change data table is a data table obtained after the data table to be changed is changed, and the abnormal test result is a result obtained from the target change data table.
[0129] In a specific embodiment, after obtaining the target change data table, it is detected whether the target change data table is abnormal, and the abnormality detection result is obtained and displayed. Optionally, detecting whether the target change data table is abnormal may include detecting whether the change content in the target change data table matches the target change data, and determining the accuracy of the target change data table. If the change content in the target change data table matches the target change data, the abnormality detection result is no abnormality; if the change content in the target change data table does not match the target change data, the abnormality detection result is that an abnormality exists. Or detect whether all other services or applications in the target cloud service platform are running normally. If all other services or applications in the target cloud service platform are running normally, the abnormality detection result is no abnormality; if all other services or applications in the target cloud service platform are not running normally, the abnormality detection result is that an abnormality exists.
[0130] In this embodiment, a target change data table is obtained; whether the target change data table is abnormal is detected, and the abnormality detection result is obtained and displayed, so that the user can promptly discover the abnormality in the change process of the data table to be changed, and further improve the reliability of the change process of the data table to be changed.
[0131] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean 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 embodiment of the present invention.
[0132] In one embodiment, a data changing device is provided, and the data changing device corresponds one-to-one with the data changing method in the above embodiment. Figure 8 As shown, the data changing device includes a request acquisition module 10, a data acquisition module 20, a storage mode module 30 and a data changing module 40. The functional modules are described in detail as follows:
[0133] The request acquisition module 10 is used to acquire a data change request, wherein the data change request includes an original platform identifier, a target platform identifier, and an identifier of the data to be changed;
[0134] The data acquisition module 20 is used to acquire the to-be-changed data table corresponding to the to-be-changed data identifier from the original cloud service platform corresponding to the original platform identifier, and determine whether the to-be-changed data table is modifiable;
[0135] The storage mode module 30 is used to obtain the data storage mode of the data table to be changed if the data table to be changed is changeable;
[0136] The data change module 40 is used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier by adopting the data change logic corresponding to the data storage method.
[0137] Furthermore, the data acquisition module 20 includes:
[0138] The relationship acquisition submodule is used to obtain the foreign key constraint relationship and business logic constraint relationship of the data table to be changed;
[0139] The data judgment submodule is used to judge whether the data table to be changed is modifiable based on the foreign key constraint relationship and the business logic constraint relationship.
[0140] Furthermore, the data changing module 40 includes:
[0141] A first notification submodule is used to change the data table to be changed to the data storage area of the target cloud service platform corresponding to the target platform identifier if the data storage mode is direct storage, generate a first data change notification, and send the first data change notification to the target cloud service platform;
[0142] The second notification submodule is used to change the data table to be changed to the data cache area of the target cloud service platform corresponding to the target platform identifier if the data storage method is redis cache storage, generate a second data change notification, and send the second data change notification to the cache service corresponding to the data table to be changed.
[0143] Furthermore, the data changing module 40 also includes:
[0144] The data interface submodule is used to obtain target change data using the change data interface;
[0145] The change service submodule is used to adopt the data change service to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier based on the target change data.
[0146] Furthermore, the data changing device also includes:
[0147] Resource class acquisition module, used to obtain target resource class based on cloud service platform standards;
[0148] The interface acquisition module is used to obtain the change data interface based on the target resource class.
[0149] Furthermore, the data changing module 40 also includes:
[0150] The data table acquisition submodule is used to acquire the ID to be changed and the data table to be changed associated with the ID to be changed based on the original platform identifier;
[0151] The change script submodule is used to determine the data change script according to the original platform identifier, the target platform identifier and the identifier of the data to be changed;
[0152] The script execution submodule is used to execute the data change script to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
[0153] Furthermore, the data changing device also includes:
[0154] Target data table module, used to obtain target change data table;
[0155] The anomaly detection module is used to detect whether the target change data table is abnormal, obtain and display the anomaly detection results.
[0156] For the specific definition of the data changing device, please refer to the definition of the data changing method above, which will not be repeated here. Each module in the above data changing device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0157] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for data change. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data change method is implemented.
[0158] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the data changing method in the above embodiment is implemented, such as steps S11 to S14. To avoid repetition, they are not described here. Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the data changing device are implemented, such as modules 10 to modules 40. To avoid repetition, they are not described here.
[0159] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the data changing method in the above embodiment is implemented, such as steps S11 to S14, which are not described here to avoid repetition. Alternatively, when the computer program is executed by a processor, the functions of each module / unit in the above data changing device in this embodiment are implemented, such as modules 10 to 40, which are not described here to avoid repetition.
[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0161] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0162] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A data modification method, characterized in that: include: Obtaining a data change request, wherein the data change request includes an original platform identifier, a target platform identifier, and an identifier of data to be changed; Obtaining, from the original cloud service platform corresponding to the original platform identifier, a to-be-changed data table corresponding to the to-be-changed data identifier; Obtaining the foreign key constraint relationship and business logic constraint relationship of the data table to be changed; Based on the foreign key constraint relationship and the business logic constraint relationship, determining whether the data table to be changed is changeable; If the data table to be changed is changeable, obtaining the data storage mode of the data table to be changed; The data storage method is a storage method of the data table to be changed in the original cloud service platform, including directly storing the data table to be changed in a database corresponding to the original cloud service platform, or storing the data table to be changed in a cache service of the original cloud service platform; Using the data change logic corresponding to the data storage method, the data table to be changed is changed to the target cloud service platform corresponding to the target platform identifier; The adopting of the data change logic corresponding to the data storage method to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier includes: If the data storage method is direct storage, the to-be-changed data table is changed to the data storage area of the target cloud service platform corresponding to the target platform identifier, a first data change notification is generated, and the first data change notification is sent to the target cloud service platform; If the data storage method is redis cache storage, the data table to be changed is changed to the data cache area of the target cloud service platform corresponding to the target platform identifier, a second data change notification is generated, and the second data change notification is sent to the cache service corresponding to the data table to be changed.
2. The data changing method according to claim 1, characterized in that: The step of changing the to-be-changed data table to the target cloud service platform corresponding to the target platform identifier further includes: Use the change data interface to obtain target change data; The data change service is used to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier based on the target change data.
3. The data changing method according to claim 2, characterized in that: Before adopting the change data interface to obtain the target change data, the following steps are included: Based on the cloud service platform standards, obtain the target resource class; Based on the target resource class, the change data interface is obtained.
4. The data changing method according to claim 1, characterized in that: The step of changing the to-be-changed data table to a target cloud service platform corresponding to the target platform identifier includes: Based on the original platform identifier, obtaining an ID to be changed and a data table to be changed associated with the ID to be changed; Determine a data change script according to the original platform identifier, the target platform identifier and the identifier of the data to be changed; The data change script is executed to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier.
5. The data changing method according to claim 1, characterized in that: After the data table to be changed is changed based on the data change logic corresponding to the data storage mode, the method includes: Get the target change data table; Detect whether the target change data table is abnormal, and obtain and display the abnormality detection result.
6. A data changing device, characterized in that: include: A request acquisition module, used to acquire a data change request, wherein the data change request includes an original platform identifier, a target platform identifier, and an identifier of data to be changed; A data acquisition module, used for acquiring the to-be-changed data table corresponding to the to-be-changed data identifier from the original cloud service platform corresponding to the original platform identifier; Obtaining the foreign key constraint relationship and business logic constraint relationship of the data table to be changed; Based on the foreign key constraint relationship and the business logic constraint relationship, determining whether the data table to be changed is changeable; A storage mode module, used for obtaining the data storage mode of the data table to be changed if the data table to be changed is changeable; The data storage method is a storage method of the data table to be changed in the original cloud service platform, including directly storing the data table to be changed in a database corresponding to the original cloud service platform, or storing the data table to be changed in a cache service of the original cloud service platform; A data change module, configured to adopt the data change logic corresponding to the data storage method to change the data table to be changed to the target cloud service platform corresponding to the target platform identifier; The data change module is further configured to, if the data storage method is direct storage, change the data table to be changed to the data storage area of the target cloud service platform corresponding to the target platform identifier, generate a first data change notification, and send the first data change notification to the target cloud service platform; If the data storage method is redis cache storage, the data table to be changed is changed to the data cache area of the target cloud service platform corresponding to the target platform identifier, a second data change notification is generated, and the second data change notification is sent to the cache service corresponding to the data table to be changed.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the data changing method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data changing method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and device for SQL code conversion
CN107103007A
Data migration method and device, computer equipment and storage medium
CN110297813A