An automatic verification method for SQL migration adaptation based on large models

Through the large-model-based SQL migration adaptation automatic verification method, the problems of database migration lag and high labor costs in the existing technology are solved, and efficient SQL migration adaptation and testing verification are achieved.

CN117421303BActive Publication Date: 2024-12-31YUEZHI ARTIFICIAL INTELLIGENCE (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311449018.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-01
Publication Date
2024-12-31
Estimated Expiration
2043-11-01

AI Technical Summary

Technical Problem

Existing database migration technologies have problems such as lag, low coverage and high labor costs, especially during SQL migration adaptation and testing and verification.

Method used

Using the SQL migration adaptive automatic verification method based on large models, the SQL migration tool sends prompt words and performs processing, generates and verifys test data, reducing manual operations and errors.

Benefits of technology

It improves the efficiency and accuracy of SQL migration adaptation conversion, reduces labor costs, and realizes automated test data generation and verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117421303B_ABST
    Figure CN117421303B_ABST
Patent Text Reader

Abstract

The present invention discloses an automatic verification method for SQL migration adaptation based on a large model. The present invention automatically sends corresponding prompt words to the large model through an SQL migration tool, and performs corresponding processing and application according to the data fed back by the large model, so that the user only needs to select the migration type without performing other complex operations, and can realize the test data generation and test verification of SQL adaptation conversion, improve efficiency, and avoid the problem of inaccurate test results caused by deviation in understanding of prompt words when manually inputting prompt words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database migration tools, and in particular to an automatic verification method for SQL migration adaptation based on a large model. Background Art

[0002] There are basically two solutions for existing database migration:

[0003] Solution 1: Rule-based SQL migration adaptation technology combines the syntax rules of the source and target ends, and precipitates a transformation rule set based on historical project experience, and the subsequent SQL migration adaptation reuses the rule set. This solution has two major problems: 1. It is lagging and cannot adapt to changes quickly; 2. The coverage of SQL migration adaptation is low, often less than 80%;

[0004] Solution 2: Directly use large models such as GPT. Users directly input source-side SQL, and the model returns the adapted target-side SQL. The problem with this solution is that each engineer has a different level of skill in using the prompt words of the large model, and it often takes multiple rounds of conversations to get the desired results. In addition, experience and best practices cannot be well accumulated.

[0005] The above two solutions can only solve the problem of SQL adaptation and conversion. Test data generation and test verification are mainly completed manually, and the labor cost of the whole process remains high.

[0006] Therefore, the prior art has defects and needs to be improved. Summary of the invention

[0007] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a large model-based SQL migration adaptation automatic verification method.

[0008] The technical solution of the present invention is as follows: a method for automatic verification of SQL migration adaptation based on a large model is provided, comprising the following steps:

[0009] Step 1: The user selects the migration type, including the source or target type;

[0010] Step 2: Upload SQL data based on the migration type selected by the user. Use the SQL migration tool to perform OCR recognition and SQL merge on the uploaded data, and then return the formatted SQL code.

[0011] Step 3: Convert the format of SQL data and return the converted SQL code;

[0012] Step 4: Identify data objects, identify table names and field names in SQL code, and feedback and execute DDL;

[0013] Step 5: Generate test data based on the DDL fed back in step 4;

[0014] Step 6: Execute SQL, compare data, and return the results.

[0015] Furthermore, the specific steps of step 1 are:

[0016] Step 1.1: When the user enters the selection page, the SQL migration tool displays matching prompt words for the user to select;

[0017] Step 1.2: Match the SQL migration tool database according to the type selected by the user;

[0018] Step 1.3: After the matching is completed, return the prompt word set to the SQL migration tool.

[0019] Furthermore, the specific steps of step 3 are:

[0020] Step 3.1: The SQL migration tool converts the current SQL into the target database SQL;

[0021] Step 3.2: The large model returns the converted SQL code to the SQL migration tool according to the SQL format conversion;

[0022] Step 3.3: The SQL migration tool returns the conversion results to the user.

[0023] Furthermore, the specific steps of step 4 are:

[0024] Step 4.1: The SQL migration tool identifies the table name and field name in the SQL;

[0025] Step 4.2: The large model feeds back the structure and DDL in XML format to the SQL migration tool based on the identified table name and field name;

[0026] Step 4.3: The SQL migration tool executes the DDL.

[0027] Furthermore, the specific steps of step 5 are:

[0028] Step 5.1: The SQL migration tool sends a request to the big model;

[0029] Step 5.2: The large model generates N test data according to the table name and field name in the DLL and returns the DML statement;

[0030] Step 5.3: SQL migration tool executes DML.

[0031] The SQL migration tool includes a controller, a task executor, a data source connector, a model connector, a prompt word library, a migration template library, and a SQL migration tool database;

[0032] in:

[0033] The controller is used to orchestrate SQL migration adaptation tasks;

[0034] The task executor is used to record and execute tasks;

[0035] The data source connector is used to connect the source end and the target end;

[0036] The model connector is used to store and connect model keys;

[0037] The prompt word library is used to store prompt words;

[0038] The migration template library is used to distinguish different migration types.

[0039] By adopting the above scheme, the present invention automatically sends corresponding prompt words to the big model through the SQL migration tool, and performs corresponding processing and application according to the data fed back by the big model, so that the user only needs to select the migration type without performing other complex operations, and can realize the test data generation and test verification of SQL adaptive conversion, thereby improving efficiency and avoiding the problem of inaccurate test results caused by deviations in the understanding of prompt words when manually inputting prompt words. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the process of the present invention.

[0041] Figure 2 It is a schematic block diagram of the structure of the present invention. DETAILED DESCRIPTION

[0042] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0043] See also Figure 1 The present invention provides a SQL migration adaptation automatic verification method based on a large model, comprising the following steps:

[0044] Step 1: The user selects the migration type, including the source or target type. The specific steps are:

[0045] Step 1.1: When the user enters the selection page, the SQL migration tool displays matching prompt words for the user to select;

[0046] Step 1.2: Match the SQL migration tool database according to the type selected by the user;

[0047] Step 1.3: After the matching is completed, return the prompt word set to the SQL migration tool.

[0048] Step 2: Upload SQL data based on the migration type selected by the user. Use the SQL migration tool to perform OCR recognition and SQL merge on the uploaded data, and then return the formatted SQL code.

[0049] Step 3: Convert the format of SQL data and return the converted SQL code. The specific steps are:

[0050] Step 3.1: The SQL migration tool converts the current SQL into the target database SQL;

[0051] Step 3.2: The large model returns the converted SQL code to the SQL migration tool according to the SQL format conversion;

[0052] Step 3.3: The SQL migration tool returns the conversion results to the user.

[0053] Step 4: Identify data objects, identify table names and field names in SQL code, and feedback and execute DDL. The specific steps are:

[0054] Step 4.1: The SQL migration tool identifies the table name and field name in the SQL;

[0055] Step 4.2: The large model feeds back the structure and DDL in XML format to the SQL migration tool based on the identified table name and field name;

[0056] Step 4.3: The SQL migration tool executes the DDL.

[0057] Step 5: Generate test data based on the DDL feedback in step 4. The specific steps are:

[0058] Step 5.1: The SQL migration tool sends a request to the big model;

[0059] Step 5.2: The large model generates N test data according to the table name and field name in the DLL and returns the DML statement;

[0060] Step 5.3: SQL migration tool executes DML.

[0061] Step 6: Execute SQL, compare data, and return the results.

[0062] In some embodiments, see Figure 2 ,The SQL migration tool includes a controller, a task executor, a data source connector, a model connector, a prompt lexicon, a migration template library, and a SQL migration tool database.

[0063] in:

[0064] The controller is used to orchestrate SQL migration adaptation tasks.

[0065] The task executor is used to record and execute tasks.

[0066] The data source connector is used to connect the source end and the target end.

[0067] The model connector is used to store and connect model keys, thereby sending corresponding prompt words and requests to the big model.

[0068] The prompt word library is used to store prompt words. When prompt words need to be sent to the large model, they can be called from the prompt word library first.

[0069] The migration template library is used to distinguish different migration types.

[0070] Large models can use tools such as ChatGPT, Brad, Baidu or Tongyi Qianwen to provide corresponding prompt word feedback.

[0071] The present invention adopts Oracle-PG migration type as an embodiment. When performing migration, the user selects the source end and / or target end type in the migration type in the SQL migration tool. The SQL migration tool matches the corresponding prompt word according to the selected type and calls the corresponding prompt word set. The user uploads SQL, and after the SQL migration tool performs OCR recognition on the pictures uploaded by the user or the manually input data, SQL merging is performed to realize the processing of the data. Then the user converts the SQL program by himself, and the requirement converts Oracle into PG (PostgreSQL). After the large model receives the request and the prompt word, it performs the conversion and feeds back the converted SQL code. Then the prompt word is sent to the large model, requesting to identify the table name and field name in the SQL code, and the large model executes the instruction and returns the structure and DDL in xml format, so that the SQL migration tool can execute DDL. Then the large model is requested to generate test data, and the large model generates N test data according to the table name and field name in the DDL, and returns the DML statement, which is executed by the SQL migration tool. Finally, SQL is executed by the SQL migration tool, and the generated data is compared with the recorded data content to obtain the corresponding SQL migration result.

[0072] The above embodiment takes the conversion of Oracle to PG as an example to introduce the SQL migration process provided by the present invention. In practical applications, it is also applicable to other heterogeneous migrations, such as Oracle to MySQL, DB2 to PG and other different heterogeneous migration methods.

[0073] In summary, the present invention automatically sends corresponding prompt words to the big model through the SQL migration tool, and performs corresponding processing and application according to the data fed back by the big model, so that the user only needs to select the migration type without performing other complex operations, and can realize the test data generation and test verification of SQL adaptation conversion, thereby improving efficiency and avoiding the problem of inaccurate test results caused by deviations in the understanding of prompt words when manually inputting prompt words.

[0074] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A SQL migration adaptation automatic verification method based on a large model, characterized in that: The steps include: Step 1: The user selects the migration type, including the source or target type. The specific steps are as follows: Step 1.1: When the user enters the selection page, the SQL migration tool displays matching prompt words for the user to select; Step 1.2: Match the SQL migration tool database according to the type selected by the user; Step 1.3: After matching is completed, return the prompt word set to the SQL migration tool; Step 2: Upload SQL data based on the migration type selected by the user. Use the SQL migration tool to perform OCR recognition and SQL merge on the uploaded data, and then return the formatted SQL code. Step 3: Convert the format of SQL data and return the converted SQL code; the specific steps are: Step 3.1: The SQL migration tool converts the current SQL into the target database SQL; Step 3.2: The large model returns the converted SQL code to the SQL migration tool according to the SQL format conversion; Step 3.3: The SQL migration tool returns the conversion results to the user. Step 4: Identify data objects, identify table names and field names in SQL code, and feedback and execute DDL; the specific steps are: Step 4.1: The SQL migration tool identifies the table name and field name in the SQL; Step 4.2: The large model feeds back the structure and DDL in XML format to the SQL migration tool based on the identified table name and field name; Step 4.3: SQL migration tool executes DDL; Step 5: Generate test data based on the DDL feedback in step 4; the specific steps are: Step 5.1: The SQL migration tool sends a request to the big model; Step 5.2: The large model generates N test data according to the table name and field name in the DLL and returns the DML statement; Step 5.3: SQL migration tool executes DML; Step 6: Execute SQL, compare data, and return the results.

2. The large model-based SQL migration adaptation automatic verification method according to claim 1 is characterized in that: The SQL migration tool includes a controller, a task executor, a data source connector, a model connector, a prompt word library, a migration template library, and a SQL migration tool database; in: The controller is used to orchestrate SQL migration adaptation tasks; The task executor is used to record and execute tasks; The data source connector is used to connect the source end and the target end; The model connector is used to store and connect model keys; The prompt word library is used to store prompt words; The migration template library is used to distinguish different migration types.