Method, device, medium and equipment for modifying data query statement

By parsing the database mapping file and data table set, the modification method of data query statements after database splitting is automatically determined, solving the problems of large workload and low accuracy of manual identification and modification, and realizing efficient and accurate modification of data query statements.

CN115309772BActive Publication Date: 2026-01-16PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211114506.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-14
Publication Date
2026-01-16
Estimated Expiration
2042-09-14

AI Technical Summary

Technical Problem

During the database splitting process, manually identifying and modifying data query statements that match the migrated data is labor-intensive and prone to omissions or incorrect modifications.

Method used

By parsing the data content of the data query statements from the mapping file of the database to be migrated, the set of data tables related to the target business system is obtained, and the modification method of the data query statements is automatically determined, including switching the data source, not modifying, or querying sequentially by data table dimension.

Benefits of technology

It enables automated and accurate identification and modification of data query statements, reducing manual intervention, improving work efficiency, and avoiding omissions and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309772B_ABST
    Figure CN115309772B_ABST
Patent Text Reader

Abstract

The application discloses a data query statement modification method, device, medium and equipment, the method comprises the following steps: obtaining a first data table set related to a target business system from a plurality of data tables in a to-be-migrated database; obtaining the data content of each data query statement included in a mapping file in the to-be-migrated database; determining the query data table of each data query statement according to the data content of the data query statement; and determining the modification mode of the data query statement according to the relationship between the query data table and the first data table set. The application automatically determines the modification mode of the data query statement according to the relationship between the query data table included in the data content of each data query statement and the first data table set related to the target business system, without missing cases, with high accuracy, and without the need for manual searching of the data query statement, thereby liberating manpower and improving work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a data query statement modification method and device, medium and equipment. BACKGROUND

[0002] With the increase of business systems, the data stored in the database is more and more, and the time of querying data is longer and longer, therefore, the decoupling and splitting of business systems are needed, that is, the database is split according to the business system. Database splitting is to migrate some data in the data table in the source database to a new database, after the data is migrated to the new database, the data query statement executed by the processing node in the business system is changed from accessing the source database to accessing the new database to obtain the migrated data.

[0003] Before the database splitting, there is a situation of multiple data table association query when the data query statement queries data, therefore, before the data migration, the data query statement related to the migrated data needs to be identified and the modification method of the data query statement needs to be determined.

[0004] At present, the content of the data query statement is found from the bottom code by manual method, the data query statement matched with the migrated data is identified and the modification method of the data query statement is determined. Due to the accumulation of a large number of businesses, the data query statement is relatively large, the manual carding workload is large, a lot of energy is consumed, and there are problems of omission or incorrect determination of the modification method.

[0005] Therefore, a method is needed to automatically determine the modification method of the data query statement matched with the migrated data during database migration. SUMMARY

[0006] Therefore, the present application provides a data query statement modification method, device, medium and equipment, which mainly aims to solve the problem that the modification method of the data query statement matched with the migrated data is determined by manually finding the data query statement during the database splitting, the manual finding workload is large, and there are problems of omission or incorrect determination of the modification method.

[0007] According to one aspect of the present application, a data query statement modification method is provided, which comprises:

[0008] Obtaining a first data table set related to a target business system from a plurality of data tables in a to-be-migrated database;

[0009] Parsing a mapping file of the to-be-migrated database to obtain data content of each data query statement included in the mapping file;

[0010] According to the data content of the data query statement, determining the query data table of each data query statement.

[0011] According to the relationship between the query data table and the first data table set, a modification manner of the data query statement is determined, and the data query statement is modified according to the modification manner.

[0012] Optionally, the obtaining of the first data table set related to the target business system from the plurality of data tables in the to-be-migrated database comprises:

[0013] The data table matched with the target business system is obtained from the plurality of data tables in the to-be-migrated database as the first data table set, and the remaining data tables in the to-be-migrated database are taken as the second data table set.

[0014] Optionally, the determining of the modification manner of the data query statement according to the relationship between the query data table and the first data table set comprises:

[0015] The query data table name of each data query statement, the first data table name corresponding to the first data table set, and the second data table name corresponding to the second data table set are obtained respectively;

[0016] According to the query data table name, the first data table name, and the second data table name, the data table set hit by each data query statement is identified;

[0017] According to the data table set hit by each data query statement, the modification manner of each data query statement is determined.

[0018] Optionally, the determining of the modification manner of the data query statement according to the hit data table set corresponding to each data query statement comprises:

[0019] If the data table set hit by the first data query statement is the first data table set, it is determined that the modification manner of the first data query statement is switched from accessing the to-be-migrated database to accessing the target database;

[0020] If the data table set hit by the second data query statement is the second data table set, it is determined that the modification manner of the second data query statement is not modified;

[0021] If the data table set hit by the third data query statement is the first data table set and the second data table set, it is determined that the modification manner of the third data query statement is to query data in sequence according to the data table dimension.

[0022] Optionally, the parsing of the mapping file of the to-be-migrated database to obtain the data content of each data query statement included in the mapping file comprises:

[0023] parsing the mapping file corresponding to each data table in the database to be migrated to obtain a document object of the mapping file;

[0024] obtaining an element node of each document object to obtain data content of each data query statement included in the mapping file corresponding to the document object.

[0025] Optionally, the element node of each document object is obtained to obtain the data content of each data query statement included in the mapping file corresponding to the document object, comprising:

[0026] for each document object, obtaining a root element node of the document object, obtaining each sub-element node of the root node element, and obtaining data content of a data query statement included in each sub-element node.

[0027] Optionally, the mapping file is parsed by using a SAXReader parser.

[0028] According to another aspect of the present application, a data query statement modification device is provided, comprising:

[0029] a data table set obtaining module configured to obtain a first data table set related to a target business system from a plurality of data tables in a database to be migrated;

[0030] a data content obtaining module configured to parse a mapping file of the database to be migrated to obtain data content of each data query statement included in the mapping file;

[0031] a query data table obtaining module configured to determine a query data table of each data query statement according to the data content of the data query statement;

[0032] a modification module configured to determine a modification mode of the data query statement according to a relationship between the query data table and the first data table set, and modify the data query statement according to the modification mode.

[0033] Optionally, the first data table set related to the target business system is obtained from a plurality of data tables in the database to be migrated, comprising:

[0034] obtaining a data table matching the target business system from the plurality of data tables in the database to be migrated as the first data table set, and obtaining remaining data tables in the database to be migrated as a second data table set.

[0035] Optionally, the modification mode of the data query statement is determined according to the relationship between the query data table and the first data table set, comprising:

[0036] Obtain the query data table name for each data query statement, the first data table name corresponding to the first data table set, and the second data table name corresponding to the second data packet set;

[0037] Based on the table name of the query data table, the table name of the first data table, and the table name of the second data table, identify the set of data tables hit by each data query statement;

[0038] Based on the set of data tables hit by each data query statement, determine the modification method for each data query statement.

[0039] Optionally, determining the modification method of the data query statement based on the set of hit data tables corresponding to each data query statement includes:

[0040] If the set of data tables hit by the first data query statement is the first set of data tables, then the modification method of the first data query statement is determined to be switching from accessing the database to be migrated to accessing the target database.

[0041] If the set of data tables hit by the second data query statement is the second data table set, then the modification method of the second data query statement is determined to be no modification;

[0042] If the set of data tables hit by the third data query statement is the first set of data tables and the second set of data tables, then the modification method of the third data query statement is determined to be querying data sequentially according to the data table dimensions.

[0043] Optionally, parsing the mapping file of the database to be migrated to obtain the data content of each data query statement included in the mapping file includes:

[0044] Parse the mapping file corresponding to each data table in the database to be migrated to obtain the document object of the mapping file;

[0045] For each document object, element nodes are obtained, and the data content of each data query statement included in the mapping file corresponding to the document object is obtained.

[0046] Optionally, the step of obtaining element nodes for each document object and obtaining the data content of each data query statement included in the mapping file corresponding to the document object includes:

[0047] For each document object, obtain the root element node of the document object, obtain each child element node of the root element, and obtain the data content of the data query statement included in each child element node.

[0048] Optionally, the SAXReader parser is used to parse the mapping file.

[0049] According to another aspect of this application, a storage medium is provided that stores at least one executable instruction, which causes a processor to perform the operation corresponding to the modification method of the above-described data query statement.

[0050] According to another aspect of this application, a computer device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0051] The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the modification method of the above data query statement.

[0052] By employing the above-described technical solutions, the technical solutions provided by the embodiments of the present invention have at least the following advantages:

[0053] This application provides a method, apparatus, device, and medium for modifying data query statements. By acquiring the data content of each data query statement included in the mapping file and the first set of data tables related to the target business system, the modification method of the data query statement is automatically determined based on the relationship between the query data table included in the data content of each data query statement and the first set of data tables. There are no omissions, the accuracy is high, and there is no need for manual searching of data query statements, which saves manpower and energy and improves work efficiency.

[0054] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0055] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0056] Figure 1 A flowchart illustrating a method for modifying a data query statement according to an embodiment of this application is shown;

[0057] Figure 2 A flowchart illustrating another method for modifying a data query statement provided in an embodiment of this application is shown;

[0058] Figure 3 Fig. 1 shows a flow chart of another method for modifying a data query statement according to an embodiment of the present application;

[0059] Figure 4 Fig. 2 shows a flow chart of another method for modifying a data query statement according to an embodiment of the present application;

[0060] Figure 5 Fig. 3 shows a flow chart of another method for modifying a data query statement according to an embodiment of the present application;

[0061] Figure 6 Fig. 4 shows a block diagram of a device for modifying a data query statement according to an embodiment of the present application;

[0062] Figure 7 Fig. 5 shows a structural schematic diagram of a computer device according to an embodiment of the present application.

[0063] In the formula, n is an integer greater than or equal to 1.

[0064] Figure 6 In the formula, 602 is a data table set obtaining module; 604 is a data content obtaining module; 606 is a query data table obtaining module; and 608 is a modifying module.

[0065] Figure 7 In the formula, 702 is a processor; 704 is a communication interface; 706 is a memory; 708 is a communication bus; and 710 is a program. DETAILED DESCRIPTION

[0066] The present application will be described in detail below with reference to the drawings and embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0067] In order to further illustrate the technical means and effects taken by the present application to achieve the predetermined purposes, the specific embodiments, structures, features and effects according to the present application will be described in detail below with reference to the drawings and preferred embodiments. In the following description, different "an embodiment" or "embodiments" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0068] In view of the problem that the current method for determining and migrating the modified data query statement matching the data query statement by manually searching the data query statement when the database is split, the manual searching work is large and there is a problem of omission or incorrect determination of the modification method, the present application provides a method for modifying a data query statement, as shown in Fig. 1, which comprises the following steps. Figure 1

[0069] ​102: obtaining a first data table set related to the target business system from a plurality of data tables in the database to be migrated;

[0070] In the embodiment of the present application, the target business system is the business system to be migrated, and the database migration is to migrate the data in the data table related to the target business system in the database to be migrated to a new database, also called the target database. Before the database is migrated, the data query statement executed by the processing node accesses the data table in the database to be migrated to obtain data. After the data is migrated, the query mode of the data query statement executed by some processing nodes changes, and the data query statement no longer accesses the database to be migrated, but accesses the new database. Therefore, at the same time or before the data is migrated, the data query statement whose query mode changes is determined and modified, and when the new database is put into use, the data is queried according to the correct data query mode, and then the required data is obtained.

[0071] Among them, the database to be migrated is a warehouse type database, which is used to store a large amount of or a mass of data in a business operation process, which includes but is not limited to the operation contents such as the code contents and the data contents of the insurance business, the product update, the claim operation, etc. The data stored in the database to be migrated can be public service data, customer data, etc. Since the types of data are numerous, the database splitting method includes but is not limited to the application scenarios such as public service, financial service, and logistics management.

[0072] In another embodiment of the present application, in order to further limit and illustrate, obtaining a first data table set related to the target business system from a plurality of data tables in the database to be migrated includes:

[0073] From the plurality of data tables in the database to be migrated, obtaining the data table matched with the target business system as the first data table set, and obtaining the remaining data tables in the database to be migrated as the second data table set.

[0074] In the embodiment, all the data tables in the database to be migrated matched with the target business system to be migrated are combined as the first data table set, and all the data tables not matched with the target business system to be migrated are combined as the second data table set. For example, the target business system to be migrated is an A business system, and there is at least one data table in the database to be migrated for storing the data generated when processing the task of the A business system. These data tables for storing the data generated when processing the task of the A business system are called data tables matched with the A business system, and the set formed by all the data tables matched with the A business system is the first data table set. The data table not storing the data generated when processing the task of the A business system is called the data table not matched with the A business system, and the set formed by all the data tables not matched with the A business system is the second data table set.

[0075] 104: parse the mapping file of the database to be migrated, and obtain data content of each data query statement included in the mapping file;

[0076] In the embodiment of the application, the data query statement is used to query the data table in the database to be migrated, and includes but is not limited to data generated in operation processes such as insurance business, product sales, product after-sales, product inventory management, and claim operation.

[0077] In another embodiment of the application, in order to further limit and illustrate, as shown in Figure 2 the mapping file of the database to be migrated is parsed, and data content of each data query statement included in the mapping file is obtained, including:

[0078] 202: parse the mapping file corresponding to each data table in the database to be migrated, and obtain a document object of the mapping file;

[0079] 204: obtain an element node of each document object, and obtain data content of each data query statement included in the mapping file corresponding to the document object.

[0080] In an embodiment of the application, the mapping file is parsed by using a SAXReader parser.

[0081] In an embodiment of the application, the mapper file is also called a mapping file, is used to store the SQL statement of the current system, and is an XML format file. In the database to be migrated, each data table corresponds to a mapper file. By using a SAXReader.Read method, a directory for storing the SQL statement of the current system is scanned, that is, the mapping file is parsed, a document object of the mapping file is obtained, and data content of each data query statement included in the document object is obtained.

[0082] In an embodiment of the application, the element node of each document object is obtained, and data content of each data query statement included in the mapping file corresponding to the document object is obtained, including:

[0083] For each document object, a root element node of the document object is obtained, each sub-element node of the root node element is obtained, and data content of the data query statement included in each sub-element node is obtained.

[0084] In the embodiment of the present application, for a document object, a root element node corresponding to the document object is acquired, the root element node is also called a mapper node, each root element node contains a plurality of sub-element nodes, each sub-element node contains a name, data content and id attribute of a data query statement, for example, the data query statement is an SQL statement, each sub-element node includes the name, data content and id attribute of the SQL statement. Each sub-element node is traversed to obtain the data content of each data query statement.

[0085] In one embodiment, each sub-element node content includes: (1) a current sql operation type, i.e., the name of the current node; (2) a current sql ID for identifying the modified point, i.e., the current node "ID" attribute value; and (3) the content of the current sql statement, i.e., the data content of the current node.

[0086] 106: According to the data content of the data query statement, the query data table of each data query statement is determined.

[0087] In the embodiment of the present application, for the data content of each data query statement, the query data table accessed when the data query statement queries data is extracted from the data content. The data query statement can be public service data, customer data, etc. Since the types of data are numerous, the database query method includes but is not limited to public service, financial service, logistics management and other application scenarios.

[0088] 108: According to the relationship between the query data table and the first data table set, the modification mode of the data query statement is determined, and the data query statement is modified according to the modification mode.

[0089] In the embodiment of the present application, for a data query statement, after the query data table of the data query statement is acquired, the modification mode of the data query statement is determined according to the relationship between the query data table of the data query statement and the first data table set, and the data query statement is modified according to the modification mode. The modified data query statement is used to query data in the data table in the to-be-migrated database and the target database according to the modification mode. In this way, the modification mode of each data query statement is determined in turn.

[0090] In the embodiment of the present application, each data query statement can also be acquired first, and after the query data tables of all data query statements are acquired, each data query statement is traversed to determine its modification mode by using its query data table and the above method until the modification modes of all data query statements are determined.

[0091] In another embodiment of the present application, in order to further limit and describe, Figure 3As shown, according to the relationship between the query data table and the first data table set, the modification mode of the data query statement is determined, including:

[0092] 302: The query data table table name of each data query statement, the first data table table name corresponding to the first data table set, and the second data table table name corresponding to the second data table set are acquired respectively;

[0093] 304: According to the query data table table name, the first data table table name and the second data table table name, the data table set hit by each data query statement is identified;

[0094] 306: According to the data table set hit by each data query statement, the modification mode of each data query statement is determined.

[0095] In the embodiment of the application, the data table table name of the first data table set and the data table table name of the second data table set are acquired, for each data query statement, the data query table of the data query statement is acquired according to the data content of the data query statement, the data table set hit by the data query table of the data query statement is identified based on the first data table set and the second data table set, the data table set is the data table in the first data table set and the second data table set whose table name hits the data query table, and the modification mode of the data query statement is further determined according to the data table set.

[0096] In the embodiment of the application, in order to further limit and illustrate, the modification mode of the data query statement is determined according to the hit data table set corresponding to each data query statement, including:

[0097] If the data table set hit by the first data query statement is the first data table set, it is determined that the modification mode of the first data query statement is switched from accessing the database to be migrated to accessing the target database;

[0098] If the data table set hit by the second data query statement is the second data table set, it is determined that the modification mode of the second data query statement is not modified;

[0099] If the data table set hit by the third data query statement is the first data table set and the second data table set, it is determined that the modification mode of the third data query statement is to query data in turn according to the data table dimension.

[0100] In the embodiment, the data query statements are divided into three categories according to the hit results of the data query statements, namely, first data query statements, second data query statements and third data query statements. The data table set hit by the first data query statements is the data table in the first data table set, and the modification mode of the first data query statements is to switch the to-be-migrated database to the target database to query data. The data table set hit by the second data query statements is the data table in the second data table set, and the modification mode of the second data query statements is not modified and data is queried in the original mode. The data table set hit by the third data query statements contains the data table in the first data table set and the data table in the second data table set, and the modification mode of the third data query statements is to query data in sequence according to the data table dimension. The modification mode of each data query statement is determined in sequence by using the method.

[0101] The application provides a data query statement modification method. Compared with the prior art, the data content of each data query statement included in the mapping file and the first data table set related to the target business system are obtained, the modification mode of the data query statement is automatically determined according to the relationship between the query data table included in the data content of each data query statement and the first data table set, there is no omission, the accuracy is high, manual searching for the data query statement is not required, human resources and energy are liberated, and the work efficiency is improved.

[0102] In one embodiment of the application, as shown in Figure 4 the data tables in the to-be-migrated database are divided into two data table sets, one is all the data tables related to the A business system and is taken as the data table set T1, and the other is all the data tables not related to the A business system and is taken as the data table set T2. The mapper file corresponding to each data table is parsed to obtain a root node, a plurality of child element nodes contained in the root node are obtained, each child element node includes the data content of an SQL statement, the query data of the SQL statement is obtained from the data content of each SQL statement, for example, when the query data of the SQL statement A1 only uses the data table in the data table set T1, the modification mode of the SQL statement is to switch the data source, that is, to switch from the to-be-migrated database to the target database; when the query data of the SQL statement A2 uses the data table in the data table sets T1 and T2, the modification mode of the SQL statement is SQL disassembly, that is, to query in sequence according to the data table dimension; when the query data of the SQL statement A3 uses the data table in T2, the modification mode of the SQL statement is not modified.

[0103] In another embodiment of the application, in order to further limit and illustrate, as shown in Figure 5 the modification mode of the data query statement is determined according to the relationship between the query data table and the first data table set, and the method comprises the following steps.

[0104] 502: respectively acquire the query data table table name of each data query statement, the first data table table name corresponding to the first data table set, and the second data table table name corresponding to the second data table set;

[0105] 504: determine the data query statement to be modified according to the relationship between the query data table table name and the first data table table name;

[0106] 506: determine the modification mode of the data query statement to be modified according to the relationship between the query data table table name and the second data table table name.

[0107] In the embodiment, the data query statement is an SQL statement, the query data table of the SQL statement is acquired from the data content of the SQL statement, when the query data table table name of the SQL statement contains at least one of the first data table table names, it is determined that the SQL statement is the data query statement to be modified, and then it is judged whether the query data table table name of the data query statement to be modified contains at least one of the second data table table names, when the query data table table name of the data query statement to be modified contains at least one of the second data table table names, the modification mode of the data query statement to be modified is to query in turn according to the data table dimension, when the query data table table name of the data query statement to be modified does not contain the second data table table name, the modification mode of the data query statement to be modified is to switch the data source, that is, to switch from the database to be migrated to the target database. When the query data table table name of an SQL statement does not contain the first data table table name, it is indicated that the SQL statement does not need to be modified, and the data is queried according to the original data query mode. In the embodiment, the method is used to judge the SQL statement one by one to determine the modification mode.

[0108] The application provides a data query statement modification method, compared with the prior art, by acquiring the data content of each data query statement included in the mapping file and the first data table set related to the target business system, according to the relationship between the query data table included in the data content of each data query statement and the first data table set, the data query statement to be modified is first determined, and then according to the relationship between the query data table included in the data content of each data query statement and the second data table set, the modification mode of the data query statement is automatically determined, there is no omission, the accuracy is high, and the work efficiency is improved.

[0109] Further, as an implementation of the method shown in the above Figure 1 , the embodiment of the application provides a data query statement modification determination device, as shown in the Figure 6 , the device comprises:

[0110] The data table set obtaining module 602 is configured to obtain a first data table set related to the target business system from a plurality of data tables in the database to be migrated.

[0111] The data content obtaining module 604 is configured to parse the mapping file of the database to be migrated to obtain data content of each data query statement included in the mapping file.

[0112] The query data table obtaining module 606 is configured to determine a query data table of each data query statement according to the data content of the data query statement.

[0113] The modifying module 608 is configured to determine a modification manner of the data query statement according to a relationship between the query data table and the first data table set, and modify the data query statement according to the modification manner.

[0114] The application provides a data query statement modification device, compared with the prior art, by obtaining data content of each data query statement included in the mapping file and a first data table set related to the target business system, determining a modification manner of the data query statement according to a relationship between a query data table included in the data content of each data query statement and the first data table set, there is no omission, the accuracy is high, and manual searching for the data query statement is not needed, which liberates manpower and energy and improves work efficiency.

[0115] In one embodiment, the first data table set related to the target business system is obtained from a plurality of data tables in the database to be migrated, including:

[0116] From the plurality of data tables in the database to be migrated, a data table matched with the target business system is obtained as the first data table set, and the remaining data tables in the database to be migrated are obtained as a second data table set.

[0117] In one embodiment, the modification manner of the data query statement is determined according to the relationship between the query data table and the first data table set, including:

[0118] The query data table table name, the first data table table name corresponding to the first data table set, and the second data table table name corresponding to the second data table set of each data query statement are obtained respectively.

[0119] According to the query data table table name, the first data table table name, and the second data table table name, the data table set hit by each data query statement is identified.

[0120] According to the data table set hit by each data query statement, the modification manner of each data query statement is determined.

[0121] In one embodiment, the modification manner of the data query statement is determined according to the hit data table set corresponding to each data query statement, and the modification manner of the data query statement comprises:

[0122] If the data table set hit by the first data query statement is the first data table set, it is determined that the modification manner of the first data query statement is switched from accessing the database to be migrated to accessing the target database.

[0123] If the data table set hit by the second data query statement is the second data table set, it is determined that the modification manner of the second data query statement is not modified.

[0124] If the data table set hit by the third data query statement is the first data table set and the second data table set, it is determined that the modification manner of the third data query statement is to query data in sequence according to the data table dimension.

[0125] In one embodiment, the mapping file of the database to be migrated is parsed to obtain the data content of each data query statement included in the mapping file, and the data content of each data query statement included in the mapping file corresponding to each data table in the database to be migrated is obtained.

[0126] The mapping file corresponding to each data table in the database to be migrated is parsed to obtain a document object of the mapping file.

[0127] Each document object is subjected to element node acquisition to obtain the data content of each data query statement included in the mapping file corresponding to the document object.

[0128] In one embodiment, each document object is subjected to element node acquisition to obtain the data content of each data query statement included in the mapping file corresponding to the document object, and the element node acquisition comprises:

[0129] For each document object, a root element node of the document object is obtained, each sub-element node of the root element node is obtained, and the data content of the data query statement included in each sub-element node is obtained.

[0130] In one embodiment, the mapping file is parsed by using a SAXReader parser.

[0131] According to one embodiment of the present application, a storage medium is provided, and the storage medium stores at least one executable instruction, and the computer executable instruction can execute the data query statement modification method in any method embodiment.

[0132] Figure 7 A structural schematic diagram of a computer device according to one embodiment of the present application is shown, and the specific implementation of the computer device is not limited in the specific embodiments of the present application.

[0133] As Figure 7As shown, the computer device can include a processor 702, a communications interface 704, a memory 706, and a communications bus 708.

[0134] The processor 702, the communications interface 704, and the memory 706 can communicate with each other through the communications bus 708.

[0135] The communications interface 704 is configured to communicate with network elements such as clients or other servers.

[0136] The processor 702 is configured to execute the program 710, and in particular, can execute the steps in the above-described modification method for data query statements.

[0137] In particular, the program 710 can include program code including computer operation instructions.

[0138] The processor 702 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included in the computer device can be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.

[0139] The memory 706 is configured to store the program 710. The memory 706 can include a high-speed RAM memory, and can also include a non-volatile memory such as at least one disk memory.

[0140] The program 710 can be specifically configured to cause the processor 702 to perform the following operations:

[0141] Obtain a first set of data tables related to the target business system from a plurality of data tables in the database to be migrated;

[0142] Parse the mapping file of the database to be migrated to obtain data content of each data query statement included in the mapping file;

[0143] Determine the query data table of each data query statement according to the data content of the data query statement;

[0144] Determine the modification mode of the data query statement according to the relationship between the query data table and the first set of data tables, and modify the data query statement according to the modification mode.

[0145] It is apparent that those skilled in the art should understand that the modules or steps of the present application described above can be realized by using general computing devices, and they can be centralized on a single computing device or distributed on a network composed of multiple computing devices. In an embodiment, they can be realized by using program codes executable by a computing device, so that they can be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described can be executed in an order different from that shown here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps among them can be made into a single integrated circuit module to realize. Thus, the present application is not limited to any particular combination of hardware and software.

[0146] The above embodiments are only exemplary embodiments of the present application, and are not intended to limit the present application. The scope of protection of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements to the present application within the spirit and protection scope of the present application, and such modifications or equivalent replacements should also be considered to fall within the protection scope of the present application.

Claims

1. A method of modifying a data query statement, characterized by, The method comprises the following steps: obtaining a first data table set related to a target business system from a plurality of data tables in a database to be migrated; parsing a mapping file of the database to be migrated to obtain data content of each data query statement included in the mapping file; determining a query data table of each data query statement according to the data content of the data query statement; determining a modification mode of the data query statement according to a relationship between the query data table and the first data table set, and modifying the data query statement according to the modification mode.

2. The method of claim 1, wherein, The method of obtaining a first data table set related to a target business system from a plurality of data tables in a database to be migrated comprises: obtaining a data table matched with the target business system from the plurality of data tables in the database to be migrated as the first data table set, and obtaining the remaining data tables in the database to be migrated as a second data table set.

3. The method of claim 2, wherein the data query statement is modified by, The method of determining a modification mode of the data query statement according to a relationship between the query data table and the first data table set comprises: obtaining a query data table name of each data query statement, a first data table name corresponding to the first data table set, and a second data table name corresponding to the second data table set; identifying a data table set hit by each data query statement according to the query data table name, the first data table name, and the second data table name; determining a modification mode of each data query statement according to the data table set hit by each data query statement.

4. The method of claim 3, wherein the data query statement is modified by, The method of determining a modification mode of the data query statement according to a data table set hit by each data query statement comprises: if a data table set hit by a first data query statement is the first data table set, determining that the modification mode of the first data query statement is switching from accessing the database to be migrated to accessing a target database; if a data table set hit by a second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified; if a data table set hit by a third data query statement is the first data table set and the second data table set, determining that the modification mode of the third data query statement is querying data in sequence according to a data table dimension.

5. The method of claim 1, wherein the data query statement is modified by, The method of parsing a mapping file of the database to be migrated to obtain data content of each data query statement included in the mapping file comprises: parsing a mapping file corresponding to each data table in the database to obtain a document object of the mapping file; obtaining an element node of each document object to obtain data content of each data query statement included in the mapping file corresponding to the document object.

6. The method of modifying a data query statement of claim 5, wherein, The method of obtaining an element node of each document object to obtain data content of each data query statement included in the mapping file corresponding to the document object comprises: for each document object, obtaining a root element node of the document object, obtaining each child element node of the root element node, and obtaining data content of a data query statement included in each child element node.

7. The method of modifying a data query statement of claim 5, wherein, The mapping file is parsed by using a SAXReader parser.

8. A device for modifying a data query statement, characterized in that, Comprise: A data table set acquisition module, configured to acquire a first data table set related to a target business system from a plurality of data tables in a to-be-migrated database; A data content acquisition module, configured to parse a mapping file of the to-be-migrated database, and acquire data content of each data query statement included in the mapping file; A query data table acquisition module, configured to determine a query data table of each data query statement according to the data content of the data query statement; A modification module, configured to determine a modification mode of the data query statement according to a relationship between the query data table and the first data table set, and modify the data query statement according to the modification mode. 9.A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform operations corresponding to the modification method of the data query statement according to any one of claims 1-7.

10. A computer device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface complete communication with each other through the communication bus; The memory is configured to store at least one executable instruction, and the executable instruction causes the processor to perform operations corresponding to the modification method of the data query statement according to any one of claims 1-7.

Citation Information

Patent Citations

  • Data processing method, apparatus and system

    CN105701112A

  • Database migration evaluation method and device, storage medium and computer equipment

    CN111258989A