CN115309772A - Data query statement modification method, device, medium and equipment - Google Patents

Data query statement modification method, device, medium and equipment Download PDF

Info

Publication number
CN115309772A
CN115309772A CN202211114506.6A CN202211114506A CN115309772A CN 115309772 A CN115309772 A CN 115309772A CN 202211114506 A CN202211114506 A CN 202211114506A CN 115309772 A CN115309772 A CN 115309772A
Authority
CN
China
Prior art keywords
data
query statement
data table
data query
table set
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
CN202211114506.6A
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.)
Pingan Payment Technology Service Co Ltd
Original Assignee
Pingan Payment Technology Service 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 Pingan Payment Technology Service Co Ltd filed Critical Pingan Payment Technology Service Co Ltd
Priority to CN202211114506.6A priority Critical patent/CN115309772A/en
Publication of CN115309772A publication Critical patent/CN115309772A/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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation

Landscapes

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

Abstract

The application discloses a method, a device, a medium and equipment for modifying a data query statement, wherein the method comprises the following steps: acquiring a first data table set related to a target service system from a plurality of data tables in a database to be migrated; acquiring data content of each data query statement included in a mapping file in a database to be migrated; determining a query data table of each data query statement according to the data content of the data query statement; and determining a modification mode of the data query statement according to the relation between the query data table and the first data table set. According to the method and the device, 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 relation between the query data table and the first data table set included in the data content of each data query statement, the omission condition does not exist, the accuracy rate is high, the data query statement does not need to be searched manually, manpower is liberated, and the working efficiency is improved.

Description

Data query statement modification method, device, medium and equipment
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device, a medium and equipment for modifying a data query statement.
Background
With the increase of the service systems, more and more data are stored in the database, and the time for querying the data is longer and longer, so that the decoupling and splitting of the service systems are required, that is, the splitting of the database is performed according to the service systems. The database splitting is to migrate data in some data tables in the source database to a new database, and after the data are migrated to the new database, a data query statement executed by a processing node in the service system is changed from accessing the source database to accessing the new database to acquire the migrated data.
Before the database is split, when a data query statement queries data, a plurality of data tables are associated for query, so that before data migration, a data query statement related to the migrated data needs to be identified and a change mode of data query of the data query statement needs to be determined.
At present, the content of a data query statement is searched from a bottom layer code in a manual mode, the data query statement matched with migration data is identified, and a change mode of the data query statement is determined.
Therefore, a method for automatically determining the modification manner of the data query statement matched with the migration data during the migration of the database is needed.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a medium, and a device for modifying a data query statement, and mainly aims to solve the problems that when a database is split at present, a modification mode of a data query statement matching migration data is determined by manually searching for the data query statement, the manual searching workload is large, and determination errors of missing or changing modes exist.
According to an aspect of the present application, there is provided a method of modifying a data query statement, the method including:
acquiring a first data table set related to a target service system from a plurality of data tables in a database to be migrated;
analyzing the mapping file of the database to be migrated to acquire the 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;
and determining a modification mode of the data query statement according to the relation between the query data table and the first data table set, and modifying the data query statement according to the modification mode.
Optionally, the obtaining a first data table set related to the target service system from a plurality of data tables in the database to be migrated includes:
and acquiring a data table matched with the target service system from the plurality of data tables in the database to be migrated to serve as a first data table set, and taking the rest data tables in the database to be migrated as a second data table set.
Optionally, the determining, according to the relationship between the query data table and the first data table set, a modification manner of the data query statement includes:
respectively acquiring 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 packet set;
identifying a data table set hit by each data query statement according to the name of the query data table, the name of the first data table and the name of the second data table;
and determining a modification mode of each data query statement according to the data table set hit by each data query statement.
Optionally, the determining, according to the hit data table set corresponding to each data query statement, a modification manner of the data query statement includes:
if the data table set hit by the first data query statement is the first data table set, determining that the modification mode of the first data query statement is to switch from accessing the database to be migrated to accessing the target database;
if the data table set hit by the second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified;
and if the data table set hit by the 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 to sequentially query data according to the data table dimensions.
Optionally, the analyzing 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:
analyzing the mapping file corresponding to each data table in the database to be migrated to obtain a document object of the mapping file;
and acquiring element nodes of each document object, and acquiring the data content of each data query statement included in the mapping file corresponding to the document object.
Optionally, the obtaining element nodes of each document object, and the obtaining data content of each data query statement included in the mapping file corresponding to the document object, includes:
and aiming at each document object, acquiring a root element node of the document object, acquiring each sub-element node of the root element, and acquiring the data content of a data query statement included by each sub-element node.
Optionally, a SAXReader parser is used to parse the mapping file.
According to another aspect of the present application, there is provided an apparatus for modifying a data query statement, including:
the data table set acquisition module is used for acquiring a first data table set related to the target service system from a plurality of data tables in the database to be migrated;
the data content acquisition module is used for analyzing the mapping file of the database to be migrated and acquiring the data content of each data query statement included in the mapping file;
the query data table acquisition module is used for determining a query data table of each data query statement according to the data content of the data query statement;
and the modification module is used for determining a modification mode of the data query statement according to the relation between the query data table and the first data table set, and modifying the data query statement according to the modification mode.
Optionally, the obtaining a first set of data tables related to the target business system from a plurality of data tables in the database to be migrated includes:
and acquiring a data table matched with the target service system from the plurality of data tables in the database to be migrated to serve as a first data table set, and taking the rest data tables in the database to be migrated as a second data table set.
Optionally, the determining a modification manner of the data query statement according to the relationship between the query data table and the first data table set includes:
respectively acquiring 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 packet set;
identifying a data table set hit by each data query statement according to the name of the query data table, the name of the first data table and the name of the second data table;
and determining a modification mode of each data query statement according to the data table set hit by each data query statement.
Optionally, the determining, according to the hit data table set corresponding to each data query statement, a modification manner of the data query statement includes:
if the data table set hit by the first data query statement is the first data table set, determining that the modification mode of the first data query statement is to switch from accessing the database to be migrated to accessing the target database;
if the data table set hit by the second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified;
and if the data table set hit by the 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 to sequentially query data according to the data table dimensions.
Optionally, the analyzing 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:
analyzing the mapping file corresponding to each data table in the database to be migrated to obtain a document object of the mapping file;
and acquiring element nodes of each document object, and acquiring the data content of each data query statement included in the mapping file corresponding to the document object.
Optionally, the obtaining element nodes of each document object, and the obtaining data content of each data query statement included in the mapping file corresponding to the document object, includes:
and aiming at each document object, acquiring a root element node of the document object, acquiring each sub-element node of the root element, and acquiring the data content of a data query statement included by each sub-element node.
Optionally, a SAXReader parser is used to parse the mapping file.
According to another aspect of the present application, a storage medium is provided, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to execute operations corresponding to the method for modifying a data query statement.
According to another aspect of the present application, there is provided a computer device including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the modification method of the data query statement.
By the technical scheme, the technical scheme provided by the embodiment of the invention at least has the following advantages:
according to the modification method, the modification device, the modification equipment and the modification medium of the data query sentences, the data content of each data query sentence included in the mapping file and the first data table set related to the target service system are obtained, and the modification mode of the data query sentences is automatically determined according to the relation between the query data table and the first data table set included in the data content of each data query sentence, so that the omission condition does not exist, the accuracy is high, the data query sentences do not need to be searched manually, the manpower and the energy are released, and the working efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart illustrating a method for modifying a data query statement according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for modifying a data query statement according to an embodiment of the present application;
FIG. 3 is a flow chart illustrating a modification method of a data query statement provided by an embodiment of the present application;
FIG. 4 is a flow chart illustrating a method for modifying a data query statement according to an embodiment of the present application;
FIG. 5 is a flow chart illustrating a method for modifying a data query statement according to an embodiment of the present application;
FIG. 6 is a block diagram illustrating a modification apparatus for a data query statement according to an embodiment of the present application;
fig. 7 shows a schematic structural diagram of a computer device according to an embodiment of the present invention.
Wherein,
in fig. 6: 602-a data table set acquisition module; 604-a data content acquisition module; 606-query data table acquisition module; 608-a modification module;
in fig. 7: 702-a processor; 704-a communication interface; 706-a memory; 708-a communication bus; 710-procedure.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the embodiments, structures, characteristics and effects according to the present invention will be made with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "an embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Aiming at the problems that the modification mode of the data query statement matched with the migration data is determined by manually searching the data query statement during the splitting of the existing database, the workload of manual searching is large, and the determination error of the omission or change mode exists, the embodiment of the application provides a modification method of the data query statement, and as shown in fig. 1, the method comprises the following steps:
102: acquiring a first data table set related to a target service system from a plurality of data tables in a database to be migrated;
in the embodiment of the present invention, the target service system is a service system to be migrated, and the database migration is to migrate data in a data table related to the target service system in the database to be migrated to a new database, which is also called a target database. Before the database is not migrated, the data query statements executed by the processing nodes access the data table in the database to be migrated to obtain data, after the data migration, the query mode of the data query statements executed by some processing nodes is changed, the database to be migrated is not accessed, but the new database is accessed, so that the data query statements with the changed query mode are determined and modified at the same time or before the data migration, and when the new database is put into use, the data is queried according to the correct data query mode, and further the required data is obtained.
The database to be migrated is a warehouse database and is used for storing a large amount or mass of data in the business operation process, wherein the business operation process includes but is not limited to content of operations such as insurance business, product updating, claim settlement operation and the like, for example, code content and data content corresponding to the operations. The data stored in the database to be migrated can be public service data, customer data and the like, and due to the fact that the types of the data are numerous, the database splitting method includes but is not limited to application scenarios of public service, financial service, logistics management and the like.
In another embodiment of the present invention, for further definition and explanation, obtaining a first set of data tables associated with a target business system from a plurality of data tables in a database to be migrated, comprises:
and acquiring a data table matched with the target service system from a plurality of data tables in the database to be migrated to serve as a first data table set, and taking the rest data tables in the database to be migrated as a second data table set.
In this embodiment, all data table combinations matched with the target service system to be migrated in the database to be migrated are used as the first data table set, and all data table combinations unmatched with the target service system to be migrated are used as the second data table set. For example, the target service system to be migrated is an a service system, at least one data table in the database to be migrated is used to store data generated when processing the task of the a service system, the data tables used to store the data generated when processing the task of the a service system are called data tables matched with the a service system, and a set formed by all the data tables matched with the a service system is used as a first data table set. The data table which does not store the data generated when the task of the service system A is processed is called a data table which is not matched with the service system A, and a set formed by all the data tables which are not matched with the service system A is used as a second data table set.
104: analyzing a mapping file of a database to be migrated to acquire the data content of each data query statement included in the mapping file;
in the embodiment of the invention, the data query statement is used for querying the data table in the database to be migrated, and the data table includes but is not limited to data generated in the operation processes of insurance business, product sale, after-sale of products, product inventory management, claim settlement operation and the like.
In another embodiment of the present invention, for further limitation and description, as shown in fig. 2, parsing a mapping file of a to-be-migrated database to obtain data content of each data query statement included in the mapping file includes:
202: analyzing a mapping file corresponding to each data table in a database to be migrated to obtain a document object of the mapping file;
204: and acquiring element nodes of each document object, and acquiring the data content of each data query statement included in the mapping file corresponding to the document object.
In one embodiment of the invention, the mapping file is parsed by a SAXReader parser.
In an embodiment of the present invention, the mapper file is also called a mapping file, is used for storing SQL statements of the current system, and is a file in an XML format, in the database to be migrated, each data table corresponds to one mapper file, and a directory for storing SQL statements of the current system is scanned and formed by an saxreader.
In an embodiment of the present invention, obtaining element nodes for each document object, and obtaining data content of each data query statement included in a mapping file corresponding to the document object includes:
and aiming at each document object, acquiring a root element node of the document object, acquiring each sub-element node of the root element, and acquiring the data content of the data query statement included by each sub-element node.
In the embodiment of the present invention, for a document object, a root element node corresponding to the document object is obtained, where the root element node is also called a mapper node, each root element node includes a plurality of child element nodes, each child element node includes a name, data content, an id attribute, and the like of a data query statement, for example, the data query statement is an SQL statement, and each child element node includes the name, data content, and id attribute of the SQL statement. And traversing each sub-element node to obtain the data content of each data query statement.
In one embodiment, each child element node content contains: (1) The current sql operation type, i.e. the name of the current node; (2) The ID of the current sql is used for identifying a modified point, namely the attribute value of the current node ID; (3) And the content of the current sql statement, namely the data content of the current node.
106: determining a query data table of each data query statement according to the data content of the data query statement;
in the embodiment of the invention, aiming at 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 may be public service data, customer data, etc., and due to the numerous types of data, the database query method includes, but is not limited to, application scenarios of public service, financial service, logistics management, etc.
108: and determining a modification mode of the data query statement according to the relation between the query data table and the first data table set, and modifying the data query statement according to the modification mode.
In the embodiment of the invention, aiming at a data query statement, after a query data table of the data query statement is obtained, a modification mode of the data query statement is determined according to the relation between the query data table of the data query statement and a first data table set, the data query statement is modified according to the modification mode, and the modified data query statement is used for querying data in data tables in a database to be migrated and a target database according to the modification mode. By adopting the method, the modification mode of each data query statement is determined in turn.
In the embodiment of the present invention, the query data table of each data query statement may also be obtained first, after the query data tables of all data query statements are obtained, each data query statement is traversed, and the modification manner of the query data table is determined by using the method described above until the modification manner of all data query statements is determined.
In another embodiment of the present invention, for further limitation and explanation, as shown in fig. 3, the determining a modification manner of the data query statement according to a relationship between the query data table and the first data table set includes:
302: respectively acquiring 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 packet set;
304: identifying a data table set hit by each data query statement according to the name of the queried data table, the name of the first data table and the name of the second data table;
306: and determining the modification mode of each data query statement according to the data table set hit by each data query statement.
In the embodiment of the present invention, a data table name of a first data table set and a data table name of a second data table set are obtained, for each data query statement, a data query table of the data query statement is obtained according to data content of the data query statement, a 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 a data table in the first data table set and the second data table set hit by the table name of the data query statement, and a modification manner of the data query statement is further determined according to the data table set.
In the embodiment of the present invention, for further limitation and description, determining a modification manner of a data query statement according to a hit data table set corresponding to each data query statement includes:
if the data table set hit by the first data query statement is the first data table set, determining that the modification mode of the first data query statement is to switch from accessing the database to be migrated to accessing the target database;
if the data table set hit by the second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified;
and if the data table set hit by the 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 to sequentially query data according to the data table dimensions.
In this embodiment, the data query statements are classified into three categories, namely, a first data query statement, a second data query statement, and a third data query statement, according to the hit result of the data query statement. The data table set hit by the first data query statement is a data table in the first data table set, and the modification mode of the first data query statement is that the database to be migrated is switched to the query data of the target database; the data table set hit by the second data query statement is a data table in the second data table set, the modification mode of the second data query statement is not modified, and data is queried according to the original mode; the data table set hit by the third data query statement simultaneously contains the data tables in the first data table set and the second data table set, and the modification mode of the third data query statement is to sequentially query data according to the dimension of the data tables. The modification mode of each data query statement is determined in turn by adopting the method.
Compared with the prior art, the modification method of the data query sentences automatically determines the modification mode of the data query sentences according to the relation between the query data tables and the first data table set included in the data content of each data query sentence by acquiring the data content of each data query sentence included in the mapping file and the first data table set related to the target service system, has no omission condition, is high in accuracy, does not need to manually search the data query sentences, releases manpower and energy, and improves the working efficiency.
In an embodiment of the present invention, as shown in fig. 4, taking the service system a as the service system to be migrated as an example, the data tables in the database to be migrated are divided into two data table sets, one is all the data tables related to the service system a as the data table set T1, and the other is all the data tables unrelated to the service system a as the data table set T2. Analyzing the mapper file corresponding to each data table to obtain a root node, and obtaining a plurality of child element nodes contained in the root node, where each child element node includes data content of an SQL statement, and obtaining query data of the SQL statement from the data content of each SQL statement, for example, when the query data of the SQL statement A1 only uses a data table in the data table set T1, the modification mode of the SQL statement is to switch a data source, that is, to switch from a to-be-migrated database to a target database; when the query data of the SQL statement A2 uses the data tables of the data table sets T1 and T2, the modification mode of the SQL statement is SQL disassembly, namely, the query is carried out in sequence according to the dimension of the data tables; when the query data of the SQL statement A3 uses the data table of T2, that SQL statement is modified in a manner that it is not modified.
In another embodiment of the present invention, for further limitation and explanation, as shown in fig. 5, the determining a modification manner of the data query statement according to a relationship between the query data table and the first data table set includes:
502: respectively acquiring 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 packet set;
504: determining a data query statement to be modified according to the relation between the query data table name and the first data table name;
506: and determining a modification mode of the data query statement to be modified according to the relation between the name of the query data table and the name of the second data table.
In this embodiment, the data query statement is an SQL statement, the query data table of the SQL statement is obtained from the data content of one SQL statement, when the query data table name of the SQL statement includes at least one of the first data table names, the SQL statement is determined to be a data query statement to be modified, it is determined whether the query data table name of the SQL statement to be modified includes at least one of the second data table names next, and when the query data table name of the SQL statement to be modified includes at least one of the second data table names, the modification mode of the SQL statement to be modified is to sequentially query according to the data table dimensions; when the query data table name of the SQL statement to be modified does not contain the second data table name, the modification mode of the SQL statement to be modified is to switch the data source, namely, the database to be migrated is switched to the target database. When the table name of the query data table of the SQL statement does not contain the first table name, the SQL statement is not required to be modified, and data is queried according to the original data query mode. In this embodiment, the method is used to judge SQL statements one by one and determine the modification mode.
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 service system are obtained, the data query statement to be modified is determined firstly according to the relation between the query data table and the first data table set included in the data content of each data query statement, then the modification mode of the data query statement is determined automatically according to the relation between the query data table and the second data table set included in the data content of each data query statement, omission does not exist, is high in accuracy, and improves working efficiency.
Further, as an implementation of the method shown in fig. 1, an embodiment of the present invention provides a modification determination apparatus for a data query statement, as shown in fig. 6, where the apparatus includes:
a data table set obtaining module 602, configured to obtain a first data table set related to the target service system from multiple data tables in the database to be migrated;
a data content obtaining module 604, configured to analyze a mapping file of the database to be migrated, and obtain data content of each data query statement included in the mapping file;
a query data table obtaining module 606, configured to determine a query data table of each data query statement according to the data content of the data query statement;
the modifying module 608 is configured to determine a modifying 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 modifying manner.
Compared with the prior art, the modification method of the data query sentences is automatically determined according to the relation between the query data table and the first data table set included by the data content of each data query sentence and the first data table set related to the target service system by acquiring the data content of each data query sentence included by the mapping file, the omission condition does not exist, the accuracy rate is high, the data query sentences do not need to be searched manually, the manpower and the energy are liberated, and the working efficiency is improved.
In one embodiment, obtaining a first set of data tables associated with a target business system from a plurality of data tables in a database to be migrated comprises:
and acquiring a data table matched with the target service system from a plurality of data tables in the database to be migrated to serve as a first data table set, and taking the rest data tables in the database to be migrated as a second data table set.
In one embodiment, determining the modification mode of the data query statement according to the relation between the query data table and the first data table set comprises:
respectively acquiring 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 packet 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;
and determining the modification mode of each data query statement according to the data table set hit by each data query statement.
In one embodiment, determining a modification mode of a data query statement according to a set of data tables in a hit corresponding to each data query statement includes:
if the data table set hit by the first data query statement is the first data table set, determining that the modification mode of the first data query statement is to switch from accessing the database to be migrated to accessing the target database;
if the data table set hit by the second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified;
and if the data table set hit by the 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 to sequentially query data according to the data table dimensions.
In one embodiment, parsing a mapping file of a database to be migrated to obtain data content of each data query statement included in the mapping file includes:
analyzing a mapping file corresponding to each data table in a database to be migrated to obtain a document object of the mapping file;
and acquiring element nodes of each document object, and acquiring the data content of each data query statement included in the mapping file corresponding to the document object.
In one embodiment, the element node obtaining is performed on each document object, and the obtaining of the data content of each data query statement included in the mapping file corresponding to the document object includes:
and aiming at each document object, acquiring a root element node of the document object, acquiring each sub-element node of the root element, and acquiring the data content of the data query statement included by each sub-element node.
In one embodiment, the mapping file is parsed using a SAXReader parser.
According to an embodiment of the present invention, a storage medium is provided, where the storage medium stores at least one executable instruction, and the computer executable instruction can execute the modification method of the data query statement in any of the above method embodiments.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the computer device.
As shown in fig. 7, the computer apparatus may include: a processor (processor) 702, a Communications Interface 704, a memory 706, and a communication bus 708.
Wherein: the processor 702, communication interface 704, and memory 706 communicate with each other via a communication bus 708.
A communication interface 704 for communicating with network elements of other devices, such as clients or other servers.
The processor 702 is configured to execute the program 710, and may specifically execute relevant steps in the above modification method embodiment of the data query statement.
In particular, the program 710 may include program code that includes computer operating instructions.
The processor 702 may be a central processing unit CPU, or an Application Specific Integrated Circuit ASIC (Application Specific Integrated Circuit), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computer device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
The memory 706 stores a program 710. The memory 706 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 710 may specifically be used to cause the processor 702 to perform the following operations:
acquiring a first data table set related to a target service system from a plurality of data tables in a database to be migrated;
analyzing a mapping file of a database to be migrated, and acquiring the 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;
and determining a modification mode of the data query statement according to the relation between the query data table and the first data table set, and modifying the data query statement according to the modification mode.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented in a general purpose computing device, centralized on a single computing device or distributed across a network of computing devices, and in one embodiment, may be implemented in program code executable by a computing device, such that the steps shown and described may be executed by a computing device stored in a memory device and, in some cases, executed in a sequence other than that described herein, or fabricated separately as individual integrated circuit modules or fabricated as a single integrated circuit module from multiple modules or steps of the above. Thus, the present invention is not limited to any specific combination of hardware and software.
The above embodiments are only exemplary embodiments of the present application, and are not intended to limit the present application, and the protection scope of the present application is defined by the claims. Various modifications and equivalents may be made to the disclosure by those skilled in the art within the spirit and scope of the disclosure, and such modifications and equivalents should also be considered as falling within the scope of the disclosure.

Claims (10)

1. A method for modifying a data query statement, comprising:
acquiring a first data table set related to a target service system from a plurality of data tables in a database to be migrated;
analyzing the mapping file of the database to be migrated, and acquiring the 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;
and determining a modification mode of the data query statement according to the relation 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 for modifying a data query statement according to claim 1, wherein said obtaining a first set of data tables associated with a target business system from a plurality of data tables in a database to be migrated comprises:
and acquiring a data table matched with the target service system from the plurality of data tables in the database to be migrated to serve as a first data table set, and taking the rest data tables in the database to be migrated as a second data table set.
3. The method for modifying a data query statement according to claim 2, wherein said determining a modification manner of said data query statement according to a relationship between said query data table and said first data table set comprises:
respectively acquiring 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 packet 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;
and determining a modification mode of each data query statement according to the data table set hit by each data query statement.
4. The method for modifying a data query statement according to claim 3, wherein the determining a modification manner of the data query statement according to the set of hit data tables corresponding to each data query statement comprises:
if the data table set hit by the first data query statement is the first data table set, determining that the modification mode of the first data query statement is to switch from accessing the database to be migrated to accessing the target database;
if the data table set hit by the second data query statement is the second data table set, determining that the modification mode of the second data query statement is not modified;
and if the data table set hit by the 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 to sequentially query data according to the data table dimensions.
5. The method for modifying data query statements according to claim 1, wherein the 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 comprises:
analyzing the mapping file corresponding to each data table in the database to be migrated to obtain a document object of the mapping file;
and acquiring element nodes of each document object, and acquiring the data content of each data query statement included in the mapping file corresponding to the document object.
6. The method for modifying a data query statement according to claim 5, wherein the performing element node acquisition on each document object to acquire the data content of each data query statement included in the mapping file corresponding to the document object includes:
and aiming at each document object, acquiring a root element node of the document object, acquiring each sub-element node of the root element, and acquiring the data content of a data query statement included by each sub-element node.
7. The method of modifying a data query statement as claimed in claim 5, characterized in that said mapping file is parsed using a SAXReader parser.
8. An apparatus for modifying a data query statement, comprising:
the data table set acquisition module is used for acquiring a first data table set related to the target service system from a plurality of data tables in the database to be migrated;
the data content acquisition module is used for analyzing the mapping file of the database to be migrated and acquiring the data content of each data query statement included in the mapping file;
the query data table acquisition module is used for determining a query data table of each data query statement according to the data content of the data query statement;
and the modification module is used for determining a modification mode of the data query statement according to the relation between the query data table and the first data table set, and modifying the data query statement according to the modification mode.
9. A storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the method of modifying a data query statement as claimed in any one of claims 1 to 7.
10. A computer device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the modification method of the data query statement as claimed in any one of claims 1 to 7.
CN202211114506.6A 2022-09-14 2022-09-14 Data query statement modification method, device, medium and equipment Pending CN115309772A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211114506.6A CN115309772A (en) 2022-09-14 2022-09-14 Data query statement modification method, device, medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211114506.6A CN115309772A (en) 2022-09-14 2022-09-14 Data query statement modification method, device, medium and equipment

Publications (1)

Publication Number Publication Date
CN115309772A true CN115309772A (en) 2022-11-08

Family

ID=83866414

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211114506.6A Pending CN115309772A (en) 2022-09-14 2022-09-14 Data query statement modification method, device, medium and equipment

Country Status (1)

Country Link
CN (1) CN115309772A (en)

Similar Documents

Publication Publication Date Title
CN112199366B (en) Data table processing method, device and equipment
CN111459985B (en) Identification information processing method and device
US11775501B2 (en) Trace and span sampling and analysis for instrumented software
US8825581B2 (en) Simplifying a graph of correlation rules while preserving semantic coverage
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
CN110019384B (en) Method for acquiring blood edge data, method and device for providing blood edge data
US9229960B2 (en) Database management delete efficiency
CN112579610A (en) Multi-data source structure analysis method, system, terminal device and storage medium
CN109815240A (en) For managing method, apparatus, equipment and the storage medium of index
CN111125199B (en) Database access method and device and electronic equipment
CN113918605A (en) Data query method, device, equipment and computer storage medium
US7925617B2 (en) Efficiency in processing queries directed to static data sets
US20090171921A1 (en) Accelerating Queries Based on Exact Knowledge of Specific Rows Satisfying Local Conditions
US20230153286A1 (en) Method and system for hybrid query based on cloud analysis scene, and storage medium
CN117131230A (en) Data blood edge analysis method, device, equipment and storage medium
CN113268483B (en) Request processing method and device, electronic equipment and storage medium
US11620285B2 (en) Automatic database query translation
US11947490B2 (en) Index generation and use with indeterminate ingestion patterns
CN116049232A (en) Sub-query extraction method, sub-query extraction device, electronic equipment and storage medium
EP4170512A1 (en) Time series data injection method, time series data query method and database system
CN115309772A (en) Data query statement modification method, device, medium and equipment
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
RU2680743C1 (en) Method of preserving and changing reference and initial records in an information data management system
CN116610711A (en) Data query method, device, equipment and storage medium
CN118394846A (en) Data synchronization method and device, electronic equipment 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