CN116257578A - Database conversion method, device, computer equipment and storage medium - Google Patents

Database conversion method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116257578A
CN116257578A CN202310190060.3A CN202310190060A CN116257578A CN 116257578 A CN116257578 A CN 116257578A CN 202310190060 A CN202310190060 A CN 202310190060A CN 116257578 A CN116257578 A CN 116257578A
Authority
CN
China
Prior art keywords
database data
target
node
conversion
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310190060.3A
Other languages
Chinese (zh)
Inventor
陈悌宇
张翱
唐承志
朱惠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202310190060.3A priority Critical patent/CN116257578A/en
Publication of CN116257578A publication Critical patent/CN116257578A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of big data, and discloses a database conversion method, a database conversion device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring database data to be converted; analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node; performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data; and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data. By adopting the method, the database conversion can be carried out more smoothly.

Description

Database conversion method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of big data technology, and in particular, to a database conversion method, apparatus, computer device, storage medium, and computer program product.
Background
The world informatization technology greatly promotes the development of the national information industry, and the database is widely applied as the most basic and key basic software in the informatization system. Because the existing managed service has the characteristics of huge stock data, more active data, quick service growth and the like, the factors of execution efficiency, grammar compatibility, performance verification, system architecture and the like related to the update of the domestic database are comprehensively analyzed, and in the related technology, the domestic distributed database TiDB is selected ( Novel distributed database combining characteristics of traditional relational database and NoSQL database ) Replacing the existing Oracle (Oracle RDBMS, relational database) database. The currently mainstream data persistence layer framework MyBatis realizes the improvement of interface binding and object relation mapping on the basis of iBatis (combination of internet and abatis, open source code project initiated by ClintonBegin in 2001), so that the replacement of Oracle into TiDB mainly involves the upgrading of persistence layer database framework and the conversion from Oracle into TiDB database.
The existing SQL (Structured Query Language, structured query statement) language conversion technical means generally only relates to SQL dialect conversion among databases and even changes the existing service codes, and can not smoothly transfer the XML (EXtensible Markup Language ) mapping supporting Oracle to an XML mapping framework supporting TiDB, so as to complete the compatibility of SQL statements in different databases.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a database conversion method, apparatus, computer device, computer readable storage medium, and computer program product that enable smoother database conversion.
In a first aspect, the present application provides a database conversion method. The method comprises the following steps:
acquiring database data to be converted;
analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node;
performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data;
and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
In one embodiment, the updating the frame of the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain the target frame database data includes:
when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data;
and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding the prompt information of the node set to obtain target frame database data.
In one embodiment, the updating the frame of the node set according to the hierarchy attribute to obtain the target frame database data includes:
when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data;
and when the hierarchy attribute of the current node is a secondary label, updating information of the node set according to the node type of the current node to obtain target frame database data.
In one embodiment, the database conversion of the target frame database data according to the target data configuration information to obtain target database data includes:
according to the target data configuration information, grammar change is carried out on the target frame database data to obtain initial database data;
and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain the target database data.
In one embodiment, the method further comprises:
and matching keywords of the target database data and replacing the target database data to obtain a target data result.
In a second aspect, the present application further provides a database conversion apparatus. The device comprises:
the acquisition module is used for acquiring database data to be converted;
the analysis module is used for analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node;
the updating module is used for updating the frames of the node sets according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data;
and the conversion module is used for carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
In one embodiment, the updating module includes:
the first updating sub-module is used for updating the frame of the node set according to the hierarchy attribute to obtain target frame database data when the adaptation degree corresponding to the hierarchy attribute is supported;
and the second updating sub-module is used for adding the prompt information of the node set when the adaptation degree corresponding to the hierarchical attribute is not supported, so as to obtain the target frame database data.
In one embodiment, the first update sub-module includes:
the label updating unit is used for updating the label of the node set according to the node type of the current node when the level attribute of the current node is a primary label, so as to obtain target frame database data;
and the information updating unit is used for updating the information of the node set according to the node type of the current node when the hierarchy attribute of the current node is a secondary label, so as to obtain the target frame database data.
In one embodiment, the conversion module includes:
the modification submodule is used for carrying out grammar modification on the target frame database data according to the target data configuration information to obtain initial database data;
and the modification sub-module is used for obtaining target conversion information according to the initial database data and modifying according to the target conversion information to obtain the target database data.
In one embodiment, the apparatus further includes:
and the matching module is used for carrying out keyword matching and replacement on the target database data to obtain a target data result.
And the replacement module is used for replacing according to the matching result to obtain the target database data.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the method of any of the embodiments described above when the processor executes the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method of any of the embodiments described above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, implements the method of any of the embodiments described above.
The database conversion method, the database conversion device, the computer equipment, the storage medium and the computer program product are characterized in that the server analyzes the converted database data to obtain the node set and the hierarchical attribute of each node, then the node set is subjected to frame updating according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data, and finally the target frame database data is subjected to database conversion according to the target data configuration information to obtain the target database data. Firstly, after the database conversion is carried out, the server carries out frame conversion on the database to be converted, so that the modification of codes is not needed during the database conversion, and the conversion can be carried out more smoothly; secondly, the server combines the hierarchy attribute when performing frame conversion, so that the frame conversion process can be more accurate.
Drawings
FIG. 1 is a flow diagram of a database conversion method in one embodiment;
FIG. 2 is a flow chart of a frame conversion method in one embodiment;
FIG. 3 is a schematic diagram of database conversion in another embodiment;
FIG. 4 provides a schematic diagram of a database conversion method from Oracle to TiDB;
FIG. 5 is a block diagram of a database conversion apparatus in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a database conversion method is provided, including the steps of:
s102, obtaining database data to be converted.
The database data to be converted refers to data that needs to be converted into a database, for example, an XML (EXtensible Markup Language ) mapping file of iBatis.
Optionally, after acquiring the data to be converted, the server also needs to acquire frame information between the frame of the current data to be converted and the target frame. The frame information may include a syntax difference between a frame of the current data to be converted and the target frame to obtain a fitness of different nodes. The adaptation degree refers to a degree of support of whether frame conversion is supported.
S104, analyzing the database data to be converted to obtain a node set and the hierarchical attribute of each node.
The node set refers to all nodes after the database data to be converted are analyzed, and the nodes can comprise annotation nodes, text nodes, element nodes and other types of nodes. The hierarchy attribute refers to a hierarchy type and a label type corresponding to each node, wherein the hierarchy type is a relation among the nodes, such as a parent-child relation among the nodes; the label type refers to a label level of a node, such as a primary label, a secondary label, and the like. Illustratively, the primary labels are mainly used to represent the type of SQL statement, such as select, update, delete, etc., while the secondary labels are mainly used for the content of SQL statement, such as operations of judging whether a field is empty or not and loop assignment judgment on a set.
Illustratively, after obtaining the database data to be converted, the server uses the SAXReader analyzer to analyze the hierarchical attribute and the child node set of the original XML file to form an object tree corresponding to the database data to be converted. The SAXRead parser is a DOM parser for creating a complete XML file tree.
And S106, carrying out frame updating on the node set according to the adaptation degree corresponding to the hierarchy attribute to obtain target frame database data.
The target frame database data refers to data obtained by converting database data to be converted into target frame data, and by converting SQL mapping files of the iBatis persistence frame into Mybatis frames.
Optionally, the server may obtain a root node through the hierarchy attribute, and traverse upwards from the root node, and sequentially update the frame in combination with the adaptation degree corresponding to each node, so as to obtain the target frame database data.
Alternatively, the server may add the root node to the target XML parser to traverse from the root node through the XML parser to convert according to the corresponding fitness of each node.
Illustratively, in this embodiment, the root node is DocType, XMLEncoding, rootNodeComment, NAMESPACE, and the server adds the root node to the XML parser, and the XML parser performs frame update according to the adaptation degree corresponding to each node, so as to obtain the target frame database data.
Further, the server judges the node type corresponding to each node and then carries out frame conversion by combining proper matching degree. Illustratively, the server may label the nodes of the element type for frame conversion.
And S208, carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
The target data configuration information may be preset difference information between different types of data, for example, comparing syntax operation manuals of Oracle and TiDB, collecting adaptive update items of Oracle and TiDB, which are different in syntax, and forming a corresponding update scheme.
Optionally, the server firstly performs grammar conversion and parameter modification on the target frame database data according to the target data configuration information, and then performs information modification to obtain the target database data.
Alternatively, the server may translate the target frame database data row by row, since the target database data cannot form a logical tree, and thus update the target frame data in a row by row translation manner.
Illustratively, oracle is different from TiDB in the same functional representation in terms of syntax, such as paging operations, where Oracle uses a rowum key and TiDB uses a limit key, thus requiring conversion and modification of parameters according to unused usage.
For example, due to the special nature of the configuration view, storage procedure, serial number, etc. of the Oracle database, information modification is required to obtain the target database data.
In the database conversion method, the server analyzes the conversion database data to obtain the node set and the hierarchical attribute of each node, then frames the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain the target frame database data, and finally, the target frame database data is subjected to database conversion according to the target data configuration information to obtain the target database data. Firstly, after the database conversion is carried out, the server carries out frame conversion on the database to be converted, so that the modification of codes is not needed during the database conversion, and the conversion can be carried out more smoothly; secondly, the server combines the hierarchy attribute when performing frame conversion, so that the frame conversion process can be more accurate.
In one embodiment, performing frame update on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data, including: when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data; and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding prompt information of the node set to obtain target frame database data.
Optionally, when the adaptation degree corresponding to the hierarchical attribute is supported, the server may perform frame update on each node in the node set according to the hierarchical attribute, and perform frame update on the node set according to the tag type in the hierarchical attribute, to obtain the target frame database data. For example, the server firstly carries out frame update on the parent node, and then sequentially carries out frame update on the child nodes of the parent node until all nodes in the node set are updated.
Optionally, when the adaptation degree corresponding to the hierarchy attribute is not supported, the server may add the prompt information to the corresponding node, for example, the Mybatis corresponding to the label as a cache, and there are differences in usage, such as inconvenient conversion, mybatis official network suggesting that the label is no longer used, and so on. In other embodiments, the technician may be prompted for manual updates by the prompt.
Optionally, the server may obtain the fitness corresponding to the hierarchy attribute through a preset fitness table. Exemplary, table 1 is the support of tags by the Batis and Mybatis frameworks in one embodiment, as shown in table 1.
TABLE 1
Figure BDA0004105197620000071
In the above embodiment, the server updates the frame according to the adaptation degree corresponding to the hierarchy attribute, so that the frame conversion can be simply and efficiently completed.
In one embodiment, the updating the frame of the node set according to the hierarchy attribute to obtain the target frame database data includes: when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data; and when the hierarchy attribute of the current node is a secondary label, updating the information of the node set according to the node type of the current node to obtain the target frame database data.
Optionally, the primary labels are SQL nodes, result maps, select, insert, delete, updata, statment and type Alias nodes; the secondary label has a result, dynamic, isNotEmpty, isNotNull, isNull, isEmpty, iterate, isParameterPresent, selectKey, include, isEqual, isNotEqual, isGreaterThan, isGreaterEqual, isLessThan, isLessEqual node. The primary label is mainly used for representing the type of the SQL statement, such as select, update, delete, and the secondary label is mainly used for judging whether a field is empty or not, and performing operations such as loop assignment judgment on a set.
Taking sql map- > mapper as an example, the sql map- > mapper corresponds to the name of the configuration file, and the sql map is directly replaced by the mapper. select then corresponds to the primary tag whose corresponding id attribute name does not change, but the attribute name: the return type and parameter type are upgraded from resultClass, parameterClass to resultType, parameterType; the second-level label also needs to complete replacement and new grammar according to the attribute name, such as the new addition of a sphere label, judgment of whether the non-empty isNotNull label is converted into an if label for judging empty, and attribute replacement and variable replacement of a cyclic label < item >.
In the above embodiment, the server performs different conversions on the primary label and the secondary label, respectively, so as to perform accurate conversion.
In one exemplary embodiment, as shown in FIG. 2, a schematic diagram of a frame conversion method is provided. The server firstly summarizes definition rules and conversion rules of all labels by comparing grammar trees between the two, for the conversion of the first-stage labels, the judgment can be carried out through the names of the first-stage labels shown in the graph, and attribute information corresponding to the first-stage labels corresponding to Mybatis is added, for the conversion of the second-stage labels, various conditions are required to be considered, the second-stage labels comprise result, dynamic, isNotEmpty, isNotNull, isNull, isEmpty, iterate, isParameterPresent, selectKey, include, isEqual, isNotEqual, isGreaterThan, isGreaterEqual, isLessThan, isLessEqual, and the attribute of the father node of the current node is required to be considered when the second-stage labels are processed, so that omission of the adaptation condition is avoided.
In one embodiment, performing database conversion on target frame database data according to target data configuration information to obtain target database data, including: carrying out grammar change on the target frame database data according to the target data configuration information to obtain initial database data; and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain target database data.
The target conversion information is information with special properties such as configuration view, storage process and serial number.
Optionally, the server first makes a grammar change to the target frame according to the target data configuration information, and illustratively, the grammar expressions of Oracle and TiDB on the same functional expression are different, such as paging operation, oracle uses a rowum keyword, and TiDB uses a limit keyword, so that the parameters need to be converted and changed according to the unused usage. In other embodiments, the server performs any one of the corresponding conversion or modification parameters to obtain the initial database data.
Optionally, the server converts and replaces views, serial numbers and the like according to special properties such as configuration views, storage processes, serial numbers and the like existing in the Oracle database, marks non-replaceable items, outputs prompts for manual modification, and further achieves the aim of target database data.
For example, referring to fig. 3, fig. 3 is a schematic diagram of database conversion in an embodiment, where a file to be converted is database data that has completed a frame conversion, that is, target frame database data, where dialect conversion is a specific process of database conversion. Because the SQL dialect itself may have a difference from the standard SQL, multiple factors such as field types (time conversion format, accuracy, bit number and the like), function dialects, limit dialects and the like need to be judged, and because the SQL mapping file is mainly converted and a logic tree cannot be formed for the whole SQL dialect in the implementation, the updating of the SQL dialect is realized in a line-by-line conversion mode, places which cannot be updated are marked, and finally, the whole updating is completed in a mode of small amount of manual modification.
In the above embodiment, the server is able to update the database at the cost of the least modified code by modifying the grammar and the target conversion information.
In one embodiment, the method further comprises: and matching keywords of the target database data and replacing the target database data to obtain a target data result.
The target data result refers to the finally output database data. Optionally, the server can match out the keywords through the regular expression, compare and update correspondingly, select a proper regular expression, match out whether the keywords need to be changed or not, and if yes, finish the corresponding replacement.
By way of example, for the oracle to_char function, the following expressions may occur:
to_char (field name, 'FM 00000000')
To_char (field name, 'yyyMMdd')
c.to_char (field name, 'yyyy-mm-dd hh24: mi: ss')
d.to_char (field name, 'yyyy-mm-dd hh24: mi: ss.ff3')
f.to_char (field name, 'dd')
e.to_char (field name,'d')
g.to_char (field name, ddd')
For various meanings of a function, the regular expression of to_char_char/s ((..times..
In the above embodiment, the server matches the keywords with the regular expressions, compares and updates the keywords, selects a proper regular expression, and matches whether the keywords need to be changed or not to complete the analysis and adaptation of the SQL sentence.
In one exemplary embodiment, as shown in FIG. 4, a database conversion method of Oracle to TiDB is provided.
S402, acquiring an XML file of the iBatis to be converted.
S404, converting the iBatis into MyBatis. Specifically, configuration information of XML of iBatis comprises related attributes of a hierarchical structure and a child node set, and an object tree of an XML file is obtained; acquiring parameter values of each level, adapting Mybatis grammar tree, and filling root node attributes of each level; node elements under each level are processed step by step, and the characteristics of different functions, object mapping and the like are converted by adapting Mybatis.
S406, SQL dialect conversion. Acquiring SQL dialects to be converted line by line and corresponding attribute configuration information; according to the configuration information, a regular expression is adopted to analyze a grammar model; the target SQL dialect is generated using the SQL dialect conversion master.
S408, outputting a conversion result, and outputting the problems encountered in the conversion process.
In the embodiment, the adaptation updating method of the XML mapping file can effectively help research personnel to reduce the repeatability of SQL dialect conversion, and particularly the conversion tool which can provide batch, repeated execution, simplicity and easiness in use is lacking in the current industry, so that migration matching from an Oracle database to a domestic database TiDB can be rapidly realized, a great deal of labor cost is saved, more matching details are perfected through multiple times of use and optimization, and the method has good popularization and application values.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a database conversion device for realizing the above related database conversion method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the database conversion device or devices provided below may be referred to the limitation of the database conversion method hereinabove, and will not be described herein.
In one embodiment, as shown in fig. 5, there is provided a database conversion apparatus including: the device comprises an acquisition module 100, a parsing module 200, an updating module 300 and a conversion module 400, wherein:
the acquiring module 100 is configured to acquire database data to be converted.
The parsing module 200 is configured to parse the converted database data to obtain a node set and a hierarchical attribute of each node.
And the updating module 300 is used for updating the frames of the node set according to the adaptation degree corresponding to the hierarchy attribute to obtain the target frame database data.
The conversion module 400 is configured to perform database conversion on the target frame database data according to the target data configuration information, so as to obtain target database data.
In one embodiment, the updating module includes:
and the first updating sub-module is used for updating the frame of the node set according to the hierarchy attribute to obtain the target frame database data when the adaptation degree corresponding to the hierarchy attribute is supported.
And the second updating sub-module is used for adding prompt information of the node set when the adaptation degree corresponding to the hierarchy attribute is not supported, so as to obtain the target frame database data.
In one embodiment, the first update sub-module includes:
and the label updating unit is used for updating the label of the node set according to the node type of the current node when the level attribute of the current node is a primary label, so as to obtain the target frame database data.
And the information updating unit is used for updating 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 secondary label, so as to obtain the target frame database data.
In one embodiment, the conversion module includes:
and the modification submodule is used for carrying out grammar modification on the target frame database data according to the target data configuration information to obtain initial database data.
And the modification sub-module is used for obtaining target conversion information according to the initial database data and modifying according to the target conversion information to obtain target database data.
In one embodiment, the apparatus further comprises:
and the matching module is used for carrying out keyword matching and replacement on the target database data to obtain a target data result.
And the replacement module is used for replacing according to the matching result to obtain the target database data.
The respective modules in the above database conversion apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing the band translation database data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a database conversion method.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of: acquiring database data to be converted; analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node; performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data; and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
In one embodiment, the framework updating of the node set according to the adaptation degree corresponding to the hierarchical attribute implemented when the processor executes the computer program, to obtain the target framework database data includes:
when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data;
and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding prompt information of the node set to obtain target frame database data.
In one embodiment, a method for updating a node set according to a hierarchy attribute implemented when a processor executes a computer program to obtain target frame database data includes: when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data; and when the hierarchy attribute of the current node is a secondary label, updating the information of the node set according to the node type of the current node to obtain the target frame database data.
In one embodiment, the database conversion of the target frame database data according to the target data configuration information implemented when the processor executes the computer program, to obtain target database data, includes: carrying out grammar change on the target frame database data according to the target data configuration information to obtain initial database data; and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain target database data.
In one embodiment, the implementation of the computer program when executed by the processor further includes: and matching keywords of the target database data and replacing the target database data to obtain a target data result.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring database data to be converted; analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node; performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data; and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
In one embodiment, the method for updating the frame of the node set according to the adaptation degree corresponding to the hierarchical attribute implemented when the computer program is executed by the processor, to obtain the target frame database data includes: when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data; and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding prompt information of the node set to obtain target frame database data.
In one embodiment, a method for updating a node set according to a hierarchy attribute implemented when a computer program is executed by a processor to obtain target frame database data includes: when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data; and when the hierarchy attribute of the current node is a secondary label, updating the information of the node set according to the node type of the current node to obtain the target frame database data.
In one embodiment, a method for performing database conversion on target frame database data according to target data configuration information implemented when a computer program is executed by a processor to obtain target database data includes: carrying out grammar change on the target frame database data according to the target data configuration information to obtain initial database data; and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain target database data.
In one embodiment, the computer program when executed by the processor further comprises: and matching keywords of the target database data and replacing the target database data to obtain a target data result.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of: acquiring database data to be converted; analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node; performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data; and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
In one embodiment, the method for updating the frame of the node set according to the adaptation degree corresponding to the hierarchical attribute implemented when the computer program is executed by the processor, to obtain the target frame database data includes: when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data; and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding prompt information of the node set to obtain target frame database data.
In one embodiment, a method for updating a node set according to a hierarchy attribute implemented when a computer program is executed by a processor to obtain target frame database data includes: when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data; and when the hierarchy attribute of the current node is a secondary label, updating the information of the node set according to the node type of the current node to obtain the target frame database data.
In one embodiment, a method for performing database conversion on target frame database data according to target data configuration information implemented when a computer program is executed by a processor to obtain target database data includes: carrying out grammar change on the target frame database data according to the target data configuration information to obtain initial database data; and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain target database data.
In one embodiment, the computer program when executed by the processor further comprises: and matching keywords of the target database data and replacing the target database data to obtain a target data result.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (13)

1. A method of database conversion, the method comprising:
acquiring database data to be converted;
analyzing the database data to be converted to obtain a node set and the hierarchical attribute of each node;
performing frame updating on the node set according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data;
and carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
2. The method of claim 1, wherein the performing the frame update on the node set according to the fitness corresponding to the hierarchical attribute to obtain the target frame database data includes:
when the adaptation degree corresponding to the hierarchy attribute is supported, carrying out frame updating on the node set according to the hierarchy attribute to obtain target frame database data;
and when the adaptation degree corresponding to the hierarchy attribute is not supported, adding the prompt information of the node set to obtain target frame database data.
3. The method according to claim 2, wherein the performing a frame update on the node set according to the hierarchy attribute to obtain target frame database data includes:
when the hierarchy attribute of the current node is a first-level label, carrying out label updating on the node set according to the node type of the current node to obtain target frame database data;
and when the hierarchy attribute of the current node is a secondary label, updating information of the node set according to the node type of the current node to obtain target frame database data.
4. The method according to claim 1, wherein the database conversion of the target frame database data according to the target data configuration information to obtain target database data comprises:
according to the target data configuration information, grammar change is carried out on the target frame database data to obtain initial database data;
and obtaining target conversion information according to the initial database data, and modifying according to the target conversion information to obtain the target database data.
5. The method according to claim 1, wherein the method further comprises:
and matching keywords of the target database data and replacing the target database data to obtain a target data result.
6. A database conversion apparatus, the apparatus comprising:
the acquisition module is used for acquiring database data to be converted;
the analysis module is used for analyzing the conversion database data to obtain a node set and the hierarchical attribute of each node;
the updating module is used for updating the frames of the node sets according to the adaptation degree corresponding to the hierarchical attribute to obtain target frame database data;
and the conversion module is used for carrying out database conversion on the target frame database data according to the target data configuration information to obtain target database data.
7. The apparatus of claim 6, wherein the update module comprises:
the first updating sub-module is used for updating the frame of the node set according to the hierarchy attribute to obtain target frame database data when the adaptation degree corresponding to the hierarchy attribute is supported;
and the second updating sub-module is used for adding the prompt information of the node set when the adaptation degree corresponding to the hierarchical attribute is not supported, so as to obtain the target frame database data.
8. The apparatus of claim 7, wherein the first update sub-module comprises:
the label updating unit is used for updating the label of the node set according to the node type of the current node when the level attribute of the current node is a primary label, so as to obtain target frame database data;
and the information updating unit is used for updating the information of the node set according to the node type of the current node when the hierarchy attribute of the current node is a secondary label, so as to obtain the target frame database data.
9. The apparatus of claim 6, wherein the conversion module comprises:
the modification submodule is used for carrying out grammar modification on the target frame database data according to the target data configuration information to obtain initial database data;
and the modification sub-module is used for obtaining target conversion information according to the initial database data and modifying according to the target conversion information to obtain the target database data.
10. The apparatus of claim 6, wherein the apparatus further comprises:
the matching module is used for carrying out keyword matching and replacement on the target database data to obtain a target data result;
and the replacement module is used for replacing according to the matching result to obtain the target database data.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
CN202310190060.3A 2023-02-27 2023-02-27 Database conversion method, device, computer equipment and storage medium Pending CN116257578A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310190060.3A CN116257578A (en) 2023-02-27 2023-02-27 Database conversion method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310190060.3A CN116257578A (en) 2023-02-27 2023-02-27 Database conversion method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116257578A true CN116257578A (en) 2023-06-13

Family

ID=86678995

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310190060.3A Pending CN116257578A (en) 2023-02-27 2023-02-27 Database conversion method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116257578A (en)

Similar Documents

Publication Publication Date Title
CN111061757B (en) Language conversion method and device of database, electronic equipment and storage medium
US7219102B2 (en) Method, computer program product, and system converting relational data into hierarchical data structure based upon tagging trees
US10691682B2 (en) Storing and processing JSON documents in a SQL database table
US20220179876A1 (en) Metadata hub for metadata models of database objects
US7698257B2 (en) Apparatus and method for recursively rationalizing data source queries
CN110309196A (en) Block chain data storage and query method, apparatus, equipment and storage medium
CN107491561B (en) Ontology-based urban traffic heterogeneous data integration system and method
US8615526B2 (en) Markup language based query and file generation
CN107515887B (en) Interactive query method suitable for various big data management systems
US11693912B2 (en) Adapting database queries for data virtualization over combined database stores
US8695006B2 (en) Resource management method
US20130198605A1 (en) Document Merge Based on Knowledge of Document Schema
CN111078702B (en) SQL sentence classification management and unified query method and device
CN102982075A (en) Heterogeneous data source access supporting system and method thereof
CN111324577B (en) Yml file reading and writing method and device
CN110222110A (en) A kind of resource description framework data conversion storage integral method based on ETL tool
CN116011400A (en) Automatic generation method and device for project standard test document
CN108664546B (en) XML data structure conversion method and device
CN112346775B (en) Index data general processing method, electronic device and storage medium
US11645285B2 (en) Query engine for recursive searches in a self-describing data system
CN115080011B (en) Code generation method and system based on abstract syntax tree
CN116257578A (en) Database conversion method, device, computer equipment and storage medium
CN110806973A (en) Automatic generation method and device of interface message
CN115934716A (en) Method for importing Excel table data into database based on metadata definition and implementation
CN113342325A (en) Visual modeling method, system, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination