Method, device and electronic equipment for generating database operation rules

By automatically identifying and generating database operation rules, the problem of low efficiency in generating database operation rules has been solved, achieving efficient and reasonable generation of database operation rules and reducing manual verification costs and operation and maintenance costs.

CN115794774BActive Publication Date: 2026-03-20INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies have low efficiency in generating database operation rules, resulting in wasted human resources and poor database performance.

Method used

By identifying target keywords in the operation text of the target database, determining the first and second text fragments in the operation instructions, generating database operation rules, automatically extracting operation triggering conditions and triggering operations, and reducing manual verification costs.

Benefits of technology

It improves the efficiency of generating database operation rules, ensures the rationality of generated rules, and reduces operation and maintenance costs and the problem of low database operating efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794774B_ABST
    Figure CN115794774B_ABST
Patent Text Reader

Abstract

The application discloses a database operation rule generation method and device and electronic equipment, and relates to the technical field of databases. The method comprises the following steps: obtaining an operation text of a target database, wherein the operation text is used for recording operation instruction information of the target database; identifying a target keyword in the operation text, and determining a first text segment and a second text segment in the operation instruction information according to the target keyword, wherein the first text segment is used for representing a plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used for representing a plurality of trigger operations specified in the operation instruction information; and generating a plurality of database operation rules according to the first text segment and the second text segment, wherein each database operation rule is composed of at least one operation trigger condition and at least one trigger operation. The application solves the technical problem of low database operation rule generation efficiency in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database, and in particular, to a database operation rule generation method and device and electronic equipment. BACKGROUND

[0002] DDL is a kind of database operation rule that must be compiled by computer software and converted into a database operation rule convenient for computer storage, query and operation. Generally, the developer needs to manually check the operation specification information corresponding to each database, and then compiles the DDL according to the operation specification information.

[0003] However, due to the great difference between the operation specification information corresponding to the databases of different manufacturers, and even for the databases of the same manufacturer, the operation specification information is constantly changing with the continuous updating of database technology. Therefore, for the developer, when manually checking and compiling a large amount of operation specification information, a lot of manpower cost will be wasted, resulting in low efficiency of DDL generation. In addition, if an error occurs during manual checking, which leads to unreasonable DDL compilation, it will also cause poor database running condition, so that the developer can only recompile the DDL, thereby further exacerbating the problem of low efficiency of DDL generation.

[0004] At present, there is no effective solution to the above problems. SUMMARY

[0005] The embodiments of the present application provide a database operation rule generation method, device and electronic equipment, to at least solve the technical problem of low efficiency of database operation rule generation in the prior art.

[0006] According to an aspect of an embodiment of the present application, a database operation rule generation method is provided, comprising: obtaining an operation text of a target database, wherein the operation text is used to record operation specification information of the target database; identifying a target keyword in the operation text, and determining a first text segment and a second text segment in the operation specification information according to the target keyword, wherein the first text segment is used to represent a plurality of operation trigger conditions specified in the operation specification information, and the second text segment is used to represent a plurality of trigger operations specified in the operation specification information; generating a plurality of database operation rules according to the first text segment and the second text segment, wherein each database operation rule is composed of at least one operation trigger condition and at least one trigger operation, and the database operation rule is used to perform an update operation on a target table in the target database.

[0007] Further, the method for generating database operation rules further comprises: identifying a first target keyword in the operation text, wherein the first target keyword is used to describe attribute information of the target database; determining a first text segment in the operation description information according to the first target keyword; identifying a second target keyword and a third target keyword in the operation text, wherein the second target keyword is used to describe a plurality of operation instructions of the target database, and the third target keyword is used to describe an operation sequence between the plurality of operation instructions; and determining a second text segment in the operation description information according to the second target keyword and the third target keyword.

[0008] Further, the method for generating database operation rules further comprises: before generating a plurality of database operation rules according to the first text segment and the second text segment, identifying a fourth target keyword in the operation text, wherein the fourth target keyword is used to describe operation suggestion information provided by the target object, and the operation suggestion information is an operation suggestion about the target database under each operation trigger condition.

[0009] Further, the method for generating database operation rules further comprises: determining a plurality of operation trigger conditions and three-element information of each operation trigger condition according to the first text segment, wherein the three-element information at least includes a judgment subject, a judgment logic and a judgment content of the operation trigger condition; determining a plurality of trigger operations according to the second text segment; determining a target trigger operation corresponding to each operation trigger condition from the plurality of trigger operations according to the three-element information and the fourth target keyword, wherein the target trigger operation at least includes at least one operation instruction that the target database needs to perform under each operation trigger condition and an execution sequence of each operation instruction; and generating a plurality of database operation rules according to each operation trigger condition and the target trigger operation corresponding to each operation trigger condition.

[0010] Further, the method for generating database operation rules further comprises: generating a condition set according to the plurality of operation trigger conditions; and performing a first preset operation according to the condition set, wherein the first preset operation is used to generate a first database operation rule, and the first database operation rule is composed of one operation trigger condition in the condition set and a target trigger operation corresponding to the operation trigger condition; and performing the first preset operation for multiple times until a first database operation rule corresponding to each operation trigger condition is generated, thereby obtaining a plurality of first database operation rules.

[0011] Further, the first preset operation includes the following process: determining any one operation trigger condition in the condition set as a first operation trigger condition; determining a target trigger operation corresponding to the first operation trigger condition as a first trigger operation; generating a first database operation rule according to the first operation trigger condition and the first trigger operation, and deleting the first operation trigger condition from the condition set. Further, the method for generating a database operation rule further includes: after generating a condition set according to a plurality of operation trigger conditions, detecting whether the number of operation trigger conditions contained in the condition set is greater than a preset threshold; in the case where the number is greater than the preset threshold, dividing the condition set into a plurality of sub-sets, wherein each sub-set contains at least two operation trigger conditions; generating a second database operation rule according to each sub-set; and controlling the target database to execute the second database rule corresponding to the sub-set when the target database satisfies all operation trigger conditions in the sub-set.

[0012] Further, the method for generating a database operation rule further includes: generating a sequence of sets according to a plurality of sub-sets; and performing a second preset operation according to the sequence of sets, wherein the second preset operation is used to generate a second database operation rule, and the second database operation rule is composed of at least two operation trigger conditions in a sub-set and target trigger operations corresponding to the at least two operation trigger conditions; and performing the second preset operation multiple times until a second database operation rule corresponding to each sub-set is generated, obtaining a plurality of second database operation rules.

[0013] Further, the second preset operation includes the following process: determining any one sub-set in the sequence of sets as a target sub-set; determining each operation trigger condition in the target sub-set as a second operation trigger condition; determining a target trigger operation corresponding to the second operation trigger condition as a second trigger operation; generating a second database operation rule corresponding to the target sub-set according to the second operation trigger condition and the second trigger operation, and deleting the target sub-set from the sequence of sets.

[0014] Further, the method for generating a database operation rule further includes: after generating a plurality of database operation rules according to the first text segment and the second text segment, receiving a rule query instruction sent by a client, wherein the rule query instruction contains at least a rule identifier; determining a target database operation rule from the plurality of database operation rules according to the rule identifier; and returning the target database operation rule to the client.

[0015] Further, the method for generating database operation rules further comprises: after generating the plurality of database operation rules according to the first text segment and the second text segment, detecting a condition quantity of the operation trigger condition corresponding to each database operation rule; and determining a priority corresponding to each database operation rule according to the condition quantity, wherein the priority is used to represent an execution order of at least two database operation rules in the target database when the target database simultaneously satisfies the operation trigger conditions corresponding to the at least two database operation rules.

[0016] According to another aspect of the embodiments of the present application, a device for generating database operation rules is also provided, comprising: an obtaining module configured to obtain operation text of a target database, wherein the operation text is used to record operation instruction information of the target database; a determining module configured to identify a target keyword in the operation text, and determine a first text segment and a second text segment in the operation instruction information according to the target keyword, wherein the first text segment is used to represent a plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used to represent a plurality of trigger operations specified in the operation instruction information; and a generating module configured to generate a plurality of database operation rules according to the first text segment and the second text segment, wherein each database operation rule is composed of at least one operation trigger condition and at least one trigger operation, and the database operation rule is used to perform an update operation on a target table in the target database.

[0017] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising one or more processors and a memory, the memory being configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method for generating database operation rules.

[0018] In the present application, the target keyword is identified, and the database operation rules are generated according to the first text segment and the second text segment. First, the operation text of the target database is obtained, wherein the operation text is used to record the operation instruction information of the target database. Then, the target keyword in the operation text is identified, and the first text segment and the second text segment in the operation instruction information are determined according to the target keyword. Finally, the plurality of database operation rules are generated according to the first text segment and the second text segment. The first text segment is used to represent the plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used to represent the plurality of trigger operations specified in the operation instruction information. Each database operation rule is composed of at least one operation trigger condition and at least one trigger operation, and the database operation rule is used to perform an update operation on the target table in the target database.

[0019] From the above, the application extracts the operation trigger condition and the trigger operation for generating the database operation rule from the operation instruction information automatically by identifying the target keyword in the operation text and determining the first text segment and the second text segment in the operation instruction information according to the target keyword, thereby saving a large amount of manual checking cost, avoiding the error-prone problem of manual checking, and achieving the effect of improving the generation efficiency of the database operation rule.

[0020] Therefore, the technical scheme of the application achieves the purpose of automatically generating the database operation rule, thereby achieving the technical effect of reducing the checking cost of checking the operation instruction information manually, and further solving the technical problem of low generation efficiency of the database operation rule in the prior art. BRIEF DESCRIPTION OF DRAWINGS

[0021] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not limit the application in any way. In the drawings:

[0022] Figure 1 is a flowchart of an optional generation method of a database operation rule according to an embodiment of the application;

[0023] Figure 2 is a generation flowchart of a first database operation rule according to an embodiment of the application;

[0024] Figure 3 is another optional generation flowchart of a database operation rule according to an embodiment of the application;

[0025] Figure 4 is a generation flowchart of a second database operation rule according to an embodiment of the application;

[0026] Figure 5 is a schematic diagram of an optional generation device of a database operation rule according to an embodiment of the application;

[0027] Figure 6 is a schematic diagram of an optional electronic device according to an embodiment of the application. DETAILED DESCRIPTION

[0028] In order for those skilled in the art to better understand the technical scheme of the application, the technical scheme in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, not all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the application.

[0029] It should be noted that the terms "first", "second", and the like in the description and in the claims of the present application and in the above description of the drawings are intended to distinguish between similar objects and not necessarily in an ordinal sense. It will be understood that the terms so used are interchangeable under appropriate circumstances and embodiments of the application described herein are capable of operating in other sequences than those described or otherwise illustrated herein. Furthermore, the terms "comprise", "comprising", "include", "including" and the like are intended to cover non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise, include, or the like a list of steps or elements do not necessarily comprise, include, or the like only those steps or elements expressly listed, but can include other steps or elements not expressly listed or inherent to such processes, methods, articles, or apparatuses.

[0030] Embodiment 1

[0031] According to the embodiments of the present application, an embodiment of a method for generating a database operation rule is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.

[0032] In addition, in order to better understand the scheme of the embodiments of the present application, the following explains the professional terms used in the present application:

[0033] DDL: Data Definition Language, is responsible for the definition of database data structure and database object definition language, usually composed of Creat (create), Alter (modify) and Drop (destroy) syntax. DDL can also be understood as a kind of must be compiled by computer software, converted into convenient for computer storage, query and operation of database operation rules.

[0034] DML: Data Manipulation Language, is a programming statement for running access work on objects and data in the database, usually with Select, Insert, Update, Delete instructions as the core, respectively representing data query, insertion, update (modification) and deletion operation.

[0035] NLP: Natural Language Processiong, is an important direction in the field of computer science and artificial intelligence, mainly applied to machine translation, public opinion monitoring, automatic abstract, opinion extraction, text classification and text semantic comparison, question and answer, speech recognition and OCR (Optical Character Recognition) character recognition and other aspects.

[0036] Figure 1 is a flow chart of an optional database operation rule generation method according to an embodiment of the application, as shown in the method comprises the following steps: Figure 1

[0037] Step S101, obtaining the operation text of the target database.

[0038] In step S101, the operation text is used to record the operation instruction information of the target database. Specifically, the above-mentioned target database can be any version of database from different manufacturers. For example, the target database can be A1 version of database of A manufacturer, or B1 version of database of B manufacturer. The above-mentioned operation file includes but is not limited to technical guide file, technical description file, technical specification file of target database. The operation file records the operation instruction information of the target database, for example, how to operate the target of the target database, and how to operate the table under each directory.

[0039] Step S102, identifying the target keyword in the operation text, and determining the first text segment and the second text segment in the operation instruction information according to the target keyword.

[0040] In step S102, the first text segment is used to represent a plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used to represent a plurality of trigger operations specified in the operation instruction information.

[0041] Optionally, a rule generation system of database operation rule can be used as an execution subject of the above-mentioned database operation rule generation method. Wherein, after obtaining the operation text of the target database, the rule generation system can use NLP natural language processing and other artificial intelligence technologies to determine the first text segment and the second text segment in the operation instruction information by identifying the target keyword in the operation text.

[0042] ​For example, the target keywords include "table space", "space size", "data volume", "view", "snapshot", "offset rate", "need to set", "suitable to use", "recommend", "certain", "first", "then", "again", "finally", and the like. Assuming that the operation instruction information recorded in the operation text is "for a table with table space existence, space size greater than 0 and data volume greater than 1,000,000, it is suitable to use the mode of 'first DDL adding a nullable field, then batch DML update filling value, and finally DDL altering to non-null' to add a non-null field". Through the above target keywords, the rule generation system can determine that the first text segment includes "table space existence", "space size greater than 0", and "data volume greater than 1,000,000". In addition, through the above target keywords, the rule generation system can also determine that the second text segment includes "DDL adding a nullable field", "DML update filling value", and "DDL altering to non-null". It is easy to note that the above first text segment actually represents a plurality of operation trigger conditions specified in the above operation instruction information, and the above second text segment actually represents a plurality of trigger operations specified in the above operation instruction information.

[0043] In step S103, a plurality of database operation rules are generated according to the first text segment and the second text segment.

[0044] In step S103, each database operation rule is composed of at least one operation trigger condition and at least one trigger operation, and the database operation rule is used for updating a target table in a target database.

[0045] Optionally, the database operation rule in the present application is a DDL rule. The rule generation system at least includes a DDL rule storage unit. After the rule generation system extracts a plurality of operation trigger conditions according to the first text segment and extracts a plurality of trigger operations according to the second text segment, the rule generation system can generate a database operation rule according to each operation trigger condition and the trigger operation corresponding to the operation trigger condition. For example, the above "table space existence" is an operation trigger condition, and the corresponding trigger operation is "DDL adding a nullable field", that is, "Creat table column value". On this basis, the rule generation system can generate a database operation rule "satisfy trigger condition 1: TableSpace is exists; execute trigger operation 1: Creat table column value", wherein in the database, TableSpace is exists represents "table space existence".

[0046] It's important to note that a database operation rule can also consist of multiple trigger conditions and multiple trigger operations. For example, a database operation rule could be: "If trigger condition 1: TableSpace is exists, trigger condition 2: TableSize larger than 0, and trigger condition 3: ColumnNumber larger than 1000000 are met simultaneously, then trigger operation 1: Create table column value, trigger operation 2: DML update table, and trigger operation 3: DDL alter tablecolumn not null are executed sequentially." In the database, "TableSize larger than 0" means "space size is greater than 0," "ColumnNumber larger than 1000000" means "data volume is greater than 1000000," "DML update table" means "DML update to fill in values," and "DDL alter tablecolumn not null" means "DDL alter to not null."

[0047] It's also important to note that the operational instructions for databases from different vendors vary, and even within the same vendor, these instructions are constantly evolving with database technology. Therefore, when developers manually verify large amounts of operational instructions, they not only face the problem of low DDL rule generation efficiency due to the high labor costs, but also frequently encounter issues with improperly compiled DDL rules because manual verification relies heavily on past experience. This prevents the database from operating according to the optimal configuration outlined in the instructions, resulting in low database efficiency. For example, some technicians may overlook recommendations like "recommended" in the instructions and instead compile conventional DDL rules based on their own experience. This leads to the database not following the most appropriate DDL rules during use, significantly impacting database performance. For example, regarding the aforementioned specification that "for tables with existing tablespaces, a size greater than 0, and more than 1,000,000 rows of data, it is advisable to use the method of 'first adding nullable fields via DDL, then updating the values ​​in batches via DML, and finally adding non-nullable fields via DDL alter'," if the DDL rules are not configured using this recommended operation information, it will very easily lead to disorderly expansion of the database tablespace and a large number of page fragments. On this basis, whether the DDL rules are recompiled or other optimization methods are used, it will undoubtedly increase the maintenance burden on technical personnel.

[0048] The application can automatically extract the operation trigger condition and trigger operation for generating the DDL rule from the technical clause by identifying the target keyword in the operation text and determining the first text segment and the second text segment in the technical clause according to the target keyword, thereby saving a large amount of manual checking cost, improving the generation efficiency of the database operation rule, ensuring the generation of the most reasonable DDL rule, avoiding the problem of low database running efficiency caused by unreasonable DDL rule generation, and further reducing the operation and maintenance cost of the database.

[0049] In an optional embodiment, the rule generation system can further obtain a change instruction for the target table in the target database, the change instruction containing corresponding change information, then the rule generation system generates a DDL script according to the generated plurality of database operation rules, the target table in the target database and the change information, and finally the rule generation system automatically calls and executes the DDL script to update the target table in the target database.

[0050] It can be understood that the rule generation system changes the target table in the target database, including at least one of adding a table, modifying a table and deleting a table. The adding a table means that the user registers the modification information of the target table on the table registration system, and the specific registration content is at least one of table basic information, field information, index information and constraint information. In addition, the modifying a table means modifying the table basic information, field information, index information and constraint information. The deleting a table means directly registering the table deletion.

[0051] Further, the DDL script includes an incremental DDL script and / or a release DDL script, the incremental DDL script being the content of the current change, and the release DDL script being all change information of the table under the current version. By automatically generating the table change script from the registered table change information, the accuracy of the table change script is ensured, the operation is simple, the usability is high, and the generalizability is strong.

[0052] It should be noted that the target table in the database includes incremental baseline version information and release baseline version information. The baseline version information includes baseline, field, constraint, index and table space attribute, the table space attribute refers to the type of the table, the baseline includes incremental baseline and release baseline. The incremental baseline is the table changed last time, and the release baseline is the table of the last version. Finally, by automatically calling the DDL script, the manual submission of the table change file is replaced, the situation of missing submission of the table change file is avoided, the consistency of the tables in each environment is ensured, and the difficulty of data governance and maintenance is reduced.

[0053] Based on the content of the above steps S101 to S103, in the present application, the target keyword is identified, and the database operation rule is generated according to the first text segment and the second text segment. First, the operation text of the target database is obtained, wherein the operation text is used to record the operation instruction information of the target database. Then, the target keyword in the operation text is identified, and the first text segment and the second text segment in the operation instruction information are determined according to the target keyword. Finally, a plurality of database operation rules are generated according to the first text segment and the second text segment. The first text segment is used to represent a plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used to represent a plurality of trigger operations specified in the operation instruction information. Each database operation rule is composed of at least one operation trigger condition and at least one trigger operation. The database operation rule is used to update the target table in the target database.

[0054] From the above content, the present application identifies the target keyword in the operation text, and determines the first text segment and the second text segment in the operation instruction information according to the target keyword, so as to automatically extract the operation trigger condition and the trigger operation used to generate the database operation rule from the operation instruction information. Not only a large amount of manual checking cost is saved, but also the problem of easy error in manual checking is avoided, so as to realize the effect of improving the generation efficiency of the database operation rule.

[0055] Therefore, the technical scheme of the present application achieves the purpose of automatically generating the database operation rule, so as to realize the technical effect of reducing the checking cost of manually checking the operation instruction information, and further solves the technical problem of low generation efficiency of the database operation rule in the prior art.

[0056] In an optional embodiment, in order to accurately determine the first text segment and the second text segment in the operation instruction information, the rule generation system first identifies the first target keyword in the operation text, wherein the first target keyword is used to describe the attribute information of the target database. Then, the rule generation system determines the first text segment in the operation instruction information according to the first target keyword. In addition, the rule generation system can also identify the second target keyword and the third target keyword in the operation text, wherein the second target keyword is used to describe a plurality of operation instructions of the target database, and the third target keyword is used to describe the operation sequence between the plurality of operation instructions. Then, the rule generation system determines the second text segment in the operation instruction information according to the second target keyword and the third target keyword.

[0057] Optionally, the first target keyword includes, but is not limited to, "table space", "space size", "data volume", "view", "snapshot", and a series of fields for describing attribute information of the target database, wherein the first target keyword can also be understood as an attribute dictionary of the database, and the first target keyword can be set by the technical personnel. The second target keyword includes, but is not limited to, "DDL adds null field", "DML update fills value in batches", "DDL alter is non-null", and a series of fields for describing operation instructions of the target database, wherein the second target keyword can also be set by the technical personnel. Finally, the third target keyword includes, but is not limited to, "first", "then", "again", "finally", and a series of fields for representing operation sequences.

[0058] It is easy to note that, for the database, the trigger condition is usually constructed based on the relevant attribute information of the database, therefore, by the first target keyword, the rule generation system can extract various trigger conditions from the operation instruction information, that is, determine the first text segment. In addition, the trigger operation of the database is actually the result of the execution of various operation instructions according to a plurality of operation sequences, therefore, by the second target keyword and the third target keyword, the rule generation system can extract various trigger operations from the operation instruction information, that is, determine the second text segment.

[0059] In addition, before generating a plurality of database operation rules according to the first text segment and the second text segment, the rule generation system also identifies a fourth target keyword in the operation text, wherein the fourth target keyword is used to describe operation suggestion information provided by the target object, and the operation suggestion information is an operation suggestion about the target database under each operation trigger condition.

[0060] The fourth target keyword includes, but is not limited to, "need to set", "prefer to use", "recommend", "definitely", and the like.

[0061] It should be noted that, with the continuous development of database technology, the operation instruction information of various databases is very complex, and the DDL statement generation rules under different conditions will be specially described and recommended. For example, the operation instruction information of the Oracle database has the following description: for the table with existing data, such as adding a non-null field, a default value needs to be set; or first set the null field, then update the data and set it to non-null. For the table with table space, space size greater than 0 and data volume greater than 1,000,000, it is appropriate to use the method of "first DDL adds null field, then DML update fills value in batches, and then DDL alter is non-null" to increase the non-null field.

[0062] In existing technologies, technicians need to manually determine the relevant attributes and information of tables in the database, especially regarding recommended scenarios like "preferential use." Technicians often overlook these technical clauses and use conventional DDL generation rules, resulting in the inability to generate the vendor's most recommended DDL rules, which can significantly impact database efficiency. For example, regarding the specification that "for tables with existing tablespaces, a size greater than 0, and more than 1,000,000 rows, it is advisable to use the method of 'first DDL adding nullable fields, then batch DML update to fill values, and finally DDL ALTER to non-null' to add non-nullable fields," failing to use the vendor's recommended DDL rules to manage the database greatly increases the probability of disorderly tablespace expansion, increases page fragmentation, and also increases the frequency and cost of table reorganization or deletion / reconstruction maintenance. In short, current technology requires manual judgment and regeneration of table change files based on specifications and table attributes, significantly reducing version release speed. Furthermore, manual operations are prone to errors in judgment or operation, leading to statement errors and production failures, increasing the difficulty of subsequent data governance and maintenance.

[0063] This application, by separately identifying the fourth target keyword, can accurately determine the operational suggestions provided by the target object from the operational instructions. Then, based on these suggestions, it generates the most reasonable DDL rules, ensuring the database operates under optimal configuration. This not only improves database efficiency but also significantly reduces database maintenance costs. The target object mentioned above refers to the developer of the target database.

[0064] In one optional embodiment, the rule generation system can determine multiple operation triggering conditions and the three-element information of each operation triggering condition based on a first text fragment. The three-element information includes at least the judgment subject, judgment logic, and judgment content of the operation triggering condition. Then, the rule generation system determines multiple triggering operations based on a second text fragment. Finally, the rule generation system determines the target triggering operation corresponding to each operation triggering condition from the multiple triggering operations based on the three-element information and a fourth target keyword, and generates multiple database operation rules based on each operation triggering condition and its corresponding target triggering operation. The target triggering operation includes at least one operation instruction that the target database needs to execute under each operation triggering condition, as well as the execution order of each operation instruction.

[0065] Optionally, the rule generation system determines a plurality of operation trigger conditions according to the first text segment, wherein each trigger condition contains three-element information, i.e. a judgment subject, a logical judgment and a judgment content. The rule generation system also determines a plurality of trigger operations according to the second text segment. Finally, since the three-element information and the fourth target keyword are equivalent to restricting each trigger condition to correspond to which trigger operation, the rule generation system determines the target trigger operation corresponding to each trigger condition through the three-element information of each trigger condition and the fourth target keyword, and generates a DDL rule according to each trigger condition and its corresponding target trigger operation. It should be noted that if the rule generation system cannot determine which trigger operation a certain trigger condition corresponds to, the rule generation system will discard the trigger condition. Similarly, if the rule generation system cannot determine which trigger condition a certain trigger operation corresponds to, the rule generation system will discard the trigger operation.

[0066] In an optional embodiment, the rule generation system can generate a database operation rule according to each operation trigger condition. Specifically, the rule generation system first generates a condition set according to a plurality of operation trigger conditions, and then performs a first preset operation according to the condition set, wherein the first preset operation is used to generate a first database operation rule, and the first database operation rule is composed of an operation trigger condition in the condition set and the target trigger operation corresponding to the operation trigger condition. Finally, the rule generation system executes the first preset operation multiple times until the first database operation rule corresponding to each operation trigger condition is generated, and a plurality of first database operation rules are obtained.

[0067] The first preset operation includes the following processes: determining any one operation trigger condition in the condition set as a first operation trigger condition; determining the target trigger operation corresponding to the first operation trigger condition as a first trigger operation; generating a first database operation rule according to the first operation trigger condition and the first trigger operation, and deleting the first operation trigger condition from the condition set.

[0068] Figure 2 is an optional flowchart for generating a first database operation rule according to a trigger condition and a target trigger operation. As shown in Figure 2 , the following steps are included:

[0069] Step 1, generating a condition set according to a plurality of operation trigger conditions;

[0070] Step 2, determining any one operation trigger condition in the condition set as a first operation trigger condition;

[0071] Step 3, determining the target trigger operation corresponding to the first operation trigger condition as a first trigger operation;

[0072] Step 4, generating a first database operation rule according to the first operation trigger condition and the first trigger operation, and deleting the first operation trigger condition from the condition set;

[0073] Step 5, repeating the process of steps 2 to 4 until a first database operation rule corresponding to each operation trigger condition is generated, and a plurality of first database operation rules are obtained.

[0074] Specifically, each of the above first database operation rules is composed of a trigger condition and a trigger operation, for example, as shown in Table 1:

[0075] Table 1

[0076]

[0077]

[0078] In Table 1, three first database operation rules are shown, each of which corresponds to an operation trigger condition and a trigger operation.

[0079] In addition, the rule generation system can also generate a database operation rule based on at least two operation trigger conditions. Specifically, Figure 3 Another optional flowchart for generating a plurality of database operation rules according to trigger conditions and target trigger operations is shown, as shown in Figure 3 As shown, the following steps are included:

[0080] Step S301, after generating a condition set according to a plurality of operation trigger conditions, detecting whether the number of operation trigger conditions contained in the condition set is greater than a preset threshold;

[0081] Step S302, in the case where the number is greater than the preset threshold, dividing the condition set into a plurality of sub-sets, wherein each sub-set contains at least two operation trigger conditions;

[0082] Step S303, generating a second database operation rule according to each sub-set;

[0083] Step S304, when the target database satisfies all operation trigger conditions in the sub-set, controlling the target database to execute the second database rule corresponding to the sub-set.

[0084] Optionally, in step S303, the rule generation system first generates a set sequence according to the plurality of sub-sets, and then performs a second preset operation according to the set sequence, wherein the second preset operation is used to generate a second database operation rule, and the second database operation rule is composed of at least two operation trigger conditions in a sub-set and target trigger operations corresponding to the at least two operation trigger conditions. Finally, the rule generation system performs the second preset operation multiple times until a second database operation rule corresponding to each sub-set is generated, and a plurality of second database operation rules are obtained.

[0085] The second preset operation includes the following process: determining any one sub-set in the set sequence as a target sub-set; determining each operation trigger condition in the target sub-set as a second operation trigger condition; determining the target trigger operation corresponding to the second operation trigger condition as a second trigger operation; generating a second database operation rule corresponding to the target sub-set according to the second operation trigger condition and the second trigger operation, and deleting the target sub-set from the set sequence.

[0086] Figure 4 The second database operation rule is a specific flowchart provided by the present application for generating a second database operation rule.

[0087] Step one, generating a set sequence according to a plurality of sub-sets;

[0088] Step two, determining any one sub-set in the set sequence as a target sub-set;

[0089] Step three, determining the operation trigger condition in the target sub-set as a second operation trigger condition;

[0090] Step four, determining the target trigger operation corresponding to the second operation trigger condition as a second trigger operation;

[0091] Step five, generating a second database operation rule corresponding to the target sub-set according to the second operation trigger condition and the second trigger operation, and deleting the target sub-set from the set sequence;

[0092] Step six, repeating the process of steps two to five until a second database operation rule corresponding to each sub-set is generated, and a plurality of second database operation rules are obtained.

[0093] Optionally, each second database operation rule is composed of a plurality of operation trigger conditions and a plurality of trigger operations, as shown in Table 2:

[0094] Table 2

[0095]

[0096] In Table 2, two second database operation rules are shown, wherein the second database operation rule with serial number 1 corresponds to two operation trigger conditions and two trigger operations, and the second database operation rule with serial number 2 corresponds to three operation trigger conditions and three trigger operations.

[0097] In an optional embodiment, after generating the plurality of database operation rules according to the first text segment and the second text segment, the rule generation system further detects the number of conditions of the operation trigger conditions corresponding to each database operation rule, and determines the priority of each database operation rule according to the number of conditions, wherein the priority is used to represent the execution order of at least two database operation rules in the target database when the target database simultaneously satisfies the operation trigger conditions corresponding to the at least two database operation rules.

[0098] Optionally, when one database operation rule includes a plurality of trigger conditions, the plurality of trigger conditions have an "and" logical relationship, and different database operation rules have a parallel relationship. When the target database simultaneously satisfies the operation trigger conditions corresponding to at least two database operation rules, the rule generation system determines which database operation rule to execute according to the priority of each database operation rule, and the priority is related to the number of conditions in the database operation rule. For example, when the target database is in the state of "under the table with a table space, a space size greater than 0, and a data volume greater than 1 million", the target database simultaneously satisfies the two second database operation rules in Table 2, but in Table 2, the second database operation rule with serial number 2 includes three operation trigger conditions, and the second database operation rule with serial number 1 includes only two operation trigger conditions. Therefore, the rule generation system will update the target table in the target database according to the second database operation rule with serial number 2.

[0099] Further, after generating the plurality of database operation rules according to the first text segment and the second text segment, the rule generation system further receives a rule query instruction sent by a client, wherein the rule query instruction at least includes a rule identifier. Then, the rule generation system determines a target database operation rule from the plurality of database operation rules according to the rule identifier, and returns the target database operation rule to the client.

[0100] Optionally, the client includes but is not limited to a smart phone, a smart tablet, a desktop computer, a notebook computer, and the like. When a technician needs to query a certain database operation rule, the technician can send a rule query instruction to the rule generation system through the client. After receiving the rule query instruction, the rule generation system returns the target database operation rule that the technician wants to view to the client according to the rule identifier in the rule query instruction.

[0101] From the above, the application extracts the operation trigger condition and the trigger operation for generating the database operation rule from the operation instruction information automatically by identifying the target keyword in the operation text and determining the first text segment and the second text segment in the operation instruction information according to the target keyword, thereby saving a large amount of manual checking cost, avoiding the error-prone problem of manual checking, and achieving the effect of improving the generation efficiency of the database operation rule.

[0102] Embodiment 2

[0103] According to the embodiments of the application, an embodiment of a database operation rule generation device is also provided, as shown in Figure 5 The device comprises: an acquisition module 501 configured to acquire an operation text of a target database, wherein the operation text is used to record operation instruction information of the target database; a determination module 502 configured to identify a target keyword in the operation text and determine a first text segment and a second text segment in the operation instruction information according to the target keyword, wherein the first text segment is used to represent a plurality of operation trigger conditions specified in the operation instruction information, and the second text segment is used to represent a plurality of trigger operations specified in the operation instruction information; and a generation module 503 configured to generate a plurality of database operation rules according to the first text segment and the second text segment, wherein each database operation rule is composed of at least one operation trigger condition and at least one trigger operation, and the database operation rule is used to perform an update operation on a target table in the target database.

[0104] Optionally, the determination module further comprises a first identification unit, a first determination unit, a second identification unit and a second determination unit. The first identification unit is configured to identify a first target keyword in the operation text, wherein the first target keyword is used to describe attribute information of the target database; the first determination unit is configured to determine the first text segment in the operation instruction information according to the first target keyword; the second identification unit is configured to identify a second target keyword and a third target keyword in the operation text, wherein the second target keyword is used to describe a plurality of operation instructions of the target database, and the third target keyword is used to describe an operation sequence between the plurality of operation instructions; and the second determination unit is configured to determine the second text segment in the operation instruction information according to the second target keyword and the third target keyword.

[0105] Optionally, the database operation rule generation device further comprises an identification module configured to identify a fourth target keyword in the operation text, wherein the fourth target keyword is used to describe operation suggestion information provided by a target object, and the operation suggestion information is an operation suggestion about the target database under each operation trigger condition.

[0106] Optionally, the generating module further comprises a third determining unit, a fourth determining unit, a fifth determining unit and a generating unit. The third determining unit is configured to determine a plurality of operation trigger conditions and three-element information of each operation trigger condition according to the first text segment, wherein the three-element information at least comprises a judgment subject, a judgment logic and a judgment content of the operation trigger condition. The fourth determining unit is configured to determine a plurality of trigger operations according to the second text segment. The fifth determining unit is configured to determine a target trigger operation corresponding to each operation trigger condition from the plurality of trigger operations according to the three-element information and the fourth target keyword, wherein the target trigger operation at least comprises at least one operation instruction required to be executed by the target database under each operation trigger condition and an execution sequence of each operation instruction. The generating unit is configured to generate a plurality of database operation rules according to each operation trigger condition and the target trigger operation corresponding to each operation trigger condition.

[0107] Optionally, the generating unit further comprises a first generating subunit, a first preset operation subunit and a loop operation subunit. The first generating subunit is configured to generate a condition set according to the plurality of operation trigger conditions. The first preset operation subunit is configured to perform a first preset operation according to the condition set, wherein the first preset operation is used to generate a first database operation rule, and the first database operation rule is composed of one operation trigger condition in the condition set and a target trigger operation corresponding to the operation trigger condition. The loop operation subunit is configured to perform the first preset operation multiple times until a first database operation rule corresponding to each operation trigger condition is generated, and a plurality of first database operation rules are obtained.

[0108] Optionally, the first preset operation comprises the following process: determining any one operation trigger condition in the condition set as a first operation trigger condition; determining a target trigger operation corresponding to the first operation trigger condition as a first trigger operation; generating a first database operation rule according to the first operation trigger condition and the first trigger operation, and deleting the first operation trigger condition from the condition set.

[0109] Optionally, the database operation rule generating apparatus further comprises a detection module, a division module, a first generating module and a control module. The detection module is configured to detect whether the number of operation trigger conditions contained in the condition set is greater than a preset threshold. The division module is configured to divide the condition set into a plurality of sub-sets in the case that the number is greater than the preset threshold, wherein each sub-set contains at least two operation trigger conditions. The first generating module is configured to generate a second database operation rule according to each sub-set. The control module is configured to control the target database to execute the second database rule corresponding to the sub-set when the target database satisfies all operation trigger conditions in the sub-set.

[0110] Optionally, the first generation module further includes: a first generation unit, a second preset operation unit, and a loop operation unit. The first generation unit is used to generate a set sequence based on multiple subsets; the second preset operation unit is used to perform a second preset operation based on the set sequence, wherein the second preset operation is used to generate second database operation rules, and the second database operation rules consist of at least two operation triggering conditions in a subset and target triggering operations corresponding to the at least two operation triggering conditions; the loop operation unit is used to execute the second preset operation multiple times until the second database operation rules corresponding to each subset are generated, resulting in multiple second database operation rules.

[0111] Optionally, the database operation rule generation device further includes: a receiving module, a first determining module, and a returning module. The receiving module is used to receive a rule query instruction sent by the client, wherein the rule query instruction includes at least a rule identifier; the first determining module is used to determine a target database operation rule from multiple database operation rules based on the rule identifier; and the returning module is used to return the target database operation rule to the client.

[0112] Optionally, the database operation rule generation device further includes: a first detection module and a second determination module, wherein the first detection module is used to detect the number of conditions of the operation triggering conditions corresponding to each database operation rule; the second determination module is used to determine the priority corresponding to each database operation rule according to the number of conditions, wherein the priority is used to characterize the execution order of the target database for at least two database operation rules when the target database simultaneously satisfies the operation triggering conditions corresponding to at least two database operation rules.

[0113] Example 3

[0114] According to another aspect of the embodiments of this application, an electronic device is also provided. For example... Figure 6 As shown, the electronic device includes one or more processors; a storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to run the programs, wherein the programs are configured to execute the database operation rule generation method in the above embodiments at runtime.

[0115] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0116] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0117] In several embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other manners. For example, the described unit embodiments can be divided into other ways, for example, the division of units can be a logical function division, and there can be another division manner in actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection between units can be indirect coupling or communication connection through some interfaces, and can be electrical or other forms.

[0118] The units described as separate components may or can not be physically separate, and the components shown as units may or can not be physical units, i.e., they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0119] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0120] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0121] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A method for generating database operation rules, characterized in that, include: Obtain the operation text of the target database, wherein the operation text is used to record operation instructions for the target database; Identify target keywords in the operation text, and determine a first text segment and a second text segment in the operation description information based on the target keywords, wherein the first text segment is used to characterize multiple operation triggering conditions specified in the operation description information, and the second text segment is used to characterize multiple triggering operations specified in the operation description information; Multiple database operation rules are generated based on the first text fragment and the second text fragment, wherein each database operation rule consists of at least one operation triggering condition and at least one triggering operation, and the database operation rule is used to perform an update operation on the target table in the target database; The method further includes, before generating multiple database operation rules based on the first text fragment and the second text fragment: Identify a fourth target keyword in the operation text; wherein the fourth target keyword is used to describe the operation suggestion information provided by the target object, and the operation suggestion information is an operation suggestion about the target database under each operation trigger condition; Multiple database operation rules are generated based on the first text fragment and the second text fragment, including: Based on the first text fragment, multiple operation triggering conditions and three-element information of each operation triggering condition are determined, wherein the three-element information includes at least the judgment subject, judgment logic, and judgment content of the operation triggering condition; Multiple triggering operations are determined based on the second text fragment; Based on the three elements and the fourth target keyword, the target triggering operation corresponding to each triggering condition is determined from the multiple triggering operations. The target triggering operation includes at least one operation instruction that the target database needs to execute under each operation triggering condition, as well as the execution order of each operation instruction. Multiple database operation rules are generated based on each operation triggering condition and the target triggering operation corresponding to each operation triggering condition.

2. The method according to claim 1, characterized in that, Identifying target keywords in the operation text, and determining the first and second text segments in the operation instructions information based on the target keywords, including: Identify a first target keyword in the operation text, wherein the first target keyword is used to describe the attribute information of the target database; The first text fragment in the operation instructions information is determined based on the first target keyword; Identify the second target keyword and the third target keyword in the operation text, wherein the second target keyword is used to describe multiple operation instructions of the target database, and the third target keyword is used to describe the operation order among the multiple operation instructions; The second text fragment in the operation instructions information is determined based on the second target keyword and the third target keyword.

3. The method according to claim 1, characterized in that, Multiple database operation rules are generated based on each operation triggering condition and the target triggering operation corresponding to each operation triggering condition, including: Generate a condition set based on the multiple operation triggering conditions; A first preset operation is performed based on the set of conditions, wherein the first preset operation is used to generate a first database operation rule, and the first database operation rule consists of an operation triggering condition in the set of conditions and a target triggering operation corresponding to the operation triggering condition; The first preset operation is executed multiple times until a first database operation rule corresponding to each operation trigger condition is generated, resulting in multiple first database operation rules.

4. The method according to claim 3, characterized in that, The first preset operation includes the following process: Determine any one of the operation triggering conditions from the set of conditions as the first operation triggering condition; The target triggering operation corresponding to the first operation triggering condition is determined to be the first triggering operation; The first database operation rule is generated based on the first operation triggering condition and the first triggering operation, and the first operation triggering condition is deleted from the condition set.

5. The method according to claim 3, characterized in that, After generating a set of conditions based on multiple operation triggering conditions, the method further includes: Detect whether the number of operation triggering conditions contained in the condition set is greater than a preset threshold; If the number exceeds the preset threshold, the condition set is divided into multiple subsets, wherein each subset contains at least two of the operation triggering conditions; A second database operation rule is generated based on each of the subsets; When the target database satisfies all the operation triggering conditions in the subset, the target database is controlled to execute the second database rule corresponding to the subset.

6. The method according to claim 5, characterized in that, Generate a second database operation rule based on each of the subsets, including: Generate a sequence of sets based on the multiple subsets; A second preset operation is performed based on the set sequence, wherein the second preset operation is used to generate a second database operation rule, and the second database operation rule consists of at least two operation triggering conditions in a subset and target triggering operations corresponding to the at least two operation triggering conditions; The second preset operation is executed multiple times until a second database operation rule corresponding to each subset is generated, resulting in multiple second database operation rules.

7. The method according to claim 6, characterized in that, The second preset operation includes the following process: Determine any one of the subsets from the set sequence as the target subset; Each operation triggering condition in the target subset is determined as a second operation triggering condition; The target triggering operation corresponding to the second operation triggering condition is determined to be the second triggering operation; The second database operation rule corresponding to the target subset is generated based on the second operation triggering condition and the second triggering operation, and the target subset is deleted from the set sequence.

8. The method according to claim 1, characterized in that, After generating multiple database operation rules based on the first text fragment and the second text fragment, the method further includes: Receive a rule query instruction sent by the client, wherein the rule query instruction contains at least a rule identifier; The target database operation rule is determined from the plurality of database operation rules based on the rule identifier; The target database operation rules are returned to the client.

9. The method according to claim 1, characterized in that, After generating multiple database operation rules based on the first text fragment and the second text fragment, the method further includes: Detect the number of conditions for the operation triggering conditions corresponding to each of the database operation rules; The priority of each database operation rule is determined based on the number of conditions, wherein the priority is used to characterize the execution order of the target database for at least two database operation rules when the target database simultaneously satisfies the operation triggering conditions corresponding to at least two database operation rules.

10. A device for generating database operation rules, characterized in that, include: The acquisition module is used to acquire the operation text of the target database, wherein the operation text is used to record the operation instructions information of the target database; The determination module is used to identify target keywords in the operation text and determine a first text segment and a second text segment in the operation instruction information based on the target keywords. The first text segment is used to characterize multiple operation triggering conditions specified in the operation instruction information, and the second text segment is used to characterize multiple triggering operations specified in the operation instruction information. A generation module is used to generate multiple database operation rules based on the first text fragment and the second text fragment, wherein each database operation rule consists of at least one operation triggering condition and at least one triggering operation, and the database operation rule is used to perform an update operation on a target table in the target database; The device further includes: an identification module, used to identify a fourth target keyword in the operation text, wherein the fourth target keyword is used to describe the operation suggestion information provided by the target object, and the operation suggestion information is an operation suggestion about the target database under each operation trigger condition; The generation module further includes: a third determining unit, used to determine multiple operation triggering conditions and the three-element information of each operation triggering condition based on the first text fragment, wherein the three-element information includes at least the judgment subject, judgment logic, and judgment content of the operation triggering condition; a fourth determining unit, used to determine multiple triggering operations based on the second text fragment; a fifth determining unit, used to determine the target triggering operation corresponding to each operation triggering condition from the multiple triggering operations based on the three-element information and the fourth target keyword, wherein the target triggering operation includes at least one operation instruction that the target database needs to execute under each operation triggering condition and the execution order of each operation instruction; and a generation unit, used to generate multiple database operation rules based on each operation triggering condition and the target triggering operation corresponding to each operation triggering condition.

11. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the database operation rule generation method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Item reminding method and device based on semantic analysis and computer equipment

    CN110175806A