Database conversion method and device, computer device, and storage medium

By parsing and adaptability-driven framework updates and syntax changes, the compatibility issues of XML mapping in the conversion from Oracle database to TiDB database were resolved, achieving efficient database conversion and reducing code modification and manpower costs.

CN116257578BActive Publication Date: 2026-05-01CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2023-02-27
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing SQL language conversion technologies cannot smoothly migrate the XML mapping of Oracle databases to the XML mapping framework of TiDB databases, resulting in poor compatibility of SQL statements between databases and inefficient database conversion.

Method used

By parsing the database data to be converted, obtaining the node set and its hierarchical attributes, updating the framework and changing the syntax according to the adaptability, and combining the target data configuration information to perform database conversion, a smooth database conversion is achieved.

Benefits of technology

Without modifying the code, the database conversion was made smooth and accurate, reducing labor costs and improving conversion efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257578B_ABST
    Figure CN116257578B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of big data, and discloses a database conversion method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring to-be-converted database data; analyzing the to-be-converted database data to obtain a node set and hierarchical attributes of each node; performing framework updating on the node set according to the adaptation degree corresponding to the hierarchical attributes to obtain target framework database data; and performing database conversion on the target framework database data according to target data configuration information to obtain target database data. The method can more smoothly perform database conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a database conversion method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] In today's world, information technology has greatly promoted the development of national information industries, and databases, as the most fundamental and critical foundational software in information systems, have been widely used. Given the characteristics of current managed services, such as massive amounts of existing data, a large volume of active data, and rapid business growth, this study comprehensively analyzes factors such as execution efficiency, syntax compatibility, performance verification, and system architecture involved in updating domestically produced databases. Among relevant technologies, the domestically produced distributed database TiDB has been selected. ( A new type of distributed database that combines the features of traditional relational databases and NoSQL databases. ) Replace the existing Oracle (Oracle RDBMS, a relational database) database. The current mainstream data persistence framework, MyBatis, improves interface binding and object-relational mapping based on iBatis (a combination of internet and abatis, an open-source project initiated by Clinton Begin in 2001). Therefore, replacing Oracle with TiDB mainly involves upgrading the persistence database framework and converting the Oracle database to TiDB.

[0003] Existing SQL (Structured Query Language) language conversion techniques typically only involve converting SQL dialects between databases or even modifying existing business code. They cannot smoothly port the XML (Extensible Markup Language) mapping that supports Oracle to the XML mapping framework that supports TiDB, thus achieving compatibility of SQL statements across different databases. Summary of the Invention

[0004] Therefore, it is necessary to provide a database conversion method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can perform database conversion more smoothly, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a database conversion method. The method includes:

[0006] Retrieve the database data to be converted;

[0007] The transformed database data is parsed to obtain a set of nodes and the hierarchical attributes of each node;

[0008] The node set is updated according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data.

[0009] The target framework database data is transformed according to the target data configuration information to obtain the target database data.

[0010] In one embodiment, updating the node set according to the adaptability corresponding to the hierarchical attribute to obtain target framework database data includes:

[0011] When the adaptability corresponding to the hierarchical attribute is supported, the node set is updated according to the hierarchical attribute to obtain the target framework database data;

[0012] When the adaptability corresponding to the hierarchical attribute is not supported, add the prompt information of the node set to obtain the target framework database data.

[0013] In one embodiment, updating the node set according to the hierarchical attributes to obtain target framework database data includes:

[0014] When the current node's hierarchy attribute is a first-level label, the label of the node set is updated according to the node type of the current node to obtain the target framework database data;

[0015] When the hierarchical attribute of the current node is a second-level label, the information of the node set is updated according to the node type of the current node to obtain the target framework database data.

[0016] In one embodiment, the step of performing database transformation on the target framework database data according to the target data configuration information to obtain target database data includes:

[0017] Based on the target data configuration information, the target framework database data is syntactically modified to obtain the initial database data;

[0018] The target transformation information is obtained from the initial database data, and then modified according to the target transformation information to obtain the target database data.

[0019] In one embodiment, the method further includes:

[0020] The target database data is matched with keywords and then replaced to obtain the target data result.

[0021] Secondly, this application also provides a database conversion apparatus. The apparatus includes:

[0022] The acquisition module is used to acquire the database data to be converted.

[0023] The parsing module is used to parse the data in the transformation database to obtain the node set and the hierarchical attributes of each node;

[0024] The update module is used to update the node set according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data;

[0025] The conversion module is used to convert the target framework database data according to the target data configuration information to obtain the target database data.

[0026] In one embodiment, the update module includes:

[0027] The first update submodule is used to update the node set according to the hierarchical attribute when the adaptability corresponding to the hierarchical attribute is supported, so as to obtain the target framework database data.

[0028] The second update submodule adds a prompt message to the node set when the adaptability corresponding to the hierarchical attribute is not supported, and obtains the target framework database data.

[0029] In one embodiment, the first update submodule includes:

[0030] The tag update unit is used to update the tags of the node set according to the node type of the current node when the hierarchical attribute of the current node is a first-level tag, so as to obtain the target framework database data.

[0031] The information update unit is used to update the information of the node set according to the node type of the current node when the hierarchical attribute of the current node is a second-level label, so as to obtain the target framework database data.

[0032] In one embodiment, the conversion module includes:

[0033] The modification submodule is used to perform syntax changes on the target framework database data according to the target data configuration information to obtain the initial database data.

[0034] The modification submodule is used to obtain target transformation information based on the initial database data, and modify the target transformation information to obtain the target database data.

[0035] In one embodiment, the above-described apparatus further includes:

[0036] The matching module is used to perform keyword matching and replacement on the target database data to obtain the target data result.

[0037] The replacement module is used to replace data based on the matching results to obtain the target database data.

[0038] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the methods in any of the above embodiments.

[0039] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the methods in any of the above embodiments.

[0040] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the methods in any of the above embodiments.

[0041] The aforementioned database conversion method, apparatus, computer equipment, storage medium, and computer program product involve a server parsing the database data to be converted, obtaining a set of nodes and the hierarchical attributes of each node, then updating the node set according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data, and finally converting the target framework database data according to the target data configuration information to obtain the target database data. Firstly, the server performs framework conversion on the database to be converted after the initial database conversion, which allows for a smoother conversion without requiring code modifications. Secondly, the server incorporates hierarchical attributes during framework conversion, making the conversion process more accurate. Attached Figure Description

[0042] Figure 1 A flowchart illustrating a database conversion method in one embodiment;

[0043] Figure 2 This is a flowchart illustrating a framework conversion method in one embodiment;

[0044] Figure 3 This is a schematic diagram of database transformation in another embodiment;

[0045] Figure 4 A schematic diagram illustrating a database conversion method from Oracle to TiDB is provided.

[0046] Figure 5 This is a structural block diagram of a database conversion device in one embodiment;

[0047] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0049] In one embodiment, such as Figure 1 As shown, a database transformation method is provided, including the following steps:

[0050] S102, Obtain the database data to be converted.

[0051] The database data to be converted refers to the data that needs to be converted, such as iBatis's XML (Extensible Markup Language) mapping file.

[0052] Optionally, after obtaining the data to be converted, the server also needs to obtain the frame information between the current frame of the data to be converted and the target frame. This frame information may include the syntactic differences between the current frame of the data to be converted and the target frame to determine the compatibility of different nodes. The compatibility refers to the degree of support for frame conversion.

[0053] S104, parse the database data to be transformed to obtain the node set and the hierarchical attributes of each node.

[0054] The node set refers to all nodes after parsing the database data to be transformed, which can include nodes of various types such as comment nodes, text nodes, and element nodes. The hierarchy attribute refers to the hierarchy type and tag type of each node. The hierarchy type represents the relationship between nodes, such as parent-child relationships; the tag type refers to the tag level of the node, such as first-level tags, second-level tags, etc. For example, first-level tags are mainly used to represent the type of SQL statement, such as select, update, delete, etc., while second-level tags mainly represent the content of the SQL statement, such as operations like checking if a field is empty or looping through a collection.

[0055] For example, after receiving the database data to be converted, the server uses the SAXReader parser to parse the hierarchical attributes and child node collection of the original XML file to form an object tree corresponding to the database data to be converted. The SAXReader parser is a DOM parser that creates a complete XML file tree.

[0056] S106, Update the node set according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data.

[0057] The target framework database data refers to the data obtained after converting the database data to be converted into the target framework. For example, the data obtained after mapping the SQL mapping file of the iBatis persistence framework to the Mybatis framework.

[0058] Optionally, the server can obtain the root node through the hierarchy attribute, and traverse upwards from the root node, updating the framework in turn by combining the adaptability of each node to obtain the target framework database data.

[0059] Optionally, the server can add the root node to the target XML parser so that the XML parser can traverse from the root node to perform transformations based on the fitness level of each node.

[0060] For example, in this embodiment, the root node has DocType, XMLEncoding, RootNodeComment, and NAMESPACE. The server adds the root node to the XML parser, and the XML parser updates the framework according to the adaptability of each node to obtain the target framework database data.

[0061] Furthermore, the server determines the node type for each node and then performs frame conversion based on compatibility. For example, the server performs tag conversion on nodes of element type to perform frame conversion.

[0062] S208, Based on the target data configuration information, perform database transformation on the target framework database data to obtain the target database data.

[0063] The target data configuration information can be pre-set differences between different types of data. For example, by comparing the syntax operation manuals of Oracle and TiDB, we can collect the adaptation and update items that differ in syntax between Oracle and TiDB and form a corresponding update plan.

[0064] Optionally, the server first performs syntax conversion and parameter modification on the target framework database data based on the target data configuration information, and then modifies the information to obtain the target database data.

[0065] Optionally, the server can transform the target framework database data line by line. This is because the target database data cannot form a logical tree, so the target framework data is updated by transforming it line by line.

[0066] For example, Oracle and TiDB use different syntax for expressing the same functions. For instance, for pagination, Oracle uses the `rownum` keyword, while TiDB uses the `limit` keyword. Therefore, it is necessary to convert and change parameters according to different usages.

[0067] For example, due to the special nature of Oracle databases, such as configuration views, stored procedures, and sequence numbers, information needs to be modified to obtain the target database data.

[0068] In the database conversion method described above, the server parses the database data to be converted, obtaining a set of nodes and the hierarchical attributes of each node. Then, based on the adaptability corresponding to the hierarchical attributes, the node set is updated with a framework to obtain the target framework database data. Finally, based on the target data configuration information, the target framework database data is converted to obtain the target database data. Firstly, the server performs a framework conversion on the database to be converted after the initial database conversion, which allows for a smoother conversion without requiring code modifications. Secondly, the server incorporates hierarchical attributes during the framework conversion, making the conversion process more accurate.

[0069] In one embodiment, updating the node set according to the adaptability corresponding to the hierarchical attribute to obtain target framework database data includes: when the adaptability corresponding to the hierarchical attribute is supported, updating the node set according to the hierarchical attribute to obtain target framework database data; when the adaptability corresponding to the hierarchical attribute is not supported, adding prompt information to the node set to obtain target framework database data.

[0070] Optionally, when the adaptation level corresponding to the hierarchy attribute is supported, the server can update the frame of each node in the node set according to the hierarchy attribute, and update the frame of the node set according to the tag type in the hierarchy attribute to obtain the target frame database data. For example, the server first updates the frame of the parent node, and then updates the frame of the child nodes of the parent node in turn, until all nodes in the node set have been updated.

[0071] Optionally, when the adaptability of a hierarchical attribute is not supported, the server will add a prompt message to the corresponding node. For example, the Mybatis tag is "cache," but its usage differs, making conversion inconvenient; the Mybatis official website recommends against using this tag anymore. In other embodiments, the prompt message can prompt technical personnel to perform manual updates.

[0072] Optionally, the server can obtain the adaptation degree corresponding to the hierarchical attributes through a preset adaptation degree table. For example, as shown in Table 1, Table 1 shows the support degree of the Batis and Mybatis frameworks for tags in one embodiment.

[0073] Table 1

[0074]

[0075] In the above embodiments, the server updates the framework based on the adaptability corresponding to the hierarchical attributes, which can complete the framework conversion simply and efficiently.

[0076] In one embodiment, updating the node set according to hierarchical attributes to obtain target frame database data includes: when the hierarchical attribute of the current node is a first-level label, updating the node set with labels according to the node type of the current node to obtain target frame database data; when the hierarchical attribute of the current node is a second-level label, updating the node set with information according to the node type of the current node to obtain target frame database data.

[0077] Optionally, first-level tags include SQL nodes, result map, select, insert, delete, update, statement, and type Alias ​​nodes; second-level tags include result, dynamic, isNotEmpty, isNotNull, isNull, isEmpty, iterate, isParameterPresent, selectKey, include, isEqual, isNotEqual, isGreaterThan, isGreaterEqual, isLessThan, and isLessEqual nodes. First-level tags primarily represent the type of SQL statement, such as select, update, and delete, while second-level tags mainly contain the content of the SQL statement, such as operations like checking if a field is empty or performing loop assignment checks on a collection.

[0078] For example, taking `sqlMap->mapper` as an example, `sqlMap->mapper` corresponds to the name of the configuration file, so simply replace `sqlMap` with `mapper`. `select` corresponds to the first-level tag; its corresponding `id` attribute name remains unchanged, while the attribute names: `return type` and `parameterClass` are upgraded from `resultClass` and `parameterClass` to `resultType` and `parameterType`. Second-level tags also need to complete the replacement and addition of syntax based on the attribute names, such as adding a `where` tag, converting the `isNotNull` tag to an `if` tag for checking for null values, and adding loop tags. <iterate>Attribute replacement and variable replacement, etc.

[0079] In the above embodiments, the server performs different conversions on the primary tags and secondary tags respectively to achieve accurate conversion.

[0080] In one exemplary embodiment, such as Figure 2 The diagram illustrates a framework conversion method. The server first compares the syntax trees of the two systems to summarize the definition and conversion rules for each tag. For conversion of first-level tags, the name of the first-level tag shown in the diagram can be used for judgment, and the corresponding attribute information of the Mybatis first-level tag can be added. However, conversion of second-level tags requires consideration of multiple cases. Second-level tags include result, dynamic, isNotEmpty, isNotNull, isNull, isEmpty, iterate, isParameterPresent, selectKey, include, isEqual, isNotEqual, isGreaterThan, isGreaterEqual, isLessThan, and isLessEqual. When processing second-level tags, the parent node attributes of the current node must also be considered to avoid omissions in adaptation.

[0081] In one embodiment, converting target framework database data according to target data configuration information to obtain target database data includes: modifying the syntax of target framework database data according to target data configuration information to obtain initial database data; obtaining target conversion information based on the initial database data; and modifying the target conversion information to obtain target database data.

[0082] Among them, target transformation information includes special types of information such as configuration views, stored procedures, and serial numbers.

[0083] Optionally, the server first modifies the target framework's syntax based on the target data configuration information. For example, Oracle and TiDB use different syntaxes for the same functionalities, such as pagination. Oracle uses the `rownum` keyword, while TiDB uses the `limit` keyword. Therefore, parameters need to be converted and modified according to different usages. In other embodiments, the server performs any one of the corresponding conversions or parameter modifications to obtain the initial database data.

[0084] Optionally, the server takes into account the special properties of Oracle databases such as configuration views, stored procedures, and sequence numbers, and performs conversion and replacement on views and sequence numbers, marks irreplaceable items, and outputs prompts for manual modification, thereby achieving the target database data.

[0085] For example, in combination Figure 3 As shown, Figure 3 This diagram illustrates a database conversion process in one embodiment. The file to be converted is the database data that has already undergone framework conversion, i.e., the target framework database data. The dialect conversion controller represents the specific process of database conversion. This is because SQL dialects themselves may differ from standard SQL, thus requiring the judgment of various factors, such as field types (time conversion format, precision, and number of digits, etc.), function dialects, and limit dialects. Since this implementation mainly converts SQL mapping files and cannot form a logical tree for the entire SQL dialect, a line-by-line conversion method is used to update the SQL dialect. Areas that cannot be completely updated are marked, and finally, a small amount of manual modification is used to complete the overall update.

[0086] In the above embodiments, the server modifies the data by changing the syntax and target transformation information, enabling database updates with minimal code changes.

[0087] In one embodiment, the above method further includes: performing keyword matching and replacement on the target database data to obtain the target data result.

[0088] The target data result refers to the final output database data. Optionally, the server can use regular expressions to match keywords, compare them, and update accordingly. It can select an appropriate regular expression to match whether the keyword to be changed is present, and if so, perform the corresponding replacement.

[0089] For example, the Oracle `to_char` function might exhibit the following behaviors:

[0090] a.to_char(field_name, 'FM00000000')

[0091] b.to_char(field_name, 'yyyyMMdd')

[0092] c.to_char(field_name,'yyyy-mm-dd hh24:mi:ss')

[0093] d.to_char(field_name, 'yyyy-mm-dd hh24:mi:ss.ff3')

[0094] f.to_char(field_name, 'dd')

[0095] e.to_char(field_name, 'd')

[0096] g.to_char(field_name, ddd')

[0097] For functions like `h.to_char(field_name, 'Q')`, which can have multiple meanings, the regular expression `to_char` can be used to match date formats. Here, `tochar` matches the function name, and `(d|dd|ddd|q)` represents the various possible matching methods, thus enabling the identification and retrieval of the appropriate match.

[0098] In the above embodiments, the server uses regular expressions to match keywords and perform comparisons and corresponding updates. It selects appropriate regular expressions to match whether the keywords that need to be changed are contained, so as to complete the parsing and adaptation of SQL statements.

[0099] In one exemplary embodiment, such as Figure 4 As shown, a method for converting Oracle databases to TiDB is provided.

[0100] S402. Obtain the XML file of iBatis to be converted.

[0101] S404. Convert iBatis to MyBatis. Specifically, the iBatis XML configuration information, including hierarchical structure-related attributes and child node collections, is used to obtain the object tree of the XML file; the parameter values ​​of each level are obtained, adapted to the Mybatis syntax tree, and the root node attributes of each level are populated; the node elements under each level are processed step by step, adapting to Mybatis's characteristics for different functions, object mappings, etc.

[0102] S406, SQL dialect conversion. It retrieves the SQL dialect to be converted line by line, along with the corresponding attribute configuration information; based on the configuration information, it uses a regular expression parsing syntax model; and uses the SQL dialect conversion master to generate the target SQL dialect.

[0103] S408. Output conversion results, outputting any problems encountered during the conversion process.

[0104] In the above embodiments, the XML mapping file adaptation and update method can effectively help R&D personnel reduce the repetitive work of SQL dialect conversion. In particular, the industry currently lacks such a conversion tool that can provide batch, repeatable, and easy-to-use conversion. It can quickly realize the migration and matching from Oracle database to the domestic database TiDB, thereby saving a lot of manpower costs. After multiple uses and optimizations, more matching details have been improved, and it has great value for promotion and application.

[0105] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0106] Based on the same inventive concept, this application also provides a database conversion apparatus for implementing the database conversion method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more database conversion apparatus embodiments provided below can be found in the limitations of the database conversion method described above, and will not be repeated here.

[0107] In one embodiment, such as Figure 5 As shown, a database conversion device is provided, including: an acquisition module 100, a parsing module 200, an update module 300, and a conversion module 400, wherein:

[0108] Module 100 is used to obtain the database data to be converted.

[0109] The parsing module 200 is used to parse the data in the transformation database to obtain the node set and the hierarchical attributes of each node.

[0110] The update module 300 is used to update the node set according to the adaptability corresponding to the hierarchical attributes, and obtain the target framework database data.

[0111] The conversion module 400 is used to convert the target framework database data according to the target data configuration information to obtain the target database data.

[0112] In one embodiment, the above-mentioned update module includes:

[0113] The first update submodule is used to update the node set according to the hierarchical attributes when the adaptability corresponding to the hierarchical attributes is supported, so as to obtain the target framework database data.

[0114] The second update submodule adds a prompt message to the node set when the adaptability of the corresponding hierarchical attribute is not supported, and obtains the target framework database data.

[0115] In one embodiment, the first update submodule mentioned above includes:

[0116] The tag update unit is used to update the tags of the node set according to the node type when the current node's hierarchical attribute is a first-level tag, so as to obtain the target framework database data.

[0117] The information update unit is used to update the information of the node set according to the node type of the current node when the hierarchical attribute of the current node is a second-level label, so as to obtain the target framework database data.

[0118] In one embodiment, the above conversion module includes:

[0119] The modification submodule is used to make syntax changes to the target framework database data based on the target data configuration information to obtain the initial database data.

[0120] The modification submodule is used to obtain target transformation information based on the initial database data, and then modify the target transformation information to obtain the target database data.

[0121] In one embodiment, the above-mentioned apparatus further includes:

[0122] The matching module is used to perform keyword matching and replacement on the target database data to obtain the target data result.

[0123] The replacement module is used to replace data based on the matching results to obtain the target database data.

[0124] Each module in the aforementioned database conversion device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0125] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores database data for conversion. The I / O interfaces allow the processor to exchange information with external devices. The communication interface allows communication with external terminals via a network connection. When executed by the processor, the computer program implements a database conversion method.

[0126] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0127] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: acquiring database data to be converted; parsing the database data to be converted to obtain a set of nodes and the hierarchical attributes of each node; updating the node set according to the adaptability corresponding to the hierarchical attributes to obtain target framework database data; and converting the target framework database data according to the target data configuration information to obtain target database data.

[0128] In one embodiment, the processor, when executing a computer program, updates the node set according to the adaptability corresponding to the hierarchical attributes to obtain target framework database data, including:

[0129] When the adaptability corresponding to the hierarchical attribute is supported, the node set is updated according to the hierarchical attribute to obtain the target framework database data;

[0130] When the adaptability of the corresponding hierarchical attribute is not supported, add a prompt message to the node set and obtain the target framework database data.

[0131] In one embodiment, the process of updating a node set based on hierarchical attributes to obtain target frame database data when the processor executes a computer program includes: when the hierarchical attribute of the current node is a first-level label, updating the node set with labels based on the node type of the current node to obtain target frame database data; when the hierarchical attribute of the current node is a second-level label, updating the node set with information based on the node type of the current node to obtain target frame database data.

[0132] In one embodiment, the process of a processor executing a computer program to perform database transformation on target framework database data based on target data configuration information to obtain target database data includes: modifying the syntax of the target framework database data according to the target data configuration information to obtain initial database data; obtaining target transformation information based on the initial database data; and modifying the target transformation information to obtain target database data.

[0133] In one embodiment, the processor, when executing the computer program, further performs the following: keyword matching and replacement on the target database data to obtain the target data result.

[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it performs the following steps: acquiring database data to be converted; parsing the database data to be converted to obtain a set of nodes and the hierarchical attributes of each node; updating the node set according to the adaptability corresponding to the hierarchical attributes to obtain target framework database data; and converting the target framework database data according to the target data configuration information to obtain target database data.

[0135] In one embodiment, when a computer program is executed by a processor, it updates the frame of a node set based on the adaptability corresponding to the hierarchical attribute to obtain target frame database data. This includes: when the adaptability corresponding to the hierarchical attribute is supported, updating the frame of the node set based on the hierarchical attribute to obtain target frame database data; and when the adaptability corresponding to the hierarchical attribute is not supported, adding prompt information to the node set to obtain target frame database data.

[0136] In one embodiment, when a computer program is executed by a processor, it performs a frame update on a node set based on hierarchical attributes to obtain target frame database data, including: when the hierarchical attribute of the current node is a first-level label, updating the node set with labels based on the node type of the current node to obtain target frame database data; when the hierarchical attribute of the current node is a second-level label, updating the node set with information based on the node type of the current node to obtain target frame database data.

[0137] In one embodiment, when a computer program is executed by a processor, it performs database transformation on target framework database data according to target data configuration information to obtain target database data, including: modifying the syntax of the target framework database data according to the target data configuration information to obtain initial database data; obtaining target transformation information based on the initial database data; and modifying the target transformation information to obtain target database data.

[0138] In one embodiment, when the computer program is executed by the processor, it further includes: performing keyword matching and replacement on the target database data to obtain the target data result.

[0139] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: acquiring database data to be converted; parsing the database data to be converted to obtain a set of nodes and the hierarchical attributes of each node; updating the node set according to the adaptability corresponding to the hierarchical attributes to obtain target framework database data; and converting the target framework database data according to the target data configuration information to obtain target database data.

[0140] In one embodiment, when a computer program is executed by a processor, it updates the frame of a node set based on the adaptability corresponding to the hierarchical attribute to obtain target frame database data. This includes: when the adaptability corresponding to the hierarchical attribute is supported, updating the frame of the node set based on the hierarchical attribute to obtain target frame database data; and when the adaptability corresponding to the hierarchical attribute is not supported, adding prompt information to the node set to obtain target frame database data.

[0141] In one embodiment, when a computer program is executed by a processor, it performs a frame update on a node set based on hierarchical attributes to obtain target frame database data, including: when the hierarchical attribute of the current node is a first-level label, updating the node set with labels based on the node type of the current node to obtain target frame database data; when the hierarchical attribute of the current node is a second-level label, updating the node set with information based on the node type of the current node to obtain target frame database data.

[0142] In one embodiment, when a computer program is executed by a processor, it performs database transformation on target framework database data according to target data configuration information to obtain target database data, including: modifying the syntax of the target framework database data according to the target data configuration information to obtain initial database data; obtaining target transformation information based on the initial database data; and modifying the target transformation information to obtain target database data.

[0143] In one embodiment, when the computer program is executed by the processor, it further includes: performing keyword matching and replacement on the target database data to obtain the target data result.

[0144] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0145] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0146] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.< / iterate>

Claims

1. A database conversion method, characterized in that, The method includes: Obtain the database data to be converted; the database data to be converted refers to the data that needs to be converted. The database data to be converted is parsed to obtain a set of nodes and the hierarchical attributes of each node; the set of nodes refers to the nodes after parsing the database data to be converted; the hierarchical attributes refer to the hierarchical type and tag type corresponding to each node, and the hierarchical type is the relationship between each node; The node set is updated according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data. Based on the target data configuration information, the target framework database data is transformed to obtain the target database data; The step of updating the node set according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data includes: When the adaptability corresponding to the hierarchical attribute is supported, the node set is updated according to the hierarchical attribute to obtain the target framework database data; When the adaptability corresponding to the hierarchical attribute is not supported, add the prompt information of the node set to obtain the target framework database data.

2. The method according to claim 1, characterized in that, The step of updating the node set according to the hierarchical attributes to obtain the target framework database data includes: When the current node's hierarchy attribute is a first-level label, the label of the node set is updated according to the node type of the current node to obtain the target framework database data; When the hierarchical attribute of the current node is a second-level label, the information of the node set is updated according to the node type of the current node to obtain the target framework database data.

3. The method according to claim 1, characterized in that, The step of performing database transformation on the target framework database data according to the target data configuration information to obtain the target database data includes: Based on the target data configuration information, the target framework database data is syntactically modified to obtain the initial database data; The target transformation information is obtained from the initial database data, and then modified according to the target transformation information to obtain the target database data.

4. The method according to claim 1, characterized in that, The method further includes: The target database data is matched with keywords and then replaced to obtain the target data result.

5. A database conversion device, characterized in that, The device includes: The acquisition module is used to acquire database data to be converted; the database data to be converted refers to the data that needs to be converted. The parsing module is used to parse the data in the transformation database to obtain a set of nodes and the hierarchical attributes of each node; the set of nodes refers to the nodes after parsing the data in the database to be transformed; the hierarchical attributes refer to the hierarchical type and tag type corresponding to each node, and the hierarchical type is the relationship between each node; The update module is used to update the node set according to the adaptability corresponding to the hierarchical attributes to obtain the target framework database data; The conversion module is used to perform database conversion on the target framework database data according to the target data configuration information to obtain the target database data. The update module includes: The first update submodule is used to update the node set according to the hierarchical attribute when the adaptability corresponding to the hierarchical attribute is supported, so as to obtain the target framework database data. The second update submodule adds a prompt message to the node set when the adaptability corresponding to the hierarchical attribute is not supported, and obtains the target framework database data.

6. The apparatus according to claim 5, characterized in that, The first update submodule includes: The tag update unit is used to update the tags of the node set according to the node type of the current node when the hierarchical attribute of the current node is a first-level tag, so as to obtain the target framework database data. The information update unit is used to update the information of the node set according to the node type of the current node when the hierarchical attribute of the current node is a second-level label, so as to obtain the target framework database data.

7. The apparatus according to claim 5, characterized in that, The conversion module includes: The modification submodule is used to perform syntax changes on the target framework database data according to the target data configuration information to obtain the initial database data. The modification submodule is used to obtain target transformation information based on the initial database data, and modify the target transformation information to obtain the target database data.

8. The apparatus according to claim 5, characterized in that, The device further includes: The matching module is used to perform keyword matching and replacement on the target database data to obtain the target data result; The replacement module is used to replace data based on the matching results to obtain the target database data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data conversion method and device, computer equipment and medium

    CN114116877A

  • Virtual aggregation

    US20170193022A1