Data splicing function migration method, device, computer equipment and storage medium

By analyzing data splicing requests and adjusting data splicing code, the compatibility problem of data splicing function when migrating from the original database to the updated database is solved, and high-accurate data migration is achieved.

CN114416695BActive Publication Date: 2025-05-27CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210061955.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-19
Publication Date
2025-05-27
Estimated Expiration
2042-01-19

AI Technical Summary

Technical Problem

When migrating from the original database (such as ignite database) to an updated database (such as pg database), the migration of the data splicing function needs to be compatible with the two databases, resulting in a lot of code changes, a large amount of workload and easy to miss compatible information, and the accuracy of the data splicing function cannot be guaranteed.

Method used

By analyzing the data splicing request, obtain the data to be spliced, and determine the original logic and target logic items according to the data type. Then, traverse the preset data layer to obtain the original and target data logical values, call the preset switch to adjust the initial data splicing code, generate the target data splicing code, and finally call the code for data splicing.

Benefits of technology

This method reduces the workload of data stitching function migration, improves the accuracy of migration, avoids omissions caused by one-time migration, and does not affect business use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416695B_ABST
    Figure CN114416695B_ABST
Patent Text Reader

Abstract

This application relates to artificial intelligence technology, and provides a method, apparatus, computer device, and storage medium for migrating data splicing functions, including: parsing a data splicing request to obtain first data and second data to be spliced; obtaining a first data type of the first data and a second data type of the second data, and respectively determining an original logical item and a target logical item according to the first data type and the second data type; traversing a first preset data layer according to the original logical item to obtain an original data logical value, and traversing a second preset data layer according to the target logical item to obtain a target data logical value; obtaining an initial data splicing code; adjusting the initial data splicing code according to the original data logical value and the target data logical value to obtain a target data splicing code; and calling the target data splicing code to splice and process the first data and the second data to obtain a data splicing result. This application can improve the accuracy of migrating data splicing functions and promote the rapid development of smart cities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and particularly to a method, apparatus, computer device, and storage medium for migrating a data splicing function. Background Art

[0002] With the rapid development and popularization of the mobile Internet and intelligent devices, the pressure on database processing of Internet applications is increasing. At the same time, users' requirements for request response time are becoming more and more stringent, and the requirements for the database to provide stable services are also more improved. Against the background that the performance improvement of the database has reached a certain bottleneck, using a newer database has become one of the main means to improve stability and database response speed.

[0003] In the process of implementing this application, the applicant found that the following technical problems exist in the prior art: For the case where the original database has a data splicing function, when using a newer database, it is necessary to migrate the data splicing function. For example, the data splicing function was previously implemented in the ignite database and now needs to be migrated to the pg database. If the data splicing function is directly migrated at once, to be compatible with the two databases, too much code needs to be modified, the workload is large, and relevant compatibility information is easily omitted, which cannot guarantee the accuracy of the data splicing function migration.

[0004] Therefore, it is necessary to provide a method for migrating a data splicing function that can improve the accuracy of the data splicing function migration. Summary of the Invention

[0005] In view of the above, it is necessary to propose a method for migrating a data splicing function, a device for migrating a data splicing function, a computer device, and a storage medium that can improve the accuracy of the data splicing function migration.

[0006] The first aspect of the embodiments of this application further provides a method for migrating a data splicing function. The method for migrating a data splicing function includes:

[0007] When receiving a data splicing request, parse the data splicing request to obtain first data and second data to be spliced;

[0008] Obtain a first data type corresponding to the first data and a second data type corresponding to the second data, and respectively determine an original logical item and a target logical item according to the first data type and the second data type;

[0009] Traverse a first preset data layer according to the original logical item to obtain an original data logical value corresponding to the original logical item, and traverse a second preset data layer according to the target logical item to obtain a target data logical value corresponding to the target logical item;

[0010] Obtain the initial data splicing code in the original database;

[0011] Call a preset switch to adjust the initial data splicing code according to the original data logic value and the target data logic value, and obtain the target data splicing code;

[0012] Call the target data splicing code to splice and process the first data and the second data, and obtain a data splicing result.

[0013] Further, in the above data splicing function migration method provided by the embodiments of the present application, the parsing the data splicing request to obtain the first data and the second data to be spliced includes:

[0014] Parse the data splicing request and detect whether a data identifier is carried in the data splicing request;

[0015] When the detection result is that the data splicing request carries the data identifier, extract the first data identifier and the second data identifier;

[0016] Traverse the pre-set mapping relationship between the data identifier and the data according to the first data identifier and the second data identifier, and obtain the first data and the second data to be spliced.

[0017] Further, in the above data splicing function migration method provided by the embodiments of the present application, the respectively determining the original logic item and the target logic item according to the first data type and the second data type includes:

[0018] Traverse the pre-set mapping relationship between the data type and the logic item according to the first data type, and obtain the first original logic item and the first target logic item corresponding to the first data type;

[0019] Traverse the pre-set mapping relationship between the data type and the logic item according to the second data type, and obtain the second original logic item and the second target logic item corresponding to the second data type.

[0020] Further, in the above data splicing function migration method provided by the embodiments of the present application, the traversing the first preset data layer according to the original logic item to obtain the original data logic value corresponding to the original logic item includes:

[0021] Obtain the first code configuration information in the first preset data layer;

[0022] Detect whether the original logic item exists in the first code configuration information;

[0023] When the detection result indicates that the original logical item exists in the first code configuration information, determine the first target position of the original logical item in the first code configuration information, and extract the configuration content at the first target position as the original data logical value.

[0024] Further, in the above data splicing function migration method provided by the embodiments of the present application, the obtaining the initial data splicing code in the original database includes:

[0025] Obtain the first preset layer corresponding to the original database, and extract the first code configuration information in the first preset layer;

[0026] Detect whether a data splicing identifier exists in the first code configuration information;

[0027] When the detection result indicates that the data splicing identifier exists in the first code configuration information, obtain the code corresponding to the data splicing identifier as the initial data splicing code.

[0028] Further, in the above data splicing function migration method provided by the embodiments of the present application, the calling the preset switch to adjust the initial data splicing code according to the original data logical value and the target data logical value to obtain the target data splicing code includes:

[0029] Obtain the initial data splicing code;

[0030] Call the preset switch to determine the original data logical value in the initial data splicing code;

[0031] Replace the original data logical value with the target data logical value to obtain the target data splicing code.

[0032] Further, in the above data splicing function migration method provided by the embodiments of the present application, the calling the target data splicing code to splice and process the first data and the second data to obtain the data splicing result includes:

[0033] Parse the data splicing request to obtain the data splicing requirements;

[0034] Call the target data splicing code to splice and process the first data and the second data according to the data splicing requirements to obtain the data splicing result.

[0035] The second aspect of the embodiments of the present application further provides a data splicing function migration device, and the data splicing function migration device includes:

[0036] A request parsing module, configured to parse the data splicing request to obtain the first data and the second data to be spliced when receiving the data splicing request;

[0037] A type acquisition module, configured to acquire a first data type corresponding to the first data and a second data type corresponding to the second data, and respectively determine an original logic item and a target logic item according to the first data type and the second data type;

[0038] A logic traversal module, configured to traverse a first preset data layer according to the original logic item to obtain an original data logic value corresponding to the original logic item, and traverse a second preset data layer according to the target logic item to obtain a target data logic value corresponding to the target logic item;

[0039] A code acquisition module, configured to acquire an initial data splicing code in an original database;

[0040] A code adjustment module, configured to call a preset switch to adjust the initial data splicing code according to the original data logic value and the target data logic value to obtain a target data splicing code;

[0041] A code splicing module, configured to call the target data splicing code to splice and process the first data and the second data to obtain a data splicing result.

[0042] In a third aspect of the embodiments of the present application, a computer device is further provided. The computer device includes a processor, and the processor is configured to implement the data splicing function migration method as described in any one of the above when executing a computer program stored in a memory.

[0043] In a fourth aspect of the embodiments of the present application, a computer-readable storage medium is further provided. A computer program is stored on the computer-readable storage medium, and the computer program implements the data splicing function migration method as described in any one of the above when executed by a processor.

[0044] The above data splicing function migration method, data splicing function migration device, computer device, and computer-readable storage medium provided by the embodiments of the present application configure a preset switch and call the preset switch to implement step-by-step iterative migration of data splicing code during the data splicing process, avoiding the problems of large workload and easy omission caused by one-time migration, reducing the workload, not affecting business use, and improving the accuracy of data splicing function migration; and the present application configures two preset data layers to store the code configuration information of the original database and the target database respectively, and works in cooperation with the preset switch to traverse the first preset data layer when the preset switch needs to select the original data logical value and traverse the second preset data layer when it needs to select the target data logical value, which can improve the accuracy of obtaining the data logical value, thereby improving the accuracy of data splicing function migration. The present application can be applied to various functional modules of smart cities such as smart government affairs and smart transportation, such as the data splicing function migration module of smart government affairs, and can promote the rapid development of smart cities. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 is a flowchart of the data splicing function migration method provided by Embodiment 1 of the present application.

[0046] Figure 2 is a structural diagram of the data splicing function migration device provided by Embodiment 2 of the present application.

[0047] Figure 3 is a schematic structural diagram of the computer device provided by Embodiment 3 of the present application.

[0048] The following specific embodiments will further illustrate the present application in conjunction with the above drawings. DETAILED DESCRIPTION

[0049] In order to more clearly understand the above objects, features, and advantages of the present application, the present application will be described in detail below with reference to the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.

[0050] Many specific details are set forth in the following description in order to provide a thorough understanding of the present application. The described embodiments are some, but not all, of the embodiments of the present application.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used in the description of this application herein are for the purpose of describing specific embodiments only and are not intended to limit this application.

[0052] Embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.

[0053] Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, robotics, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0054] The data splicing function migration method provided by embodiments of the present invention is executed by a computer device. Correspondingly, the data splicing function migration device runs in the computer device. Figure 1 It is a flowchart of the data splicing function migration method provided by Embodiment 1 of the present application. As Figure 1 shown, the data splicing function migration method may include the following steps. According to different requirements, the order of the steps in this flowchart can be changed, and some can be omitted:

[0055] S11, when receiving a data splicing request, parse the data splicing request to obtain the first data and the second data to be spliced.

[0056] In at least one embodiment of the present application, the data splicing request refers to a request sent by a target database for data splicing processing. The number of data for data splicing processing is not limited, and it can be two or more than two. In this embodiment of the present application, two are taken as an example, that is, the data to be spliced are the first data and the second data. The target database refers to the database to which the data splicing function is to be migrated, and the data splicing function can be obtained from the original database. The data splicing function in the original database refers to the relevant function executed using the configured data splicing code. In one embodiment, the target database can be a pg database (PostgreSQL database), and the original database can be an ignite database (in-memory database, with fast response speed but poor stability). The data splicing request contains the first data identifier of the first data to be spliced and the second data identifier of the second data. The way of data identification can be numbers, letters, or colors, which is not limited here. By querying this data identifier, the relevant data information to be spliced can be obtained.

[0057] Optionally, parsing the data splicing request to obtain the first data and the second data to be spliced includes:

[0058] Parse the data splicing request and detect whether a data identifier is carried in the data splicing request;

[0059] When the detection result is that the data splicing request carries the data identifier, extract the first data identifier and the second data identifier;

[0060] Traverse the pre-set mapping relationship between the data identifier and the data according to the first data identifier and the second data identifier respectively, and obtain the first data and the second data to be spliced.

[0061] Wherein, when the detection result is that the data splicing request does not carry the data identifier, it means that the data splicing request does not carry the data information to be spliced at this time, and this data splicing request may be incorrect, and an error can be reported to the relevant person in charge for error correction.

[0062] S12. Obtain the first data type corresponding to the first data and the second data type corresponding to the second data, and respectively determine the original logic item and the target logic item according to the first data type and the second data type.

[0063] In at least one embodiment of the present application, different data have corresponding data types, and the data types may be return data type, date data type, query data type, external link data type, function data type, time data type, table type, etc., which are not limited herein. The original logic item refers to the logic item corresponding to the data type in the original database, and the target logic item refers to the logic item corresponding to the data type in the target database. Taking the logic items in the original database as an example, the original logic items may include but are not limited to return logic items, date logic items, query logic items, external link logic items, function logic items, time logic items, and table logic items. It can be understood that there is a mapping relationship between the original logic item and the target logic item. In one embodiment, the original logic item and the target logic item are in one-to-one correspondence. There is also a mapping relationship between the data type and the logic item. By querying this mapping relationship, the logic item corresponding to the data type can be obtained.

[0064] Optionally, the obtaining the first data type corresponding to the first data and the second data type corresponding to the second data includes:

[0065] Obtain the first data feature corresponding to the first data;

[0066] When there is a data type definition in the original database whose similarity to the first data feature exceeds the preset similarity threshold, determine the data type corresponding to this data type definition as the first data type corresponding to the first data;

[0067] Obtain the second data feature corresponding to the second data;

[0068] When there is a data type definition in the target database whose similarity to the second data feature exceeds the preset similarity threshold, determine that the data type corresponding to this data type definition is the second data type corresponding to the second data.

[0069] Among them, the first data feature refers to the keyword information contained in the first data, the data type definition refers to the keyword information contained in the data type, and the keyword information can be obtained through keyword matching and other methods. In an embodiment, for known data types or logical items, several keywords can be preset in advance to represent the data type or logical item, and the keywords contained in the first data are obtained as the first data feature through keyword matching. The several preset keywords can be stored in a preset database. Considering the reliability and privacy of data storage, the preset database can be a target node on the blockchain.

[0070] Optionally, the determining the original logical item and the target logical item according to the first data type and the second data type respectively includes:

[0071] Traverse the pre-set mapping relationship between the data type and the logical item according to the first data type to obtain the first original logical item and the first target logical item corresponding to the first data type;

[0072] Traverse the pre-set mapping relationship between the data type and the logical item according to the second data type to obtain the second original logical item and the second target logical item corresponding to the second data type.

[0073] Among them, the first data type includes the corresponding original logical item and target logical item, and the second data type also includes the corresponding original logical item and target logical item. The original logical item and target logical item included in the first data type may be the same as or different from the original logical item and target logical item included in the second data type, and no limitation is made here.

[0074] S13, traverse the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item, and traverse the second preset data layer according to the target logical item to obtain the target data logical value corresponding to the target logical item.

[0075] In at least one embodiment of the present application, the first preset layer refers to a data layer that stores the configuration information related to the original database (also referred to as the first code configuration information in the present application). The related configuration information may include the original logical items, the original data logical values corresponding to the original logics, and the initial data splicing code. The second preset data layer refers to a data layer that stores the configuration information related to the target database. The related configuration information may include the target logical items, the target data logical values corresponding to the target logics, and the initial data splicing code. It can be understood that the initial data splicing code in the second preset data layer needs to be migrated step by step during iteration to obtain the target data splicing code. In one embodiment, the first preset data layer may be the first preset dao layer, and the second preset data layer may be the second preset dao layer. The first preset dao layer and the second preset dao layer mainly perform the work of the data persistence layer.

[0076] In one embodiment, the present application provides a data splicing function migration system. This system at least includes a controller layer, a dao layer, and a service layer. Among them, the controller layer is mainly responsible for controlling the specific business module processes. The dao layer is mainly used for the work of the data persistence layer. The service layer is mainly responsible for the application logic design of the business module. The service layer is built on top of the dao layer. The service layer can only be established after the dao layer is established. And the service layer is below the controller layer. Therefore, the service layer should both call the interfaces of the dao layer and provide interfaces for the classes in the controller layer to call. It just occupies an intermediate position. Each business module has a service interface, and each interface encapsulates its respective business processing methods. During the migration and transformation process of the data splicing function provided by the present application, there is no need to change the controller layer. By adding a switch configuration in the service layer (for example, the switch configuration is the switchActionUtil switch), a new dao layer (also referred to as the second preset data layer in the present application) is added to process the logics migrated from the target database (for example, the target database is a pg database).

[0077] Optionally, the traversing the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item includes:

[0078] Obtain the first code configuration information in the first preset data layer;

[0079] Detect whether the original logical item exists in the first code configuration information;

[0080] When the detection result indicates that the original logical item exists in the first code configuration information, determine the first target position of the original logical item in the first code configuration information, and extract the configuration content at the first target position as the original data logical value.

[0081] Among them, the first code configuration information refers to the relevant configuration information of the original database. The first code configuration information may include the original logical item, the original data logical value corresponding to the original logic, and the initial data splicing code. Detecting whether the original logical item exists in the first code configuration information is also detecting whether the keyword information corresponding to the original logical item exists in the first code configuration information. When the detection result indicates that the keyword information corresponding to the original logical item exists in the first code configuration information, it is determined that the original logical item exists in the first code configuration information. In the first code configuration information, the original logical item and the original data logical value are stored in a preset data format. In one embodiment, the preset data format may be {original logical item, original data logical value}. The first target position refers to the position of the original logical item in the first code configuration information. Through the above preset data format, it can be determined that the configuration content at the first target position is the original data logical value.

[0082] Optionally, the traversing the second preset data layer according to the target logical item to obtain the target data logical value corresponding to the target logical item includes:

[0083] Obtain the second code configuration information in the second preset data layer;

[0084] Detect whether the target logical item exists in the second code configuration information;

[0085] When the detection result indicates that the target logical item exists in the second code configuration information, determine the second target position of the target logical item in the second code configuration information, and extract the configuration content at the second target position as the target data logical value.

[0086] Exemplarily, both the original logic item and the target logic item may include, but are not limited to, a return logic item, a date logic item, a query logic item, an external link logic item, a function logic item, a time logic item, and a table logic item. Among them, for the return logic item, the corresponding original data logic value is: when the original database returns a Map, the query field is defaulted to uppercase; the corresponding target data logic value is: when the target database returns a Map, the query field is defaulted to lowercase. For the date logic item, the corresponding original data logic value is: the date format is year-month-day; the corresponding original data logic value is: year-month-day. For the query logic item, the corresponding original data logic value is: no alias needs to be added for a subquery; the corresponding target data logic value is: an alias needs to be added for a subquery. The original data logic and the target data logic corresponding to each logic item are both preset and will not be elaborated here.

[0087] S14. Obtain the initial data splicing code in the original database.

[0088] In at least one embodiment of the present application, the first preset layer stores configuration information related to the original database (the present application also refers to it as the first code configuration information). The related configuration information may include the original logic item, the original data logic value corresponding to the original logic, and the initial data splicing code. In one embodiment, the initial data splicing code is provided with a corresponding code identifier for indicating that the code of this module is used to implement the data splicing function.

[0089] Optionally, the obtaining of the initial data splicing code in the original database includes:

[0090] Obtain the first preset layer corresponding to the original database, and extract the first code configuration information in the first preset layer;

[0091] Detect whether there is a data splicing identifier in the first code configuration information;

[0092] When the detection result is that there is the data splicing identifier in the first code configuration information, obtain the code corresponding to the data splicing identifier as the initial data splicing code.

[0093] S15. Call a preset switch to adjust the initial data splicing code according to the original data logic value and the target data logic value to obtain a target data splicing code.

[0094] In at least one embodiment of the present application, the preset switch may be a switchActionUtil switch. By calling the preset switch, data logic switching can be completed, that is, by calling the preset switch, the original data logic value in the initial data splicing code is changed to the target data logic value to obtain a target data splicing code.

[0095] In one embodiment, the data source of the target database is configured through the ark configuration center. A common class for preset switch switching is written in a common utility class. An action variable is defined in the common class for preset switch switching to obtain the value of the data source of the ark configuration center. A method is written to get the value of this action and then return this value. This common method is used in the code for logical judgment. When the switch is turned on, the corresponding data logic of the target database is executed. When the switch is turned off, the corresponding data logic of the original database is executed.

[0096] Optionally, the step of calling the preset switch to adjust the initial data splicing code according to the original data logic value and the target data logic value to obtain the target data splicing code includes:

[0097] Obtain the initial data splicing code;

[0098] Call the preset switch to determine the original data logic value in the initial data splicing code;

[0099] Replace the original data logic value with the target data logic value to obtain the target data splicing code.

[0100] It can be understood that the target data splicing code is used to splice and process the first data and the second data at this time. For the data splicing request for requesting to splice data of other data types, for example, when the data splicing request is used to request to splice the third data and the fourth data, the above-mentioned several steps are still required to continue to realize the iterative migration of the data splicing code step by step until the data splicing code corresponding to the target database can process the data splicing of all data types.

[0101] S16. Call the target data splicing code to splice and process the first data and the second data to obtain a data splicing result.

[0102] In at least one embodiment of the present application, the target data splicing code is called to splice and process the first data and the second data according to the splicing requirements in the data splicing request to obtain a data splicing result. Among them, the splicing requirements may include the data splicing order. The data splicing order may refer to the splicing order of the first data and the second data. For example, the first data is sorted before the second data.

[0103] Optionally, the step of calling the target data splicing code to splice and process the first data and the second data to obtain a data splicing result includes:

[0104] Parse the data splicing request to obtain data splicing requirements;

[0105] Call the target data splicing code to splice and process the first data and the second data according to the data splicing requirements, and obtain a data splicing result.

[0106] The data splicing function migration method provided by the embodiments of the present application realizes the step-by-step iterative migration of the data splicing code by configuring a preset switch and calling the preset switch during the data splicing process, avoiding the problems of large workload and easy omission caused by one-time migration, reducing the workload, not affecting business use, and improving the accuracy of data splicing function migration; and the present application configures two preset data layers to store the code configuration information of the original database and the target database respectively, and works in cooperation with the preset switch, traversing the first preset data layer when the preset switch needs to select the original data logical value, and traversing the second preset data layer when it needs to select the target data logical value, which can improve the accuracy of obtaining the data logical value, thereby improving the accuracy of data splicing function migration. The present application can be applied to various functional modules of smart cities such as smart government affairs and smart transportation, such as the data splicing function migration module of smart government affairs, etc., and can promote the rapid development of smart cities.

[0107] Figure 2 It is the structural diagram of the data splicing function migration device provided by the second embodiment of the present application.

[0108] In some embodiments, the data splicing function migration device 20 may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the data splicing function migration device 20 may be stored in the memory of the computer device and executed by at least one processor to execute (see details Figure 1 description) the functions of data splicing function migration.

[0109] In this embodiment, the data splicing function migration device 20 can be divided into multiple functional modules according to the functions it executes. The functional modules may include: a request parsing module 201, a type obtaining module 202, a logic traversing module 203, a code obtaining module 204, a code adjusting module 205, and a code splicing module 206. The module referred to in the present application refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory. In this embodiment, the functions of each module will be described in detail in the subsequent embodiments.

[0110] The request parsing module 201 is used to parse the data splicing request to obtain the first data and the second data to be spliced when receiving the data splicing request.

[0111] In at least one embodiment of the present application, the data splicing request refers to a request issued by a target database for data splicing processing. The number of data for data splicing processing is not limited, and it can be two, or more than two. In the embodiments of the present application, two are taken as an example, that is, the data to be spliced are the first data and the second data. The target database refers to the database with the function of migrating and splicing data, and the data splicing function can be obtained from the original database. The data splicing function in the original database refers to the related function executed by using the configured data splicing code. In one embodiment, the target database can be a pg database (PostgreSQL database), and the original database can be an ignite database (in-memory database, with fast response speed but poor stability). The data splicing request includes the first data identifier of the first data to be spliced and the second data identifier of the second data. The way of data identification can be numbers, letters or colors, which is not limited here. By querying the data identifier, the relevant data information to be spliced can be obtained.

[0112] Optionally, parsing the data splicing request to obtain the first data and the second data to be spliced includes:

[0113] Parse the data splicing request and detect whether the data splicing request carries a data identifier;

[0114] When the detection result is that the data splicing request carries the data identifier, extract the first data identifier and the second data identifier;

[0115] Traverse the mapping relationship between the pre-set data identifier and the data according to the first data identifier and the second data identifier respectively to obtain the first data and the second data to be spliced.

[0116] Wherein, when the detection result is that the data splicing request does not carry the data identifier, it means that the data splicing request does not carry the data information to be spliced at this time, and this data splicing request may be incorrect, and an error can be reported to the relevant person in charge for error correction processing.

[0117] The type acquisition module 202 is used to acquire the first data type corresponding to the first data and the second data type corresponding to the second data, and respectively determine the original logic item and the target logic item according to the first data type and the second data type.

[0118] In at least one embodiment of the present application, different data has corresponding data types, which may include return data types, date data types, query data types, external link data types, function data types, time data types, table types, etc., without limitation here. The original logical item refers to the logical item corresponding to the data type in the original database, and the target logical item refers to the logical item corresponding to the data type in the target database. Taking the logical items in the original database as an example, the original logical items may include, but are not limited to, return logical items, date logical items, query logical items, external link logical items, function logical items, time logical items, and table logical items. It can be understood that there is a mapping relationship between the original logical item and the target logical item. In one embodiment, the original logical item and the target logical item are in one-to-one correspondence. There is also a mapping relationship between the data type and the logical item. By querying this mapping relationship, the logical item corresponding to the data type can be obtained.

[0119] Optionally, the obtaining the first data type corresponding to the first data and the second data type corresponding to the second data includes:

[0120] Obtain the first data feature corresponding to the first data;

[0121] When there is a data type definition in the original database whose similarity to the first data feature exceeds the preset similarity threshold, determine the data type corresponding to this data type definition as the first data type corresponding to the first data;

[0122] Obtain the second data feature corresponding to the second data;

[0123] When there is a data type definition in the target database whose similarity to the second data feature exceeds the preset similarity threshold, determine the data type corresponding to this data type definition as the second data type corresponding to the second data.

[0124] Wherein, the first data feature refers to the keyword information included in the first data, and the data type definition refers to the keyword information included in the data type. The keyword information can be obtained through keyword matching and other means. In one embodiment, for known data types or logical items, several keywords can be preset in advance to represent the data type or logical item, and the keywords included in the first data are obtained as the first data feature through keyword matching. The several preset keywords can be stored in a preset database. Considering the reliability and privacy of data storage, the preset database can be a target node on the blockchain.

[0125] Optionally, the respectively determining the original logical item and the target logical item according to the first data type and the second data type includes:

[0126] Traverse the pre-set mapping relationship between data types and logical items according to the first data type, and obtain the first original logical item and the first target logical item corresponding to the first data type;

[0127] Traverse the pre-set mapping relationship between data types and logical items according to the second data type, and obtain the second original logical item and the second target logical item corresponding to the second data type.

[0128] Among them, the first data type includes corresponding original logical items and target logical items, and the second data type also includes corresponding original logical items and target logical items. The original logical items and target logical items included in the first data type may be the same as or different from the original logical items and target logical items included in the second data type, and no limitation is made here.

[0129] The logical traversal module 203 is used to traverse the first preset data layer according to the original logical item, obtain the original data logical value corresponding to the original logical item, and traverse the second preset data layer according to the target logical item, obtain the target data logical value corresponding to the target logical item.

[0130] In at least one embodiment of the present application, the first preset layer refers to the data layer storing the relevant configuration information of the original database (the present application also refers to it as the first code configuration information). The relevant configuration information may include the original logical item, the original data logical value corresponding to the original logic, and the initial data splicing code. The second preset data layer refers to the data layer storing the relevant configuration information of the target database. The relevant configuration information may include the target logical item, the target data logical value corresponding to the target logic, and the initial data splicing code. It can be understood that the initial data splicing code in the second preset data layer needs to be migrated step by step with iteration to obtain the target data splicing code. In one embodiment, the first preset data layer may be the first preset dao layer, and the second preset data layer may be the second preset dao layer. The first preset dao layer and the second preset dao layer mainly perform the work of the data persistence layer.

[0131] In one embodiment, the present application provides a data splicing function migration system, which at least includes a controller layer, a dao layer, and a service layer. Among them, the controller layer is mainly responsible for controlling the specific business module process. The dao layer is mainly responsible for the work of the data persistence layer. The service layer is mainly responsible for the application logic design of the business module. The service layer is built on top of the dao layer, and the service layer can only be established after the dao layer is established. And the service layer is below the controller layer. Therefore, the service layer should both call the interface of the dao layer and provide an interface for the classes in the controller layer to call. It just lies in an intermediate layer position. Each business module has a service interface, and each interface encapsulates its respective business processing methods. During the migration and transformation process of the data splicing function provided by the present application, there is no need to change the controller layer. By adding a switch configuration in the service layer (for example, the switch configuration is the switchActionUtil switch), a new dao layer (also referred to as the second preset data layer in the present application) is added to process the logic migrated from the target database (for example, the target database is a pg database).

[0132] Optionally, the traversing the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item includes:

[0133] Obtain the first code configuration information in the first preset data layer;

[0134] Detect whether the original logical item exists in the first code configuration information;

[0135] When the detection result is that the original logical item exists in the first code configuration information, determine the first target position of the original logical item in the first code configuration information, and extract the configuration content at the first target position as the original data logical value.

[0136] Among them, the first code configuration information refers to the relevant configuration information of the original database. The first code configuration information may include the original logical item, the original data logical value corresponding to the original logic, and the initial data splicing code. Detecting whether the original logical item exists in the first code configuration information is also detecting whether the keyword information corresponding to the original logical item exists in the first code configuration information. When the detection result is that the keyword information corresponding to the original logical item exists in the first code configuration information, it is determined that the original logical item exists in the first code configuration information. In the first code configuration information, the original logical item and the original data logical value are stored in a preset data format. In one embodiment, the preset data format may be {original logical item, original data logical value}. The first target position refers to the position of the original logical item in the first code configuration information. Through the above preset data format, it can be determined that the configuration content at the first target position is the original data logical value.

[0137] Optionally, traversing the second preset data layer according to the target logical item to obtain the target data logical value corresponding to the target logical item includes:

[0138] Obtain the second code configuration information in the second preset data layer;

[0139] Detect whether the target logical item exists in the second code configuration information;

[0140] When the detection result is that the target logical item exists in the second code configuration information, determine the second target position of the target logical item in the second code configuration information, and extract the configuration content at the second target position as the target data logical value.

[0141] Exemplarily, the original logical item and the target logical item may both include but are not limited to a return logical item, a date logical item, a query logical item, an external link logical item, a function logical item, a time logical item, and a table logical item. Among them, for the return logical item, the corresponding original data logical value is: when the original database returns a Map, the query field is defaulted to uppercase, and the corresponding target data logical value is: when the target database returns a Map, the query field is defaulted to lowercase. For the date logical item, the corresponding original data logical value is: the date format is year-month-day, and the corresponding original data logical value is: year-month-day. For the query logical item, the corresponding original data logical value is: no alias needs to be added for subqueries, and the corresponding target data logical value is: an alias needs to be added for subqueries. The original data logic and the target data logic corresponding to each logical item are all preset in advance and will not be elaborated here.

[0142] The code acquisition module 204 is used to acquire the initial data splicing code in the original database.

[0143] In at least one embodiment of the present application, the first preset layer stores configuration information related to the original database (the present application also refers to it as the first code configuration information). The related configuration information may include the original logical item, the original data logical value corresponding to the original logic, and the initial data splicing code. In one embodiment, the initial data splicing code is provided with a corresponding code identifier for characterizing that the code of this module is used to implement the data splicing function.

[0144] Optionally, acquiring the initial data splicing code in the original database includes:

[0145] Acquire the first preset layer corresponding to the original database, and extract the first code configuration information in the first preset layer;

[0146] Detect whether there is a data splicing identifier in the first code configuration information;

[0147] When the detection result is that there is the data splicing identifier in the first code configuration information, acquire the code corresponding to the data splicing identifier as the initial data splicing code.

[0148] The code adjustment module 205 is used to call a preset switch to adjust the initial data splicing code according to the original data logical value and the target data logical value to obtain a target data splicing code.

[0149] In at least one embodiment of the present application, the preset switch may be a switchActionUtil switch. By calling the preset switch, data logic switching can be completed, that is, by calling the preset switch, the original data logical value in the initial data splicing code is changed to the target data logical value to obtain a target data splicing code.

[0150] In one embodiment, the data source of the target database is configured through the ark configuration center. A common class for preset switch switching is written in the common utility class. An action variable is defined in the common class for preset switch switching to obtain the value of the data source of the ark configuration center. Write a method to get the value of this action and then return this value. This common method is used for logical judgment in the code. When the switch is turned on, the data logic corresponding to the target database is executed. When the switch is turned off, the data logic corresponding to the original database is executed.

[0151] Optionally, calling the preset switch to adjust the initial data splicing code according to the original data logical value and the target data logical value to obtain a target data splicing code includes:

[0152] Obtain the initial data splicing code;

[0153] Call a preset switch to determine the original data logical value in the initial data splicing code;

[0154] Replace the original data logical value with a target data logical value to obtain a target data splicing code.

[0155] It can be understood that the target data splicing code is used to splice and process the first data and the second data at this time. For the data splicing request used to request splicing of other data types, for example, when the data splicing request is used to request splicing of the third data and the fourth data, it is also necessary to continue to implement step-by-step iterative migration of the data splicing code through the above steps until the data splicing code corresponding to the target database can process data splicing of all data types.

[0156] The code splicing module 206 is used to call the target data splicing code to splice and process the first data and the second data to obtain a data splicing result.

[0157] In at least one embodiment of the present application, the target data splicing code is called to splice and process the first data and the second data according to the splicing requirements in the data splicing request to obtain a data splicing result. Among them, the splicing requirements may include the data splicing order. The data splicing order may refer to the splicing order of the first data and the second data. For example, the first data is sorted before the second data.

[0158] Optionally, the calling the target data splicing code to splice and process the first data and the second data to obtain a data splicing result includes:

[0159] Parse the data splicing request to obtain data splicing requirements;

[0160] Call the target data splicing code to splice and process the first data and the second data according to the data splicing requirements to obtain a data splicing result.

[0161] Refer to Figure 3 As shown, it is a schematic structural diagram of a computer device provided in Embodiment 3 of the present application. In a preferred embodiment of the present application, the computer device 3 includes a memory 31, at least one processor 32, at least one communication bus 33, and a transceiver 34.

[0162] Those skilled in the art should understand, Figure 3The structure of the computer device shown does not constitute a limitation of the embodiments of the present application. It can be a bus structure or a star structure. The computer device 3 may also include more or fewer other hardware or software than shown, or different component arrangements.

[0163] In some embodiments, the computer device 3 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital signal processors, and embedded devices, etc. The computer device 3 may also include a client device, and the client device includes, but is not limited to, any electronic product that can perform human-computer interaction with the client through means such as a keyboard, mouse, remote control, touchpad, or voice control device. For example, personal computers, tablet computers, smartphones, digital cameras, etc.

[0164] It should be noted that the computer device 3 is only an example. Other existing or future possible electronic products that can be adapted to the present application should also be included within the protection scope of the present application and are hereby incorporated by reference.

[0165] In some embodiments, a computer program is stored in the memory 31, and when the computer program is executed by the at least one processor 32, all or part of the steps in the data splicing function migration method as described are implemented. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electrically-erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc memories, magnetic disk memories, tape memories, or any other computer-readable medium that can be used to carry or store data.

[0166] Furthermore, the computer-readable storage medium mainly includes a storage program area and a storage data area. Among them, the storage program area can store an operating system, application programs required for at least one function, etc.; the storage data area can store data created according to the use of the blockchain node, etc.

[0167] The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer, etc.

[0168] In some embodiments, the at least one processor 32 is the control core (Control Unit) of the computer device 3, connecting various components of the entire computer device 3 through various interfaces and lines. By running or executing programs or modules stored in the memory 31, and by calling data stored in the memory 31, it performs various functions of the computer device 3 and processes data. For example, when the at least one processor 32 executes the computer program stored in the memory, it implements all or part of the steps of the data splicing function migration method described in the embodiments of this application; or implements all or part of the functions of the data splicing function migration device. The at least one processor 32 can be composed of integrated circuits. For example, it can be composed of a single packaged integrated circuit, or can be composed of multiple integrated circuits with the same or different functions, including the combination of one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and various control chips, etc.

[0169] In some embodiments, the at least one communication bus 33 is configured to enable connection communication between the memory 31 and the at least one processor 32, etc.

[0170] Although not shown, the computer device 3 may further include a power supply (such as a battery) for powering each component. Preferably, the power supply can be logically connected to the at least one processor 32 through a power management device, so as to implement functions such as management of charging, discharging, and power consumption management through the power management device. The power supply may also include any components such as one or more DC or AC power supplies, a recharge device, a power failure detection circuit, a power converter or inverter, and a power status indicator. The computer device 3 may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.

[0171] The integrated units implemented in the form of software functional modules as described above can be stored in a computer-readable storage medium. The above-mentioned software functional modules are stored in a storage medium and include several instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of the methods described in various embodiments of the present application.

[0172] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0173] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units. They can be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0174] In addition, in various embodiments of the present application, the functional modules can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0175] For those skilled in the art, it is obvious that the present application is not limited to the details of the above-mentioned exemplary embodiments, and can be implemented in other specific forms without departing from the spirit or basic characteristics of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present application is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any reference signs in the claims should not be regarded as limiting the claimed rights. In addition, obviously, the word "including" does not exclude other units, and the singular does not exclude the plural. The multiple units or devices described in the specification can also be implemented by one unit or device through software or hardware. The words such as first and second are used to represent names and do not represent any specific order.

[0176] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit them. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A method for migrating data splicing function, characterized in that, the method for migrating data splicing function includes: When receiving a data splicing request, parsing the data splicing request to obtain the first data and the second data to be spliced. The data splicing request refers to a request for data splicing processing sent by the target database, and the target database represents the database to which the data splicing function to be migrated belongs, and the data splicing function is obtained from the original database; Obtaining the first data type corresponding to the first data and the second data type corresponding to the second data, and respectively determining the original logical item and the target logical item according to the first data type and the second data type; Traversing the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item, and traversing the second preset data layer according to the target logical item to obtain the target data logical value corresponding to the target logical item; the first preset data layer is used to store the first code configuration information of the original database; the second preset data layer is used to store the second code configuration information of the target database; the first preset data layer and the second preset data layer work together with a preset switch respectively. When the preset switch needs to select the original data logical value, it traverses the first preset data layer, and when it needs to select the target data logical value, it traverses the second preset data layer; Obtaining the initial data splicing code in the original database; Invoking the preset switch to adjust the initial data splicing code according to the original data logical value and the target data logical value to obtain the target data splicing code; Invoking the target data splicing code to splice and process the first data and the second data to obtain a data splicing result.

2. The method for migrating data splicing function according to claim 1, characterized in that, the parsing the data splicing request to obtain the first data and the second data to be spliced includes: Parsing the data splicing request and detecting whether a data identifier is carried in the data splicing request; When the detection result is that the data identifier is carried in the data splicing request, extracting the first data identifier and the second data identifier; Traversing the pre-set mapping relationship between the data identifier and the data according to the first data identifier and the second data identifier to obtain the first data and the second data to be spliced.

3. The method for migrating data splicing function according to claim 1, characterized in that, the respectively determining the original logical item and the target logical item according to the first data type and the second data type includes: Traversing the pre-set mapping relationship between the data type and the logical item according to the first data type to obtain the first original logical item and the first target logical item corresponding to the first data type; Traversing the pre-set mapping relationship between the data type and the logical item according to the second data type to obtain the second original logical item and the second target logical item corresponding to the second data type.

4. The method for migrating data splicing function according to claim 1, characterized in that, Traversing the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item includes: Obtaining the first code configuration information in the first preset data layer; Detecting whether the original logical item exists in the first code configuration information; When the detection result is that the original logical item exists in the first code configuration information, determining the first target position of the original logical item in the first code configuration information, and extracting the configuration content at the first target position as the original data logical value.

5. The data splicing function migration method according to claim 1, wherein, The obtaining the initial data splicing code in the original database includes: Obtaining the first preset layer corresponding to the original database, and extracting the first code configuration information in the first preset layer; Detecting whether a data splicing identifier exists in the first code configuration information; When the detection result is that the data splicing identifier exists in the first code configuration information, obtaining the code corresponding to the data splicing identifier as the initial data splicing code.

6. The data splicing function migration method according to claim 1, wherein, The calling the preset switch to adjust the initial data splicing code according to the original data logical value and the target data logical value to obtain the target data splicing code includes: Obtaining the initial data splicing code; Calling the preset switch to determine the original data logical value in the initial data splicing code; Replacing the original data logical value with the target data logical value to obtain the target data splicing code.

7. The data splicing function migration method according to claim 1, wherein, The calling the target data splicing code to splice and process the first data and the second data to obtain a data splicing result includes: Parsing the data splicing request to obtain a data splicing requirement; Calling the target data splicing code to splice and process the first data and the second data according to the data splicing requirement to obtain a data splicing result.

8. A data splicing function migration device, wherein, for implementing the data splicing function migration method according to any one of claims 1 to 7, the data splicing function migration device includes: A request parsing module, configured to parse the data splicing request to obtain the first data and the second data to be spliced when receiving the data splicing request; A type obtaining module, configured to obtain the first data type corresponding to the first data and the second data type corresponding to the second data, and respectively determine the original logical item and the target logical item according to the first data type and the second data type; A logic traversing module, configured to traverse the first preset data layer according to the original logical item to obtain the original data logical value corresponding to the original logical item, and traverse the second preset data layer according to the target logical item to obtain the target data logical value corresponding to the target logical item; A code obtaining module, configured to obtain the initial data splicing code in the original database; A code adjustment module, configured to call a preset switch to adjust the initial data splicing code according to the logical value of the original data and the logical value of the target data, so as to obtain a target data splicing code; A code splicing module, configured to call the target data splicing code to splice and process the first data and the second data to obtain a data splicing result.

9. A computer device, characterized in that, the computer device includes a processor, and the processor is configured to implement the data splicing function migration method according to any one of claims 1 to 7 when executing a computer program stored in a memory.

10. A computer-readable storage medium, on which a computer program is stored, characterized in that, the computer program, when executed by a processor, implements the data splicing function migration method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Service data processing method and apparatus, computer device, and storage medium

    CN109325041A

  • Approach for managing forecast data

    US7516084B1