Artificial intelligence-based database metadata labeling method, medium and equipment
Through the database metadata annotation method based on artificial intelligence, the problem of low SQL statement quality caused by the missing or fuzzy information of the business database is solved. By annotating and modifying metadata, the generation quality of SQL statements is improved and higher accuracy is achieved. Sex and reliability.
Patent Information
- Application Number
- CN202411322740.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-10
AI Technical Summary
When generating SQL statements, the prior art is limited by the error in the understanding of the metadata of the business database, which leads to the low quality of the generated SQL statements and is difficult to meet the actual needs. The main reason is that the metadata information is missing or fuzzy.
Using the database metadata annotation method based on artificial intelligence, the database metadata information is obtained and judged whether the database metadata information complies with preset rules, and marks and modifys it. The neural network model is used to calculate the semantic similarity, generate test cases, execute SQL statements, and record the execution results. , gradually improve the quality of metadata.
It effectively improves the generation quality of SQL statements, solves the problems of incomplete or fuzzy metadata from the source, and improves the accuracy and reliability of SQL statements.
Smart Images

Figure CN119292919A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an artificial intelligence-based database metadata annotation method, medium, and device. Background Art
[0002] At present, in terms of generating SQL statements through artificial intelligence, major model manufacturers have conducted a large number of SQL case training on large models, so that the ability of large models to write SQL has reached a very high level. However, the actual accuracy of SQL generated by the TXT2SQL system is not high, and it is difficult to reach the commercial level. The core problem is no longer the lack of SQL writing ability of large models, but the misunderstanding of business database metadata, which limits the powerful SQL writing ability of large models and often writes low-quality SQL statements. The main reasons for the misunderstanding of business database metadata are different business database building styles, inaccurate or missing field information, missing field association information (this information is included in the application, but there is no related information in the database), ambiguous or similar semantics of field names, and ambiguous descriptions of table or view names.
[0003] The existing technology is constantly optimizing the TXT2SQL prompt word engineering. Through structured prompt word information, the business database information is transmitted to the large model as comprehensively as possible. However, the problem of low quality of the information source has not been solved. When the business database metadata itself lacks information or the information is vague, even if the quality of the prompt word engineering is improved, it will be limited in improving the SQL accuracy. Summary of the invention
[0004] In view of the above problems, the present application provides a technical solution for annotation of database metadata based on artificial intelligence to solve the problem that when the business database metadata itself lacks information or the information is vague, the generated SQL statements are of low quality and difficult to meet actual needs.
[0005] To achieve the above objectives, in a first aspect, the present application provides a database metadata annotation method based on artificial intelligence, the method comprising:
[0006] Obtaining metadata information of a first database;
[0007] Determine whether the first database metadata information complies with a preset rule, and if not, mark the corresponding stage of the first database metadata information, and note the reason for the non-compliance, and input the first database metadata information into a first neural network model, calculate the semantic similarity of each database parameter in the first database metadata information, and mark the database parameters whose similarity exceeds a first threshold;
[0008] Receive a modification instruction for a database parameter with a mark in the metadata information of the first database, call the database to perform a DML operation on the metadata information of the first database according to the modification instruction, obtain the metadata information of the second database, and input the metadata information of the second database into the first neural network model again, calculate the semantic similarity of each database parameter in the metadata information of the second database, and mark the database parameters whose similarity exceeds the first threshold; repeat the above steps until the first neural network model determines that the semantic similarity of each database parameter is below the first threshold;
[0009] A test case combination is generated based on a large language model, wherein the test case combination includes multiple groups of test cases, each test case is orthogonal and non-overlapping, each test case corresponds to a problem set in the preset rules, and an SQL statement is generated for the problem set in the preset rules, and a database is called to execute the SQL statement, and the execution result is recorded.
[0010] Furthermore, whether the preset rules are met includes any one or more of the following situations: whether the field description information is empty, whether the field name description information is repeated, whether the table or view description information is empty, whether the table or view description information is repeated, whether the function parameter description information is empty, whether the function parameter description information is repeated, and whether the function name is empty or repeated.
[0011] Furthermore, the semantic similarity of the database parameters includes any one or more of the semantic similarity of table field names, the semantic similarity of table names, the similarity of function names, and the semantic similarity of function parameter names.
[0012] Furthermore, the instruction to modify the database parameters includes modifying the database parameter name and adding a description of the cross-reference relationship between tables, and the database parameter name includes any one or more of a field name, a table name, a function name, and a function parameter name.
[0013] Furthermore, the method further comprises:
[0014] A test report is derived based on the execution results, wherein the test report includes multiple test result information, each of which includes a problem description corresponding to a test case, a generated SQL statement, the execution status of the SQL statement, and optimization suggestions.
[0015] Furthermore, the method further comprises:
[0016] The first neural network model comprehensively calculates a score for the received first database metadata information, determines whether the calculated score reaches a preset score, and issues a prompt message if not.
[0017] The comprehensive calculation of a score includes: calculating a score according to subject information related parameters in the metadata information of the first database, wherein the subject information related parameters include subject name completeness, subject description completeness, subject name similarity and cross-reference relationship completeness;
[0018] The subject information includes entity information and field information. The entity information includes tables, views and functions. The field information includes view table fields and function parameters.
[0019] The calculation formula for the completeness of the subject name is as follows: the number of subjects with complete names / the total number of subjects;
[0020] The calculation formula for the completeness of the subject description is as follows: the number of subjects with complete descriptions / the total number of subjects;
[0021] The calculation formula of the subject name similarity is as follows: number of subjects with similar names / total number of subjects;
[0022] The calculation formula of the cross-check relationship completeness is as follows: the number of complete cross-check relationships / the total number of subjects;
[0023] The calculation formula for calculating a score based on the subject information related parameters in the metadata information of the first database is as follows:
[0024] The formula for calculating the total score = (entity name completeness + field name completeness)*1000+(entity name similarity+field name similarity)*100+cross-reference relationship completeness*10.
[0025] Further, before receiving the modification instruction of the database parameter with the mark in the metadata information of the first database, it includes: generating a modification template according to the database parameter with the mark;
[0026] The receiving of a modification instruction for a database parameter having a mark in the metadata information of the first database includes:
[0027] Receiving a modification instruction for the database parameter of the modification template, determining whether the currently modified database parameter has changed by a vocabulary fuzzy matching algorithm, if not, keeping the configuration file unchanged, if changed, re-determining the first parameter in the monitoring program according to the modified database parameter, and mapping and storing the first parameter and the currently modified database parameter in the modification template;
[0028] The monitoring program is used to call the database to perform DML operations on the first database metadata information according to the modification instruction, and the configuration file is used to configure the mapping relationship between the first parameter and the database parameter names and coordinate positions in the modification template. The first parameter is the parameter name mapped to the database parameter names in the monitoring program.
[0029] Furthermore, the method further comprises:
[0030] Setting a modification template, wherein the modification template is used to change database parameters into qualified parameters and unqualified parameters, and write the qualified parameters into the first main table;
[0031] Preset more than two sub-modification templates and a supplementary template corresponding to each sub-modification template, divide the unqualified parameter into a plurality of sub-parameter data through the sub-modification template, and store the sub-parameter data in the corresponding temporary sub-table respectively;
[0032] Generate the to-be-supplemented information table of each corresponding temporary sub-table according to each supplementary template, and send the to-be-supplemented information table to the corresponding modification terminal;
[0033] Obtaining the modification information in the table of information to be supplemented by the modification terminal, and verifying whether the modification information is complete, and if so, updating the table of information to be supplemented in the temporary subtable according to the modification information;
[0034] The updated sub-parameter data in each temporarily stored sub-table are batch-written into the first main table and marked according to a preset period.
[0035] In a second aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the artificial intelligence-based database metadata annotation method as described in the first aspect of the present application.
[0036] In a third aspect, the present application provides an electronic device having a computer program stored thereon, including a processor and a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by the processor, the method for annotating database metadata based on artificial intelligence as described in the first aspect of the present application is implemented.
[0037] Different from the prior art, the above technical solution involves an artificial intelligence-based database metadata annotation method, medium and device. The method determines whether the first database metadata information complies with preset rules. If not, the corresponding stage of the first database metadata information is marked, and the reason for the non-compliance is noted, and the first database metadata information is input into a first neural network model, and the semantic similarity of each database parameter in the first database metadata information is calculated, and the database parameters whose similarity exceeds a first threshold are marked. After the first database metadata information is modified, the model is input again for the above judgment, and then test cases are used for coverage verification. This method can change the problem of incomplete or ambiguous database metadata information from the source, thereby improving the quality of subsequently generated SQL statements.
[0038] The above-mentioned records related to the invention content are only an overview of the technical solution of the present application. In order to enable ordinary technicians in the field to more clearly understand the technical solution of the present application, and then implement it according to the text of the specification and the contents recorded in the drawings, and to make the above-mentioned purpose and other purposes, features and advantages of the present application easier to understand, the following is an explanation in combination with the specific implementation mode and drawings of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings are only used to illustrate the principles, implementation methods, applications, characteristics and effects of the specific embodiments of the present invention and other related contents, and shall not be considered as limiting the present application.
[0040] In the drawings of the specification:
[0041] Figure 1 This is a flowchart of the method for annotating database metadata based on artificial intelligence according to the first exemplary embodiment of the present application;
[0042] Figure 2 This is a flow chart of the method for annotating database metadata based on artificial intelligence according to the second exemplary embodiment of the present application;
[0043] Figure 3 This is a flowchart of the method for annotating database metadata based on artificial intelligence according to the third exemplary embodiment of the present application;
[0044] Figure 4 This is a schematic diagram of a TXT2SQL database metadata marking and scoring system involved in an exemplary embodiment of the present application;
[0045] Figure 5 A schematic diagram of an electronic device according to an exemplary embodiment of the present application;
[0046] The reference numerals in the above drawings are described as follows:
[0047] 10. Electronic equipment;
[0048] 101. Processor;
[0049] 102. Storage medium. DETAILED DESCRIPTION
[0050] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects that can be achieved, the following is a detailed description of the specific embodiments listed in conjunction with the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0051] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The term "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present application, as long as there is no technical contradiction or conflict, the various technical features mentioned in the embodiments can be combined in any way to form a corresponding implementable technical solution.
[0052] Unless otherwise defined, the technical terms used in this document have the same meanings as those generally understood by those skilled in the art to which this application belongs; the use of relevant terms in this document is only for describing specific embodiments and is not intended to limit this application.
[0053] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" logical relationship.
[0054] In the present application, terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.
[0055] Without further limitations, in this application, the words "include", "comprises", "has" or other similar open-ended expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.
[0056] Similar to the understanding in the Examination Guidelines, in this application, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of this application, "multiple" means more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.
[0057] In the description of the embodiments of the present application, space-related expressions used, such as "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "vertical", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc., indicate the orientation or position relationship based on the orientation or position relationship shown in the specific embodiments or drawings, and are only for the convenience of describing the specific embodiments of the present application or facilitating the reader's understanding, and do not indicate or imply that the referred device or component must have a specific position, a specific orientation, or be constructed or operated in a specific orientation, and therefore cannot be understood as a limitation on the embodiments of the present application.
[0058] Unless otherwise expressly specified or limited, in the description of the embodiments of the present application, the terms such as "install", "connect", "connect", "fix", "set", etc. used should be understood in a broad sense. For example, the "connection" can be a fixed connection, a detachable connection, or an integrated setting; it can be a mechanical connection, an electrical connection, or a communication connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For technicians in the technical field to which the present application belongs, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0059] In the first aspect, Figure 1 As shown, the present application provides a method for annotating database metadata based on artificial intelligence, the method comprising:
[0060] First, proceed to step S101 to obtain metadata information of the first database;
[0061] Then, step S102 is entered to determine whether the first database metadata information complies with the preset rules. If not, step S103 is entered to mark the corresponding stage of the first database metadata information, and annotate the reason information of the non-compliance, and input the first database metadata information into the first neural network model, calculate the semantic similarity of each database parameter in the first database metadata information, and mark the database parameters whose similarity exceeds the first threshold;
[0062] Then, the process proceeds to step S104 to receive a modification instruction for a database parameter with a mark in the metadata information of the first database, and calls the database to perform a DML operation on the metadata information of the first database according to the modification instruction to obtain the metadata information of the second database, and inputs the metadata information of the second database into the first neural network model again, calculates the semantic similarity of each database parameter in the metadata information of the second database, and marks the database parameters whose similarity exceeds the first threshold;
[0063] Then, the process proceeds to step S105 to repeat the above steps until the first neural network model determines that the semantic similarity of each database parameter is below the first threshold;
[0064] Then, the process proceeds to step S106 to generate a test case combination based on the large language model, generate SQL statements for the questions set in the preset rules, call the database to execute the SQL statements, and record the execution results.
[0065] In step S101, the first database metadata information includes main body information, the main body information includes entity information and field information, the entity information includes tables, views and functions, and the field information includes view table fields and function parameters.
[0066] In step S102, whether the preset rules are met includes any one or more of the following situations: whether the field description information is empty, whether the field name description information is repeated, whether the table or view description information is empty, whether the table or view description information is repeated, whether the function parameter description information is empty, whether the function parameter description information is repeated, and whether the function name is empty or repeated.
[0067] In step S103, the non-compliance reason information refers to the type of reason why the metadata information in the current first database does not comply with the preset rules after comparison with the preset rules. By annotating the reason information, it is possible to facilitate more targeted modification of the metadata information that does not comply with the preset rules in the future.
[0068] In this embodiment, the first neural network model can be a convolutional neural network (CNN) or a recurrent neural network (RNN) and its variants (such as LSTM, GRU).
[0069] In step S104, the semantic similarity of the database parameters includes any one or more of the semantic similarity of table field names, the semantic similarity of table names, the semantic similarity of function names, and the semantic similarity of function parameter names.
[0070] The modification instruction of the database parameter includes modifying the database parameter name and adding a description of the cross-reference relationship between tables. The database parameter name includes any one or more of a field name, a table name, a function name, and a function parameter name.
[0071] The DML (Data Manipulation Language) operation is a subset of SQL (Structured Query Language) and is used to operate data in a database. DML operations mainly include adding, deleting, modifying and checking data in a database.
[0072] In step S106, the test case combination includes multiple groups of test cases, each test case is orthogonal and non-overlapping, and each test case corresponds to a problem set in the preset rules. By generating SQL statements based on the problems set in the preset rules and calling the database to execute the SQL statements, the integrity of the current database metadata can be verified.
[0073] The above scheme determines whether the metadata information of the first database complies with the preset rules. If not, the corresponding stage of the metadata information of the first database is marked, and the reason for the non-compliance is noted, and the first database metadata information is input into the first neural network model, and the semantic similarity of each database parameter in the metadata information of the first database is calculated. The database parameters whose similarity exceeds the first threshold are marked, and the first database metadata information is modified and input into the model again for the above judgment, and then the test case is used for coverage verification, which can change the problem of incomplete or ambiguous database metadata information from the source, thereby improving the quality of subsequently generated SQL statements.
[0074] In some embodiments, the method further includes: exporting a test report according to the execution result, the test report including multiple test result information, each test result information including a problem description corresponding to a test case, a generated SQL statement, the execution status of the SQL statement, and optimization suggestions. R&D personnel can adaptively modify metadata information or test cases according to the results of the test report to further improve the accuracy of subsequent SQL statement generation.
[0075] In some embodiments, the subject information related parameters include subject name completeness, subject description completeness, subject name similarity and cross-reference relationship completeness, and the method further includes:
[0076] The first neural network model comprehensively calculates a score for the received first database metadata information, determines whether the calculated score reaches a preset score, and issues a prompt message if not.
[0077] The comprehensive calculation of a score includes: calculating a score according to the subject information related parameters in the metadata information of the first database,
[0078] The calculation formula for the completeness of the subject name is as follows: the number of subjects with complete names / the total number of subjects;
[0079] The calculation formula for the completeness of the subject description is as follows: the number of subjects with complete descriptions / the total number of subjects;
[0080] The calculation formula of the subject name similarity is as follows: number of subjects with similar names / total number of subjects;
[0081] The calculation formula of the cross-check relationship completeness is as follows: the number of complete cross-check relationships / the total number of subjects;
[0082] The calculation formula for calculating a score based on the subject information related parameters in the metadata information of the first database is as follows:
[0083] The formula for calculating the total score = (entity name completeness + field name completeness)*1000+(entity name similarity+field name similarity)*100+cross-reference relationship completeness*10.
[0084] The calculated scores can accurately evaluate the integrity of the subject information related parameters, and then determine whether modifications are needed to improve the accuracy of the generated SQL statement. The prompt information can be a sound prompt, a light prompt, a vibration prompt, or a text or graphic prompt on the display interface of the display device.
[0085] In some embodiments, before receiving a modification instruction for a database parameter with a tag in the first database metadata information, the method includes: generating a modification template according to the database parameter with the tag;
[0086] like Figure 2 As shown, the receiving of the modification instruction of the database parameter with the mark in the metadata information of the first database includes:
[0087] First, enter step S201 to receive a modification instruction for the database parameter of the modification template, and determine whether the currently modified database parameter has changed through a vocabulary fuzzy matching algorithm;
[0088] If there is no change, proceed to step S202 to keep the configuration file unchanged;
[0089] If there is a change, the process proceeds to step S203 to redetermine the first parameter in the monitoring program according to the modified database parameter, and map and store the coordinate position of the first parameter and the currently modified database parameter in the modification template;
[0090] In this embodiment, the monitoring program is used to call the database to perform DML operations on the first database metadata information according to the modification instruction, and the configuration file is used to configure the mapping relationship between the first parameter and the various database parameter names and coordinate positions in the modification template. The first parameter is the parameter name mapped to the various database parameter names in the monitoring program.
[0091] Usually, there are multiple parameter names stored in the monitoring program, and the parameters in the template are mostly in the form of a common language. If the parameters are modified in the template, it is necessary to make adaptive modifications to the code in the monitoring program. In order to facilitate R&D personnel to quickly modify the database parameters, this application presents the modification template in the form of a visual interface for R&D personnel to operate. In the visual modification template, the name of the database parameter is usually in the form of a common language. When the R&D personnel adjust the database parameter name in the modification template, this application can perform vocabulary fuzzy matching on the content modified by the R&D personnel. If it is detected that the content and meaning of the parameter name before and after the modification have not changed, there is no need to adjust the mapping relationship of the parameter. If it is found that the meaning of the modified words before and after has changed, it means that the database-related parameter name of the corresponding regional position in the template has also changed, so it is necessary to re-match the mapping relationship, that is, to associate the first parameter in the monitoring program with the coordinate position of the current database parameter in the modification template. In this way, when the name in the template is modified, there is no need to re-monitor the code in the program, only the name in the monitoring program and the position in the template need to be remapped and matched, which effectively improves the modification efficiency.
[0092] In some embodiments, Figure 3 As shown, the method also includes:
[0093] First, enter step S301 to set a modification template, wherein the modification template is used to convert database parameters into qualified parameters and unqualified parameters, and write the qualified parameters into the first main table;
[0094] Then, step S302 is performed to preset two or more sub-modification templates and a supplementary template corresponding to each sub-modification template, and the unqualified parameter is divided into a plurality of sub-parameter data by the sub-modification template, and the sub-parameter data are respectively stored in the corresponding temporary sub-table;
[0095] Then, the process proceeds to step S303, generating a to-be-supplemented information table of each corresponding temporary sub-table according to each supplementary template, and sending the to-be-supplemented information table to the corresponding modification terminal;
[0096] Then, the process proceeds to step S304 to obtain the modification information in the table of information to be supplemented by the modification terminal, and to verify whether the modification information is complete. If so, the table of information to be supplemented in the temporary subtable is updated according to the modification information;
[0097] Then, the process proceeds to step S305 to batch write the updated sub-parameter data in each temporarily stored sub-table into the first main table and mark them according to a preset period.
[0098] In this embodiment, since the supplementation and modification of the database parameters cannot be completed in one go, the present application processes the supplemented content separately by setting up a temporary sub-table and a first main table. Specifically, the qualified parameter data after supplementation (that is, the parameter data that has passed the preliminary verification, such as the absence of spaces, duplications, etc.) is written into the first main table, and the unqualified part is written into the temporary sub-table, waiting for further modification and supplementation. After the parameter data in the temporary sub-table is also supplemented and qualified, the data in all the temporary sub-tables are uniformly transferred to the first main table at once. Compared with the method in which R&D personnel need to verify and modify the parameter data once they modify it, the modification and verification efficiency of the supplemented parameter data can be effectively improved.
[0099] In some embodiments, Figure 4 As shown, this application also provides a TXT2SQL database metadata tagging and scoring system, and the specific implementation steps are as follows:
[0100] (1) The system can automatically extract database metadata, including table structure, view, function and other information, based on the business database and account information configured by the operator.
[0101] (2) After obtaining the metadata, the rule pool is used to calculate the problematic content in the metadata, mainly including field description information being empty, field name description information being repeated, table or view description information being empty, table or view description information being repeated, function parameter description information being empty, function parameter description information being repeated, and function name being empty or repeated. Then, the semantic similarity of the table field name, table name semantic similarity, function name similarity, and function parameter name semantic similarity are calculated through the semantic similarity of the large model vector. If the similarity exceeds a certain threshold, a prompt mark is given. When the report is generated later, the operator can supplement and modify it. The modification methods include modifying the name and adding the cross-reference relationship description between tables, especially the cross-reference relationship description between table fields, which can greatly improve the quality of TXT2SQL generation.
[0102] (3) The system generates a detailed report page of the comprehensive score of the TXT2SQL recognition rate, including a detailed list of problems identified by the system. The operator can supplement and update the table field name, table name, function name, function parameter name, field cross-reference relationship, and view the reasons for the prompt, such as the name cannot be empty, similar semantics, unclear cross-reference relationship, etc.
[0103] (4) The operator marks and updates according to the prompt information.
[0104] (5) After the update is submitted, the system will call the database, perform DML operations, and update the database metadata information.
[0105] (6) Iterate the above steps (1)-(5) to continuously improve the comprehensive score. When the score exceeds the threshold, the operator can initiate a simulation verification operation. Based on the metadata information of the business table, the large language model is called to generate combined orthogonal non-overlapping questions that cover each table and view. SQL is generated for each question, the database is called to execute the SQL, and the execution results are recorded.
[0106] (7) After the simulation verification operation, the system generates an automatic verification detailed report page, including problem description, generated SQL statements, statement execution status, optimization suggestions and other information.
[0107] (8) After viewing the detailed report of the automatic verification, the operator can update the metadata according to the prompts. After the update, the operator can generate a comprehensive score report again to view the score and update the metadata to continuously improve the quality of the metadata.
[0108] In a second aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the artificial intelligence-based database metadata annotation method as described in the first aspect of the present invention.
[0109] The computer-readable storage medium may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories.
[0110] The non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD ROM); the magnetic surface memory can be a disk memory or a tape memory.
[0111] The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM). The computer-readable storage medium described in the embodiments of the present invention is intended to include these and any other suitable types of memory.
[0112] like Figure 5 As shown, in a third aspect, the present invention provides an electronic device 10, comprising a processor 101 and a storage medium 102, wherein a computer program is stored on the storage medium, and when the computer program is executed by the processor, the method for annotating database metadata based on artificial intelligence as described in the first aspect of the present invention is implemented.
[0113] In some embodiments, the processor can be implemented by software, hardware, firmware or a combination thereof, and can use a circuit, a single or multiple application specific integrated circuits (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (Programmable Logic Device, PLD), a field programmable gate array (Field Programmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, at least one of a microprocessor, so that the processor can execute some or all of the steps or any combination of the steps in the artificial intelligence-based database metadata annotation method described in the various embodiments of the present application.
[0114] Finally, it should be noted that although the above embodiments have been described in the specification and drawings of this application, this does not limit the scope of patent protection of this application. All technical solutions generated by replacing or modifying equivalent structures or equivalent processes based on the essential concept of this application using the contents recorded in the specification and drawings of this application, as well as directly or indirectly implementing the technical solutions of the above embodiments in other related technical fields, are included in the scope of patent protection of this application.
Claims
1. A database metadata annotation method based on artificial intelligence, characterized in that: The method comprises: Obtaining metadata information of a first database; Determine whether the first database metadata information complies with a preset rule, and if not, mark the corresponding stage of the first database metadata information, and note the reason for the non-compliance, and input the first database metadata information into a first neural network model, calculate the semantic similarity of each database parameter in the first database metadata information, and mark the database parameters whose similarity exceeds a first threshold; Receive a modification instruction for a database parameter with a mark in the metadata information of the first database, call the database to perform a DML operation on the metadata information of the first database according to the modification instruction, obtain the metadata information of the second database, and input the metadata information of the second database into the first neural network model again, calculate the semantic similarity of each database parameter in the metadata information of the second database, and mark the database parameters whose similarity exceeds the first threshold; repeat the above steps until the first neural network model determines that the semantic similarity of each database parameter is below the first threshold; A test case combination is generated based on a large language model, wherein the test case combination includes multiple groups of test cases, each test case is orthogonal and non-overlapping, each test case corresponds to a problem set in the preset rules, and an SQL statement is generated for the problem set in the preset rules, and a database is called to execute the SQL statement, and the execution result is recorded.
2. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: Whether the preset rules are met includes any one or more of the following situations: whether the field description information is empty, whether the field name description information is repeated, whether the table or view description information is empty, whether the table or view description information is repeated, whether the function parameter description information is empty, whether the function parameter description information is repeated, and whether the function name is empty or repeated.
3. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: The semantic similarity of the database parameters includes any one or more of the semantic similarity of table field names, the semantic similarity of table names, the similarity of function names, and the semantic similarity of function parameter names.
4. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: The modification instruction of the database parameter includes modifying the database parameter name and adding a description of the cross-reference relationship between tables. The database parameter name includes any one or more of a field name, a table name, a function name, and a function parameter name.
5. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: The method further comprises: A test report is derived based on the execution results, wherein the test report includes multiple test result information, each of which includes a problem description corresponding to a test case, a generated SQL statement, the execution status of the SQL statement, and optimization suggestions.
6. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: The method further comprises: The first neural network model comprehensively calculates a score for the received metadata information of the first database, determines whether the calculated score reaches a preset score, and issues a prompt message if not; The comprehensive calculation of a score includes: calculating a score according to subject information related parameters in the metadata information of the first database, wherein the subject information related parameters include subject name completeness, subject description completeness, subject name similarity and cross-reference relationship completeness; The subject information includes entity information and field information. The entity information includes tables, views and functions. The field information includes view table fields and function parameters. The calculation formula for the completeness of the subject name is as follows: the number of subjects with complete names / the total number of subjects; The calculation formula for the completeness of the subject description is as follows: the number of subjects with complete descriptions / the total number of subjects; The calculation formula of the subject name similarity is as follows: number of subjects with similar names / total number of subjects; The calculation formula of the cross-check relationship completeness is as follows: the number of complete cross-check relationships / the total number of subjects; The calculation formula for calculating a score based on the subject information related parameters in the metadata information of the first database is as follows: The formula for calculating the total score = (entity name completeness + field name completeness)*1000+(entity name similarity+field name similarity)*100+cross-reference relationship completeness*10.
7. The method for labeling database metadata based on artificial intelligence according to claim 1, characterized in that: Before receiving a modification instruction for a database parameter with a mark in the metadata information of the first database, the method includes: generating a modification template according to the database parameter with the mark; The receiving of a modification instruction for a database parameter having a mark in the metadata information of the first database includes: Receiving a modification instruction for the database parameter of the modification template, determining whether the currently modified database parameter has changed by a vocabulary fuzzy matching algorithm, if not, keeping the configuration file unchanged, if changed, re-determining the first parameter in the monitoring program according to the modified database parameter, and mapping and storing the first parameter and the currently modified database parameter in the modification template; The monitoring program is used to call the database to perform DML operations on the first database metadata information according to the modification instruction, and the configuration file is used to configure the mapping relationship between the first parameter and the database parameter names and coordinate positions in the modification template. The first parameter is the parameter name mapped to the database parameter names in the monitoring program.
8. The method for labeling database metadata based on artificial intelligence according to claim 7, characterized in that: The method further comprises: Setting a modification template, wherein the modification template is used to change database parameters into qualified parameters and unqualified parameters, and write the qualified parameters into the first main table; Preset more than two sub-modification templates and a supplementary template corresponding to each sub-modification template, divide the unqualified parameter into a plurality of sub-parameter data through the sub-modification template, and store the sub-parameter data in the corresponding temporary sub-table respectively; Generate the to-be-supplemented information table of each corresponding temporary sub-table according to each supplementary template, and send the to-be-supplemented information table to the corresponding modification terminal; Obtaining the modification information in the table of information to be supplemented by the modification terminal, and verifying whether the modification information is complete, and if so, updating the table of information to be supplemented in the temporary subtable according to the modification information; The updated sub-parameter data in each temporarily stored sub-table are batch-written into the first main table and marked according to a preset period.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for labeling database metadata based on artificial intelligence as described in any one of claims 1 to 8 is implemented.
10. An electronic device having a computer program stored thereon, characterized in that: It includes a processor and a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by the processor, the method for annotating database metadata based on artificial intelligence as described in any one of claims 1 to 8 is implemented.