CN117389986A - Database compatibility evaluation method and device, electronic equipment and storage medium - Google Patents

Database compatibility evaluation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117389986A
CN117389986A CN202311301790.2A CN202311301790A CN117389986A CN 117389986 A CN117389986 A CN 117389986A CN 202311301790 A CN202311301790 A CN 202311301790A CN 117389986 A CN117389986 A CN 117389986A
Authority
CN
China
Prior art keywords
database
query statement
compatibility evaluation
initial query
source
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
CN202311301790.2A
Other languages
Chinese (zh)
Inventor
白国涛
王娟
张春
马拂晓
胡东妮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202311301790.2A priority Critical patent/CN117389986A/en
Publication of CN117389986A publication Critical patent/CN117389986A/en
Pending legal-status Critical Current

Links

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/21Design, administration or maintenance of databases
    • 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/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • 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
    • 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/2455Query execution

Landscapes

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

Abstract

The application discloses a database compatibility evaluation method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring an initial query statement in a source database; performing specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences; executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database. I.e. the present application improves the efficiency of compatibility assessment.

Description

Database compatibility evaluation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a database compatibility evaluation method, a device, an electronic device, and a storage medium.
Background
In recent years, in the existing network service system, a new database may be adopted by the bottom layer of the service system due to system upgrade and the like. The grammar difference of query sentences of different databases is large, and the databases are incompatible. When the service system changes the new database, the compatibility of the new database to the query statement of the source database currently used by the service system needs to be evaluated, so that guidance is provided for data migration among different subsequent databases and transformation of the service system to the new database.
In practical application, compatibility evaluation needs to be performed through all query sentences in the source database, and the efficiency of the compatibility evaluation is not high because a large number of query sentences are recorded in the source database.
Therefore, a solution capable of improving the efficiency of compatibility evaluation is required in practical applications.
Disclosure of Invention
The main purpose of the application is to provide a database compatibility evaluation method, a device, an electronic device and a storage medium, and aims to solve the technical problem of low compatibility evaluation efficiency.
To achieve the above object, the present application provides a database compatibility evaluation method, including the steps of:
acquiring an initial query statement in a source database;
performing specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences;
executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
Exemplary, the performing specific processing on the initial query statement to obtain a target query statement includes:
matching one or more groups of repeated initial query sentences from the initial query sentences;
and executing deleting operation on the repeated initial query sentences of each group, and reserving one initial query sentence in the repeated initial query sentences of each group to obtain a target query sentence.
Exemplary, the performing specific processing on the initial query statement to obtain a target query statement includes:
matching the initial query statement to obtain an unsupported initial query statement corresponding to an unsupported grammar in the new database;
and eliminating the non-supported initial query statement to obtain a target query statement.
Illustratively, before executing the target query statement in the new database to obtain the database compatibility evaluation report, the method includes:
according to a specific replacement rule, rewriting the target query statement;
executing the target query statement in the new database to obtain a database compatibility evaluation report, including:
and executing the rewritten target query statement in the new database to obtain a database compatibility evaluation report.
Illustratively, the database compatibility evaluation method further includes:
acquiring a source data source;
and if the source data source is generated internally, acquiring and automatically generating the initial query statement in a source database through a statement acquisition client.
Illustratively, the database compatibility evaluation method further includes:
and desensitizing the initial query statement.
Illustratively, the database compatibility evaluation method further includes:
and formatting the target query statement.
Illustratively, to achieve the above object, the present application further provides a database compatibility evaluation apparatus, including:
the first acquisition module is used for acquiring an initial query statement in the source database;
the processing module is used for carrying out specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences;
the execution module is used for executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
For the purpose of achieving the above object, the present application further provides an electronic device, including: a memory, a processor, and a database compatibility evaluation program stored on the memory and executable on the processor, the database compatibility evaluation program configured to implement the steps of the database compatibility evaluation method as described above.
Illustratively, to achieve the above object, the present application further provides a computer-readable storage medium having stored thereon a database compatibility evaluation program which, when executed by a processor, implements the steps of the database compatibility evaluation method as described above.
Compared with the prior art, the compatibility evaluation needs to be carried out through all query sentences in the source database, and the efficiency of the compatibility evaluation is not high because a large number of query sentences are recorded in the source database, the embodiment of the application acquires the initial query sentences in the source database; performing specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences; executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database. According to the method and the device for evaluating the compatibility of the target query sentences, the number of the initial query sentences executed in the new database is reduced, so that when the compatibility evaluation is carried out on the initial query sentences, the compatibility evaluation is not required to be carried out on all the query sentences in the source database, but the compatibility evaluation is carried out on the target query sentences with fewer numbers, and therefore the efficiency of the compatibility evaluation is improved.
Drawings
FIG. 1 is a flowchart illustrating an embodiment of a database compatibility evaluation method according to the present application;
FIG. 2 is a schematic block diagram of a database compatibility evaluation apparatus according to the present application;
fig. 3 is a schematic structural diagram of a hardware running environment according to an embodiment of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a database compatibility evaluation method according to the present application. The present embodiments provide embodiments of database compatibility evaluation methods, it being noted that although a logical order is shown in the flow diagrams, in some cases the steps shown or described may be performed in an order different than that shown or described herein. The database compatibility evaluation method comprises the following steps:
step S110, an initial query statement in a source database is acquired.
Step S120, carrying out specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of target query sentences is smaller than the number of initial query sentences.
Step S130, executing the target query statement in a new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
The following is a detailed description of the various steps:
step S110, an initial query statement in a source database is acquired.
It should be noted that, the embodiment of the present application is mainly used for a compatibility evaluation task, that is, evaluating compatibility between a source database and a new database, where the evaluation process may be divided into four phases, which are a task management phase, a source data acquisition phase, a compatibility evaluation phase, and a result output phase. The task management stage is used for carrying out corresponding configuration, so that corresponding steps in the source data acquisition stage, the compatibility evaluation stage and the result output stage are executed according to the configuration.
In the task management stage, corresponding configuration including parameter configuration and task configuration is required according to the instruction of the user. Wherein the parameter configuration is used for configuring the parameter and the task configuration is used for configuring the task.
The parameters include, but are not limited to, the database type of the record source database (old_db), version information corresponding to the source database, the database type of the NEW database (new_db), version information corresponding to the NEW database, source data source, access address, user name and password of the source database, access address, user name and password of the NEW database, the name of the database to be evaluated, and acquisition duration. Wherein the database name to be evaluated is the database name of the source database; the collection duration is used for determining time information corresponding to the source data, for example, the collection duration is 7 days, and then the source data is the data in the last 7 days in the source database.
The task information is used for recording the task configuration of the compatibility evaluation task, and the data format of the task information is < task name, task initiation time, task end time, task parallelism and task parameters >. When a user triggers a task creation operation, a task configuration interface is displayed, task information input by the user on the task configuration interface is obtained, and a compatibility evaluation task is started based on the task information.
Database types include relational databases, non-relational databases (NoSQL), key-value databases (key-value).
The relational databases comprise MySQL, oracle, SQL Server, TDSQL (Tencent Distributed SQL, a distributed database), DB2, apache Kafka and the like; the non-relational database includes BigTable, cassandra, mongoDB and the like; the Key-Value database includes Dynamo, levelDB and the like. For a relational database of the database type of the source database, the initial query statement is SQL (Structured Query Language, structured query statement) which comprises DDL (Date Defination Language, data definition language), DQL (Data Query Language ) and has some difference for different relational databases; for a source database, the database type is a non-relational database, the initial query statement is not SQL, for example, the initial query statement of MongoDB is db.
The following are respectively used for developing and explaining the embodiments of the present application through a relational database, a non-relational database and a key value database:
for a relational database:
it should be noted that, the OLTP (On-Line Transaction Processing, online transaction process) database industry is accelerating, and product quality and market share are actively improved, so that various OLTP databases are increasingly used.
It should be noted that the parameters also include an evaluation type, and the evaluation type includes an object structure, or an object structure and a session SQL. The initial query statement is a DDL in the object structure, or a DQL in the DDL and the session SQL.
After the task management phase, a source data acquisition phase is entered.
Further, the database compatibility evaluation method further includes: and desensitizing the initial query statement.
In this embodiment, in the source data acquisition stage, desensitization processing needs to be performed on the source data, so as to avoid information leakage in a service system, and further improve data security. The Data desensitization (Data mapping) is also called Data privacy removal or Data deformation, is a technical mechanism for transforming and modifying sensitive Data under given rules and strategies, and can solve the problem that the sensitive Data is used in an untrusted environment to a great extent. And according to the data protection specification and the desensitization strategy, implementing automatic deformation on the sensitive information in the service data (source data) to realize the hiding of the sensitive information.
The source data is an object structure of a business system stored in a source database, or an object structure and a session SQL. The manner in which the source data is obtained includes, but is not limited to, internal generation, external input. It will be appreciated that the present embodiments provide a variety of ways to obtain source data such that the source data sources are diversified rather than a single source.
The external input provides source data for a user according to a preset output format. Specifically, the external input may be obtained by automatically acquiring corresponding data from the source database by using other tools and then converting the corresponding data according to the preset output format; or the source data can be obtained by writing a file of the source data according to a preset output format by a service system according to actual use conditions.
In an exemplary embodiment, the database compatibility evaluation method further includes: acquiring a source data source; and if the source data source is generated internally, acquiring and automatically generating the initial query statement in a source database through a statement acquisition client.
In this embodiment, parameters in the task management stage are obtained, if the source data source is generated internally; the source data is acquired by the statement collection client in the source database and automatically generated.
Specifically, a corresponding data acquisition operation mode is selected according to the database type and version information of the source database, for example, the database type is MySQL, the version information is 5.7, and then the source data can be acquired through a general log.
If the evaluation type is the object structure, after determining the data acquisition mode, connecting the access address (for example, IP (Internet Protocol, internet protocol) address is 192.168.0.1 and port number 16666), the user name and the password of the source database to the source database; the source data in the object structure of the source database is collected according to a first preset data format and a database name to be evaluated (e.g., CRM (Customer Relationship Management, customer relationship management). Wherein the first preset data format is < database name, object type, DDL statement >. Wherein the object type includes tables, columns, pages, etc. wherein DDL is mainly used to create new library tables in the database, delete library tables, add fields, indexes, etc. for the tables, the key fields of the DDL statement include create, drop, ater, etc.
If the evaluation type is object structure and session SQL, the source data includes data in the object structure and data in the session SQL. On the basis of collecting data in the object structure, collecting data in a session SQL of the source database according to a second preset data format and a database name to be evaluated in a time period appointed by the collection duration, so as to obtain source data. The second preset data format is < database name, user name, session host information, and DQL statement >. Wherein the user name is the name of the user of the session established with the source database; session host information, i.e., information of a host used by the user when establishing the session, including an IP address, a MAC (Media Access Control Address ) address, etc.; the DQL is used to query records (data) in the database for table, the key fields of the DQL statement include select, where, etc.
Wherein both DDL and DQL belong to SQL.
The source data is stored in a specific directory for use in a subsequent compatibility evaluation stage.
In another exemplary embodiment, parameters in the task management stage are acquired, and if the source data source is an external input, the source data stored in the specific directory, which is generated by the user (the tool user) according to the first preset data format or the first preset data format and the second preset data format through the other tools, is acquired. Accordingly, for the object structure, the first preset data format is < database name, object type, DDL statement >. Wherein the object types include tables, columns, pages, and the like. Wherein the object types include tables, pages, and the like. For session SQL, the second preset data format is < database name, user name, session host information, DQL statement >. Wherein the user name is the name of the user of the session established with the source database; session host information, i.e., information of a host used by the user when establishing the session, includes an IP address, a MAC address, etc.
After the source data acquisition phase, a compatibility evaluation phase is entered.
In the compatibility evaluation phase:
step S120, carrying out specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of target query sentences is smaller than the number of initial query sentences.
Matching refers to matching repeated sentences in the initial query sentence or matching from the initial query sentence according to a grammar not supported in the new database. The specific processing aims to reduce the number of initial query sentences, so that fewer target query sentences are required to be executed when the target query sentences are executed in the new database, and the efficiency of compatibility evaluation is improved.
In an exemplary embodiment, the performing specific processing on the initial query statement to obtain a target query statement includes: matching one or more groups of repeated initial query sentences from the initial query sentences; and executing deleting operation on the repeated initial query sentences of each group, and reserving one initial query sentence in the repeated initial query sentences of each group to obtain a target query sentence.
In this embodiment, for matching duplicate sentences, after matching is completed for all the initial query sentences, the specific process further includes deleting duplicate sentences so that each initial query sentence is unique, i.e., each initial query sentence in the target query sentence is unique. For example, 2 db.getcollection ('event') are included in the initial query statement, 1 of them is deleted and 1 is retained.
In another exemplary embodiment, the performing specific processing on the initial query statement to obtain a target query statement includes: matching the initial query statement to obtain an unsupported initial query statement corresponding to an unsupported grammar in the new database; and eliminating the non-supported initial query statement to obtain a target query statement.
In this embodiment, for matching from the initial query statement according to the grammar that is not supported in the new database, the specific processing further includes removing, from the initial query statement, the initial query statement corresponding to the grammar that is not supported in the new database, to obtain the target query statement. For example, the database type of the source database is MySQL, and the initial query statement includes set varyiables, which is an initial query statement corresponding to a grammar that is not supported in the new database, and thus the set varyiables needs to be removed from the initial query statement.
Step S130, executing the target query statement in a new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
The database compatibility evaluation report is generated by the evaluation information corresponding to each item of target query statement, wherein the evaluation information can comprise evaluation time (i.e. current time), compatibility (i.e. whether the execution is successful) and the like. The compatibility may be the proportion of the target query statement compatible with the corresponding target query statement in the evaluation information to all the target query statements.
It should be noted that, in addition to the evaluation information corresponding to the target query statement, the database compatibility evaluation report further includes the evaluation information corresponding to the eliminated initial query statement. It will be appreciated that by determining whether the grammar of the initial query statement is a grammar that is not supported in the new database, compatibility results can be obtained without execution in the new database, i.e., where the grammar of the initial query statement is a grammar that is not supported in the new database, it can be determined that the initial query statement is not compatible in the new database.
It should be noted that the evaluation information may be stored by a table in the new database. Specifically, under the condition of ensuring that a new database can be accessed, an assembly_record_ "task name" database is created in the new database, an object_SQL table is created in the assembly_record_ "task name" database, and data in an OBJECT structure is imported into the object_SQL table, or an object_SQL table and an object_SQL table are created in the assembly_record_ "task name" database, and data in an OBJECT structure is imported into the object_SQL table, and data in a conversation SQL is imported into the object_SQL table.
The fields in the OBJECT_SQL table comprise the database type, the database name, the OBJECT type, the original DDL statement, the rewritten DDL statement, whether the original DDL is compatible, whether the rewritten DDL is compatible, whether the evaluation is completed, the evaluation time and the reason of incompatibility of the source database; the fields in the SESSION_SQL table include the database type of the source database, database name, user name, SESSION host information, SQL type, original DQL statement, rewritten DQL statement, whether original DQL is compatible, whether rewritten DQL is compatible, whether evaluation is complete, evaluation time, and reasons for incompatibility.
When the target query statement is executed in the new database, each row of data in the OBJECT_SQL table is read in the new database in sequence, and circulation processing is carried out. If the value of the field "whether evaluation is completed" is "yes" for each line of data, the initial query statement in the next line is continued to be executed. If the value of the field 'whether the evaluation is finished' is 'no', checking whether the field 'the rewritten DDL statement' has contents, if so, executing the value corresponding to the field 'the rewritten DDL statement', namely, the rewritten DDL statement, in a new database, if the execution is successful, setting the value of the field 'whether the rewritten DDL is compatible' of the row as 'yes', otherwise, setting the value as 'no', and filling in the corresponding 'incompatible reason', namely, the value of the field 'the incompatible reason' as the rewritten DDL incompatibility. If the field ' the rewritten DDL statement ' has no content, executing the value in the field ' the original DDL statement ', namely the original DDL statement, if the execution is successful, setting the value of the field ' whether the original DDL is compatible ' yes ', otherwise setting the value of the field ' no ', and filling in the corresponding ' incompatible reason ', namely the value of the field ' incompatible reason ' is the incompatibility of the original DDL. And the value of the field "whether evaluation is completed" is set to "yes", and the value of the field "evaluation time" is set to the current time.
After the OBJECT_SQL processing is finished, the compatibility evaluation of the session SQL is carried out. And reading each row of data in the OBJECT_SQL table in the new database in sequence, and performing cyclic processing. For each row of data, if the value of the field "whether evaluation is complete" is yes, then the next row is continued. If the value of the field 'whether the evaluation is finished' is 'no', checking whether the field 'the rewritten DQL statement' has contents, if so, executing the value of the field 'the rewritten DQL statement', namely the rewritten DQL statement, in a new database, if the execution is successful, setting the value of the field 'whether the rewritten DQL is compatible' of the row as 'yes', otherwise, setting as 'no', filling the corresponding 'incompatibility reason', namely the rewritten DQL statement is incompatible. If the field ' the rewritten DQL statement ' has no content, executing the value of the field ' the original DQL statement ', namely the original DQL statement, if the execution is successful, setting the value of the field ' whether the original DQL is compatible ' yes ', otherwise setting the value of the field ' no ', and filling in the corresponding ' incompatibility reason ', namely the original DQL statement is incompatible. And the value of the field "whether evaluation is completed" is set to "yes", and the value of the field "evaluation time" is set to the current time.
Further, before the target query statement is executed in the new database to obtain the database compatibility evaluation report, the method includes: according to a specific replacement rule, rewriting the target query statement; executing the target query statement in the new database to obtain a database compatibility evaluation report, including: and executing the rewritten target query statement in the new database to obtain a database compatibility evaluation report.
In this embodiment, the above-described DDL statement after writing and DQL statement after writing are obtained after writing by a specific replacement rule. It should be noted that, the replacement rule is related to the database type of the new database and the database type of the source database, and essentially, the replacement rule replaces the initial query statement applicable in the source database with the new query statement applicable in the new database, so that the operation implemented after the replaced initial query statement is executed is the same as the operation implemented after the replaced new query statement is executed. That is, the replacement rule is a new query term in the new database and an initial query term in the source database corresponding to the new query term, and the corresponding relation is that the operation implemented after the execution is the same. The varchar2 is automatically replaced with text, for example by a replacement rule.
It should be noted that, by setting the replacement rule, the feasibility of the replacement suggestion can be verified when the new query statement is executed through the new database, which can give instruction suggestions for subsequent migration work, thereby improving the efficiency of data migration.
Further, the database compatibility evaluation method further includes: and formatting the target query statement.
In this embodiment, in order to improve maintainability of the code, formatting processing may be performed on the target query statement, for example, supporting grammar conversion according to a new database (for example, converting the SQL statement into a lower case format, etc.), reducing a plurality of spaces in the target query statement to one space, etc. Moreover, formatting long query statements may also make them more readable and understandable.
For the non-relational database and the Key-Value database, it should be noted that SQL cannot be directly used, but there are corresponding query statements, and the specific implementation is basically the same as each embodiment of the relational database, and will not be described herein.
Further, the execution results (including whether the original DQL is compatible, whether the rewritten DQL is compatible, etc.) in the object_sql table and the session_sql table are sequentially read. And carrying out statistics and summarization on the data according to different dimensionalities of the execution result, so as to calculate the compatibility degree of the source database and the new database. And display it in the page, and export it as a result file for downloading according to the user's needs.
After the stages are completed, deleting the database corresponding to the database name from the new database, thereby saving storage resources.
In addition, the present application also provides a database compatibility evaluation apparatus, including:
a first obtaining module 20, configured to obtain an initial query statement in a source database;
a processing module 21, configured to perform a specific process on the initial query sentence, so as to obtain a target query sentence; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences;
an execution module 22, configured to execute the target query statement in a new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
Illustratively, the processing module 21 is specifically configured to:
matching one or more groups of repeated initial query sentences from the initial query sentences;
and executing deleting operation on the repeated initial query sentences of each group, and reserving one initial query sentence in the repeated initial query sentences of each group to obtain a target query sentence.
Illustratively, the processing module 21 is specifically configured to:
matching the initial query statement to obtain an unsupported initial query statement corresponding to an unsupported grammar in the new database;
and eliminating the non-supported initial query statement to obtain a target query statement.
Illustratively, the database compatibility evaluating apparatus further includes:
the rewrite module is used for rewriting the target query statement according to a specific replacement rule;
the execution module 22 is specifically configured to:
and executing the rewritten target query statement in the new database to obtain a database compatibility evaluation report.
Illustratively, the database compatibility evaluating apparatus further includes:
the second acquisition module is used for acquiring a source data source;
and the acquisition module is used for acquiring the initial query statement in the source database through the statement acquisition client if the source data source is generated internally.
Illustratively, the database compatibility evaluating apparatus further includes:
and the desensitization module is used for carrying out desensitization processing on the initial query statement.
Illustratively, the database compatibility evaluating apparatus further includes:
and the formatting module is used for formatting the target query statement.
The specific implementation manner of the database compatibility evaluation device is basically the same as that of each embodiment of the database compatibility evaluation method, and is not repeated here.
In addition, the application also provides electronic equipment. As shown in fig. 3, fig. 3 is a schematic structural diagram of a hardware running environment according to an embodiment of the present application.
As shown in fig. 3, the electronic device may include a processor 301, a communication interface 302, a memory 303, and a communication bus 304, where the processor 301, the communication interface 302, and the memory 303 perform communication with each other through the communication bus 304, and the memory 303 is used to store a computer program; the processor 301 is configured to implement the steps of the database compatibility evaluation method when executing the program stored in the memory 303.
The communication bus 304 mentioned above for the electronic device may be a Peripheral component interconnect standard (Peripheral ComponentInterconnect, PCI) bus or an extended industry standard architecture (Extended Industry StandardArchitecture, EISA) bus, etc. The communication bus 304 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface 302 is used for communication between the electronic device and other devices described above.
The Memory 303 may include a random access Memory (Random Access Memory, RMD) or may include a Non-Volatile Memory (NM), such as at least one disk Memory. Optionally, the memory 303 may also be at least one memory device located remotely from the aforementioned processor 301.
The processor 301 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific IntegratedCircuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The specific implementation manner of the electronic device is basically the same as the embodiments of the database compatibility evaluation method, and is not repeated here.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a database compatibility evaluation program, and the database compatibility evaluation program realizes the steps of the database compatibility evaluation method when being executed by a processor.
The specific embodiments of the computer readable storage medium of the present application are substantially the same as the embodiments of the database compatibility evaluation method described above, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance. It will also be understood that, although the terms "first," "second," etc. may be used in this document to describe various elements in some embodiments of the present application, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, a first table may be named a second table, and similarly, a second table may be named a first table without departing from the scope of the various described embodiments. The first table and the second table are both tables, but they are not the same table.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A database compatibility evaluation method, characterized in that the database compatibility evaluation method comprises the steps of:
acquiring an initial query statement in a source database;
performing specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences;
executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
2. The method for evaluating database compatibility according to claim 1, wherein performing a specific process on the initial query statement to obtain a target query statement comprises:
matching one or more groups of repeated initial query sentences from the initial query sentences;
and executing deleting operation on the repeated initial query sentences of each group, and reserving one initial query sentence in the repeated initial query sentences of each group to obtain a target query sentence.
3. The method for evaluating database compatibility according to claim 1, wherein performing a specific process on the initial query statement to obtain a target query statement comprises:
matching the initial query statement to obtain an unsupported initial query statement corresponding to an unsupported grammar in the new database;
and eliminating the non-supported initial query statement to obtain a target query statement.
4. The database compatibility evaluation method of claim 1, wherein the executing the target query statement in the new database, prior to obtaining the database compatibility evaluation report, comprises:
according to a specific replacement rule, rewriting the target query statement;
executing the target query statement in the new database to obtain a database compatibility evaluation report, including:
and executing the rewritten target query statement in the new database to obtain a database compatibility evaluation report.
5. The database compatibility evaluation method of claim 1, wherein the database compatibility evaluation method further comprises:
acquiring a source data source;
and if the source data source is generated internally, acquiring and automatically generating the initial query statement in a source database through a statement acquisition client.
6. The database compatibility evaluation method of claim 1, wherein the database compatibility evaluation method further comprises:
and desensitizing the initial query statement.
7. The database compatibility evaluation method of claim 1, wherein the database compatibility evaluation method further comprises:
and formatting the target query statement.
8. A database compatibility evaluation apparatus, characterized in that the database compatibility evaluation apparatus comprises:
the first acquisition module is used for acquiring an initial query statement in the source database;
the processing module is used for carrying out specific processing on the initial query statement to obtain a target query statement; the specific processing includes at least a match to the initial query statement; the number of the target query sentences is smaller than that of the initial query sentences;
the execution module is used for executing the target query statement in the new database to obtain a database compatibility evaluation report; the database compatibility evaluation report is used for evaluating the compatibility of a new database and the source database; the new database is a target database for data migration of the source database.
9. An electronic device, the electronic device comprising: a memory, a processor and a database compatibility evaluation program stored on the memory and executable on the processor, the database compatibility evaluation program being configured to implement the steps of the database compatibility evaluation method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a database compatibility evaluation program, which, when executed by a processor, implements the steps of the database compatibility evaluation method according to any one of claims 1 to 7.
CN202311301790.2A 2023-10-09 2023-10-09 Database compatibility evaluation method and device, electronic equipment and storage medium Pending CN117389986A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311301790.2A CN117389986A (en) 2023-10-09 2023-10-09 Database compatibility evaluation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311301790.2A CN117389986A (en) 2023-10-09 2023-10-09 Database compatibility evaluation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117389986A true CN117389986A (en) 2024-01-12

Family

ID=89467593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311301790.2A Pending CN117389986A (en) 2023-10-09 2023-10-09 Database compatibility evaluation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117389986A (en)

Similar Documents

Publication Publication Date Title
US8782604B2 (en) Sandbox support for metadata in running applications
CN109284323B (en) Management method and device for detection data
CN109739828B (en) Data processing method and device and computer readable storage medium
CN108573019B (en) Data migration method and device, electronic equipment and readable storage medium
US20070073675A1 (en) Database query translation
CN113204571B (en) SQL execution method and device related to write-in operation and storage medium
CN105608126A (en) Method and apparatus for establishing secondary indexes for massive databases
CN110799961A (en) System and method for creating and deleting tenants in database
CN112163025A (en) Database data exporting method and device, computer equipment and storage medium
CN112912870A (en) Tenant identifier conversion
CN114661715A (en) Database data processing method and device, storage medium and electronic equipment
US20210124752A1 (en) System for Data Collection, Aggregation, Storage, Verification and Analytics with User Interface
CN113468209A (en) High-speed memory database access method for power grid monitoring system
US20170262507A1 (en) Feedback mechanism for query execution
CN116483707A (en) Test method, test device, test apparatus, test program, and test program
CN115757174A (en) Database difference detection method and device
CN117389986A (en) Database compatibility evaluation method and device, electronic equipment and storage medium
CN112612818B (en) Data processing method and device, computing equipment and storage medium
CN110222105B (en) Data summarization processing method and device
CN114819631A (en) Multitask visualization method and device, computer equipment and storage medium
JP2018109898A (en) Data migration system
CN111651531A (en) Data import method, device, equipment and computer storage medium
CN111723104A (en) Method, device and system for syntax analysis in data processing system
CN116737113B (en) Metadata catalog management system and method for mass scientific data
KR102276290B1 (en) Apparatus for generating large scale test data

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