Training method and device for generating database table design drawing model based on natural language
Through table creation statement analysis and model training of power grid scenarios, a controllable database table design diagram model is generated, which solves the problem of database design dependence experience and realizes the automation and efficiency of database design.
Patent Information
- Application Number
- CN202411395603.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-01-10
AI Technical Summary
Existing database design relies on the experience of professionals, resulting in uncontrollable design results. The existing artificial intelligence technology is more used in artistic creation than industrial applications, and cannot effectively assist database design.
By analyzing the training of the power grid scenario with table creation statements, generating the entity relationship diagram of the training data, selecting the appropriate base model, fusion training and historical database table description information, dynamically adjusting the model training process until the entity relationship diagram of the target data The difference value from the training data entity relationship diagram is less than the preset condition, and a controllable database table design diagram model is generated.
It significantly improves the automation level of data understanding and structural analysis, avoids resource waste, ensures that the model matches specific scenarios, optimizes the accuracy and convergence speed of the model, reduces human intervention and data deviation, and realizes the controllability of database design. and efficient.
Smart Images

Figure CN119293015A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a training and device for generating a database table design diagram model based on natural language. Background Art
[0002] With the development of computer technology and the rise of low-code and no-code platforms, the platforms have lowered the threshold and cost of software development, improved development efficiency, and enabled more non-professional developers to participate in software development. In particular, the assistance of big model technology to the coding industry has made software design increasingly important. Currently, database design is more dependent on the experience of asset database designers. Although existing artificial intelligence technology can assist designers in generating corresponding available database design drawings, it is currently more inclined towards artistic creation rather than industrial applications, resulting in uncontrollable design results for database design drawings. Summary of the invention
[0003] Based on this, it is necessary to provide a training method, device, computer equipment, computer-readable storage medium and computer program product for generating a database table design diagram model based on natural language, which can make the design results of the database design diagram controllable, in order to address the above technical problems.
[0004] In a first aspect, the present application provides a training method for generating a database table design diagram model based on natural language, comprising:
[0005] Parse the table creation statements for power grid scenario training to obtain the entity relationship diagram of training data;
[0006] According to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario;
[0007] Fusion the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data;
[0008] The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0009] In a second aspect, the present application also provides a training device for generating a database table design diagram model based on natural language, comprising:
[0010] A relationship diagram acquisition module is used to parse the table creation statements for training power grid scenarios to obtain the entity relationship diagram of training data;
[0011] A model selection module, used to select a target base large model from various base large models preset in the power grid scenario according to the training data entity relationship diagram;
[0012] A data extraction module, used to fuse the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extract the base model training data corresponding to the target base large model from the fused data;
[0013] The model training module is used to train the target base large model according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0014] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0015] Parse the table creation statements for power grid scenario training to obtain the entity relationship diagram of training data;
[0016] According to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario;
[0017] Fusion the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data;
[0018] The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0019] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0020] Parse the table creation statements for power grid scenario training to obtain the entity relationship diagram of training data;
[0021] According to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario;
[0022] Fusion the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data;
[0023] The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0024] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0025] Parse the table creation statements for power grid scenario training to obtain the entity relationship diagram of training data;
[0026] According to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario;
[0027] Fusion the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data;
[0028] The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0029] The above-mentioned training method, device, computer equipment, storage medium and computer program product for generating a database table design diagram model based on natural language, obtains a training data entity relationship diagram by parsing the table creation statement for training of the power grid scenario; selects a target base large model from each base large model preset in the power grid scenario according to the training data entity relationship diagram; integrates the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracts the base model training data corresponding to the target base large model from the integrated data; trains the target base large model according to the base model training data until the difference value between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0030] By parsing the table creation statements for training in the power grid scenario, the entity relationship diagram of the training data is automatically generated, which significantly improves the automation level of data understanding and structural analysis. At the same time, the target base large model is selected from multiple preset large models according to actual needs, which effectively avoids the waste of resources in global model training and ensures the high matching of the model with the specific power grid scenario. By fusing the descriptive information of the training database table and the historical database table, more representative training data is extracted to ensure the comprehensiveness and consistency of the model training data. During the model training process, dynamic adjustments are made until the difference between the target data entity relationship diagram and the actual training data entity relationship diagram is less than the preset condition, thereby optimizing the accuracy and convergence speed of the model. This adaptive adjustment and refined training process not only greatly improves the accuracy of database table design, but also reduces human intervention and data deviation, ultimately making the design results of the database design diagram controllable, and making the database design process more efficient and intelligent, suitable for data management and optimization in complex power grid scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] FIG1 is an application environment diagram of a training method for generating a database table design diagram model based on natural language in one embodiment;
[0033] FIG2 is a flow chart of a training method for generating a database table design diagram model based on natural language in one embodiment;
[0034] FIG3 is a schematic diagram of a flow chart of a first database table design graph model training method in one embodiment;
[0035] FIG4 is a schematic diagram of a flow chart of a second database table design graph model training method in one embodiment;
[0036] FIG5 is a schematic diagram of a flow chart of a method for obtaining an actual data entity relationship diagram in one embodiment;
[0037] FIG6 is a flow chart of a method for setting statement output specification information in one embodiment;
[0038] FIG7 is a schematic diagram of a flow chart of a method for extracting base model training data in one embodiment;
[0039] FIG8 is a structural block diagram of a training device for generating a database table design diagram model based on natural language in one embodiment;
[0040] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] A training method for generating a database table design model based on natural language provided in an embodiment of the present application can be applied in an application environment as shown in FIG1. Among them, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on a cloud or other network server. The server 104 obtains the table creation statement for training from the terminal 102, and further parses the table creation statement for training of the power grid scene through the server 104 to obtain a training data entity relationship diagram; according to the training data entity relationship diagram, the target base large model is selected from each base large model preset in the power grid scene; the training database table description information of the power grid scene and the historical database table description information of the power grid scene are integrated, and the base model training data corresponding to the target base large model is extracted from the integrated data; according to the base model training data, the target base large model is trained until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than the preset condition, and the database table design model is obtained. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0043] In an exemplary embodiment, as shown in FIG2 , a training method for generating a database table design diagram model based on natural language is provided, and the method is applied to the server in FIG1 as an example for explanation, including the following steps 202 to 208. Among them:
[0044] Step 202, parse the table creation statement for training of the power grid scenario to obtain a training data entity relationship diagram.
[0045] The power grid scenario can be the environment or conditions that reflect the specific business of power grid operation, monitoring, management and optimization in the power system. It usually contains scene information related to power supply, such as various equipment, nodes, data transmission, load distribution, etc. in the power grid, which is used to describe the real-time or historical status of the power grid and provide background for modeling and training.
[0046] The training table creation statement can be an SQL statement or a similar table definition language used to define the database table structure. It describes the table name, field, data type, primary key, foreign key and other information, and is used to provide a structured framework for data for model training. These statements help the system understand the design of the database, thereby generating relevant entity relationship diagrams for the model.
[0047] The training data entity relationship diagram can be generated by parsing the training table creation statement, and is used to describe the relationship between data tables and their structure in a graphical way. Each node represents an entity (database table), and the edge represents the relationship between different entities (such as foreign key association). This diagram is used to reflect the database structure and its complexity, and provide a reference for model training.
[0048] Specifically, when parsing training table creation statements in power grid scenarios, the system first needs to perform grammatical parsing on SQL or other database definition statements, which is usually done by building a context-free grammar (CFG) or using existing grammatical analysis tools. The parser extracts the various elements of the database table, such as table name, field name, data type, primary key, foreign key, and the relationship between tables. Then, based on this information, the system generates a training data entity relationship diagram (ER diagram), in which each node represents a data entity (table) and each edge describes the relationship between entities (such as one-to-many or many-to-many associations). This process may also combine entity recognition and pattern matching techniques to ensure that the parsed relationship diagram accurately reflects the actual logical structure of the data.
[0049] Step 204 , selecting a target base large model from various base large models preset in the power grid scenario according to the training data entity relationship diagram.
[0050] The target base model can be a model selected from multiple preset large models according to a specific power grid scenario, responsible for processing the data in the current scenario. It can be a deep learning model or other complex algorithm model that can be optimized and trained according to the data requirements of different scenarios to generate the final database design model.
[0051] Specifically, after the training data entity relationship diagram is generated, it is necessary to define the applicable scenarios and performance indicators of the base model, and match the training data entity relationship diagram in the current scenario with different base models through a model matching algorithm (such as a matching algorithm based on a graph structure) or a recommendation system based on a specific scenario, so as to find a base model that is optimal in terms of computing performance, expansion capability, and data structure processing. That is, the system selects a target base model suitable for training the subsequent data based on natural language generation of database table design diagrams by analyzing its structural characteristics (such as the number of entities, relationship complexity, data type, etc.), that is, using the training data entity relationship diagram to select a target base model suitable for training the database table design diagram based on natural language generation under the current situation.
[0052] Step 206 , integrating the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the integrated data.
[0053] The training database table description information may be the structure and attribute information of the database table defined in the current power grid scenario, including field name, type, length, constraint, etc. It is used to describe the data table structure during training, helping the system understand and analyze the design of each table in the database, thereby providing a basis for model training.
[0054] The historical database table description information can be a description of the database table that has been previously established or used in the power grid scenario, including information such as table structure, field attributes, and relationships between tables. It reflects the data table design used in historical operation, and the system can merge it with the current training database table description information to generate richer training data.
[0055] The base model training data can be the data extracted after integrating the description information of the training database table and the historical database table, and is used to train the target base model. These data can reflect the overall picture of the power grid scenario, so that the model can better understand the relationship and structure of the data during training, thereby generating high-quality model results.
[0056] Specifically, the system needs to compare the fields in the training database table description information and the historical database table description information, eliminate duplicate fields or inconsistent naming, and then fill in or correct the incomplete data. At the same time, the format of multi-source data is standardized through data conversion tools to make it suitable for input into the base model. In order to improve the timeliness and representativeness of training data, the system uses specific fusion algorithms (such as feature weighted fusion or incremental fusion) to fuse the training database table description information and the historical database table description information to ensure that the data features in the current scenario and the experience of historical accumulated data can be effectively integrated, and high-quality base model training data can be extracted.
[0057] Step 208, training the target base large model according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, and obtaining a database table design diagram model.
[0058] The target data entity relationship diagram can be an entity relationship diagram predicted or generated by the target base model, representing the model's prediction results of the data table structure and relationship in the power grid scenario. This diagram is used to compare with the training data entity relationship diagram to evaluate the effect of model training.
[0059] The preset condition can be a specific standard or threshold set when training the model, which is used to measure whether the model training has achieved the expected goal. It usually refers to the difference between the target data entity relationship diagram and the training data entity relationship diagram. Only when the difference is less than the preset condition will the model training stop, indicating that the model has achieved the desired effect.
[0060] The database table design diagram model can be the final database structure model generated after training, which reflects the design scheme of the data table and its relationship in the power grid scenario. It provides a standard for the actual database design, ensuring that the system can efficiently store and manage data according to the needs of the power grid scenario.
[0061] Specifically, once the base model training data is prepared, the system will input the base model training data into the target base model for iterative training. During the training process, the model will continuously adjust the internal parameters so that the target data entity relationship graph generated by the model prediction gradually approaches the expected training data entity relationship graph. The training process is usually based on an optimization algorithm (such as gradient descent or Adam optimization), and the difference between the two relationship graphs is evaluated by a loss function. As the model iterates, the difference value will gradually decrease until the difference is lower than the preset condition. Ultimately, the database table design diagram model output by the trained model will accurately reflect the data structure in the power grid scenario and have a certain generalization ability to adapt to possible structural changes or new requirements in the future. In this process, the system may also ensure the stability and accuracy of model training through cross-validation or regression testing of historical data.
[0062] In the above-mentioned training method for generating a database table design diagram model based on natural language, the training table creation statement of the power grid scenario is parsed to obtain a training data entity relationship diagram; according to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario; the training database table description information of the power grid scenario and the historical database table description information of the power grid scenario are integrated, and the base model training data corresponding to the target base large model is extracted from the integrated data; according to the base model training data, the target base large model is trained until the difference value between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, so as to obtain a database table design diagram model.
[0063] By parsing the table creation statements for training in the power grid scenario, the entity relationship diagram of the training data is automatically generated, which significantly improves the automation level of data understanding and structural analysis. At the same time, the target base large model is selected from multiple preset large models according to actual needs, which effectively avoids the waste of resources in global model training and ensures the high matching of the model with the specific power grid scenario. By fusing the descriptive information of the training database table and the historical database table, more representative training data is extracted to ensure the comprehensiveness and consistency of the model training data. During the model training process, dynamic adjustments are made until the difference between the target data entity relationship diagram and the actual training data entity relationship diagram is less than the preset condition, thereby optimizing the accuracy and convergence speed of the model. This adaptive adjustment and refined training process not only greatly improves the accuracy of database table design, but also reduces human intervention and data deviation, ultimately making the design results of the database design diagram controllable, and making the database design process more efficient and intelligent, suitable for data management and optimization in complex power grid scenarios.
[0064] In an exemplary embodiment, as shown in FIG3 , the target base model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, and a database table design diagram model is obtained, including steps 302 to 304. Among them:
[0065] Step 302, based on the base model training data, the target base large model is trained to generate a design diagram, until the difference between the target design relationship diagram and the training design relationship diagram is less than the design relationship diagram threshold, and the design diagram model to be trained is obtained.
[0066] The training of design diagram generation can be a process of training the design diagram construction of the target base large model based on the data of the power grid scenario, aiming to enable the model to gradually learn and generate a design diagram that can accurately reflect the database table structure and the relationship between tables. The training process iteratively adjusts the parameters of the model through the optimization algorithm so that the generated design diagram can meet the actual data characteristics and requirements in the power grid scenario.
[0067] The target design relationship diagram can be a design diagram generated after the model is trained, which reflects the database table structure and the relationship between them in the power grid scenario. This diagram is based on the features learned by the base model, aims to predict the data entity relationship diagram, and serves as a core output to measure the training effect.
[0068] The training design relationship diagram can be a diagram constructed based on the actual data table structure and relationship information parsed by the system from the power grid scenario, reflecting the real structural relationship between the data tables. It is used as the standard answer in the training process. The goal of model training is to minimize the difference between the generated target design relationship diagram and the training design relationship diagram.
[0069] The design relationship graph threshold can be a preset standard value for measuring the difference between the target design relationship graph and the training design relationship graph, which is usually defined by a loss function. During the model training process, the system will continuously adjust the model parameters until the difference between the two is less than the threshold, indicating that the model has achieved the expected accuracy.
[0070] Among them, the design drawing model to be trained can be a database table design model obtained after preliminary training. Although it has perfect database structure mapping capabilities after training, it fails to optimize the design of specific relationship diagrams. This model, as an intermediate result, represents that the training of design drawing generation has been completed, and subsequent design requirements training for design drawings of specific scenarios is required to improve its accuracy and adaptability.
[0071] Specifically, the system trains the design diagram construction of the target base model based on the base model training data extracted from the power grid scenario. This process continuously optimizes the model parameters through deep learning or other machine learning methods, so that the model can automatically learn the structure of the database table and its relationship from the data. During training, the model will iteratively update the generated target design relationship diagram based on the actual data table characteristics and relationships, and compare it with the training design relationship diagram. The system calculates the difference between the two (usually measured by a loss function), and when the difference is less than the preset design relationship diagram threshold, it stops training and outputs a design diagram model to be trained. This model has a complete database structure mapping capability, but fails to perform specific calculations and optimization training for the design requirements of the specific design diagram.
[0072] Step 304, based on the database table design information corresponding to the power grid scenario, the scenario design training is performed on the design diagram model to be trained until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0073] Among them, scenario design training can be that the model continuously adjusts the model by utilizing the specific data structure design, business logic design and operation requirement design in the scenario, so that it is more in line with the actual application scenario, ensuring that the final generated database table design diagram can not only reflect the general data relationship, but also meet the special requirements and dynamic changes in the power grid scenario.
[0074] The database table design information may be the detailed content describing the database table structure, including table name, field name, data type, primary key, foreign key, and constraint relationship between tables, etc. This information is used to guide the generation results of the model during the training process to ensure that the model can generate a database table design diagram that meets the actual application requirements.
[0075] Specifically, the system conducts further scenario design training on the design diagram model to be trained, wherein scenario design training refers to the training process corresponding to the design of the specific scenario of the design diagram, which is further carried out on the model based on the specific database table design information of the power grid scenario after the model has the ability to generate the design diagram, in order to meet the actual needs of the actual situation. The model training process is based on the dynamic characteristics of the power grid scenario. The model parameters are repeatedly adjusted by using the existing historical data and actual scenario information in the power grid. The difference between the target data entity relationship diagram and the training data entity relationship diagram is gradually reduced through the continuous comparison between the target data entity relationship diagram and the training data entity relationship diagram. Finally, the difference value of the target data entity relationship diagram is reduced to below the preset conditions. Through a series of complex optimization algorithms and loss function evaluations, the model finally converges to an ideal state, and the generated database table design diagram model can accurately reflect the design scheme and relationship structure of each data table in the power grid scenario, ensuring high operational efficiency and scalability in practical applications.
[0076] In this embodiment, by gradually optimizing the design drawing generation process of the large base model, it is ensured that the difference between the target design relationship diagram generated by the model and the relationship diagram of the actual training data is less than the set threshold, thereby improving the accuracy of the model. When conducting scenario design training, by combining the actual database table design information of the power grid scenario, the model can further adapt to the actual application scenario and optimize the generated design drawing. The final database table design diagram model not only accurately reflects the data structure in the power grid scenario, but also can flexibly respond to dynamic changes in the scenario, thereby improving the efficiency and accuracy of the database design, and ensuring its strong applicability and stability in actual power grid operation.
[0077] In an exemplary embodiment, as shown in FIG4 , according to the database table design information corresponding to the power grid scenario, the scenario design training is performed on the design diagram model to be trained until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, and the database table design diagram model is obtained, including steps 402 to 406. Among them:
[0078] Step 402: Create a training table creation statement using database table design information.
[0079] Among them, the training design table creation statement can refer to the SQL table creation statement or similar database definition statement generated with design requirements based on the database table design information of the power grid scenario. It contains the structural information of the table with design requirements, such as field name, data type, primary key, foreign key, etc. Through these statements, a standardized database table design is provided for the model, which is convenient for the subsequent parsing and training process, so that the model can understand the specific structure and relationship of the data table.
[0080] Specifically, the system automatically formats the table fields, data types, primary keys, foreign keys, and relationships between tables into SQL table creation statements or other database definition statements with design requirements based on the database table design information of the power grid scenario and in accordance with the generation requirements of the specified design drawings, so as to meet the design requirements for the final output of the model. The design table is output according to the above design requirements. Specifically, the system analyzes the attributes of each table in the database table design information of the power grid scenario, such as the naming rules of the fields with design requirements, data constraints (such as NOT NULL or UNIQUE), and foreign key associations between tables. These design information are presented in the form of table creation statements, so that the model can directly read and parse these structural information during the training process, thereby concretizing the design blueprint of the database table and obtaining the design table creation statements for training.
[0081] Step 404, parse the training table creation statement to obtain training database table design analysis data.
[0082] The training database table design analysis data can be structured data with design requirements generated by analyzing the training design table creation statements, reflecting the specific design of the database table and the relationship between tables. The data includes details such as the table name, field, data type, primary and foreign key relationships, etc., which serves as the basic input for the model to understand the database table design and help the model accurately build and learn the structural relationship diagram of data entities.
[0083] Specifically, the system performs a detailed analysis of the generated training design table creation statements to disassemble the specific structural elements of the database table with design requirements. This includes the name of the table with design requirements, field definitions (field name, data type, default value, etc.), relationships between tables (such as foreign key constraints), etc. The parsing process may use a syntax analyzer or database management tool to accurately extract and understand the various components of the table creation statement with design requirements. The training database table design parsing data generated after parsing will be stored in a structured manner to facilitate the model to further understand the relationship and structural layout between tables. This parsing data is equivalent to a specific coded representation of the database table design with design requirements. It provides fine-grained table structure information for subsequent model training and helps the model build a more accurate entity relationship diagram.
[0084] Step 406 , integrating the design analysis data of the training database table and the design analysis data of the historical database table of the power grid scenario, and extracting the design drawing model training data corresponding to the design drawing model to be trained from the integrated data.
[0085] Among them, the historical database table design analysis data can be the analysis data extracted from the previous database table design and usage in the power grid scenario, reflecting the structure, field definition, table relationship and other information of the database table with historical design requirements. These data with design requirements provide the model with past design experience and patterns, making it easier for the model to refer to historical data during training, thereby improving its generalization ability and adaptability to different scenarios.
[0086] The design diagram model training data can be a training data set selected by fusing the current training database table design analysis data with the historical database table design analysis data. It contains detailed information on the database table structure, fields and their relationships with design requirements, and is used to further optimize the training design diagram model to generate a database table design diagram model that better meets the actual needs of the power grid scenario.
[0087] Specifically, the system fuses the training database table design parsing data obtained from the current analysis with the parsing data of the historical database table. The historical database design data may include previous table design and usage experience in power grid scenarios, providing rich historical background and patterns. The fusion process involves data cleaning (such as eliminating duplicate fields or conflicting data), aligning field structures (such as data type consistency processing), and association mapping between data sources. By combining current and historical data, the system is able to generate a more representative and comprehensive training data set with design requirements. The introduction of historical data provides the model with more scenario changes and long-term accumulated structural information, so that the model has better generalization ability and adaptability when facing complex power grid scenarios, and extracts design diagram model training data with design requirements.
[0088] Step 408, based on the design diagram model training data, the design diagram model to be trained is subjected to scenario design training until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0089] Specifically, the system conducts further scenario design training on the design diagram model to be trained based on the extracted design diagram model training data with design requirements. The training process uses deep learning or other optimization algorithms to adjust the model parameters through multiple iterations, so that the difference between the generated target data entity relationship diagram and the training data entity relationship diagram gradually decreases. During each iteration, the model compares the difference between the target design diagram and the actual training diagram (such as using loss functions such as cross entropy or MSE to measure the difference), and adjusts the weights and parameters of the model based on error feedback. Training continues until the difference value is less than the preset threshold condition, indicating that the model has achieved the expected accuracy and convergence state. Ultimately, the generated database table design diagram model will reflect the actual data requirements and structure with design requirements in the power grid scenario, ensuring efficiency and robustness in the application, and providing more accurate database design for power grid management.
[0090] In this embodiment, the database table design information is used to generate training table creation statements, and the detailed table structure information is parsed to ensure that the model can accurately understand the core design elements of the database. The current power grid scenario is combined with the historical database table design analysis data to further enhance the model's comprehensive understanding of the data structure. During the scenario design training process, the model is continuously optimized until the difference between the target data entity relationship diagram and the training data entity relationship diagram is lower than the preset condition, ensuring that the final generated database table design diagram model is not only highly accurate, but also can adapt to dynamic changes in power grid scenarios. This method greatly improves the automation level and accuracy of database design, optimizes the performance and practicality of the database, and enables it to better serve the management and operation needs of the power grid.
[0091] In an exemplary embodiment, as shown in FIG5 , after the step of training the target base large model according to the base model training data to obtain the database table design diagram model, the method further includes steps 502 to 504. Among them:
[0092] Step 502: Input the actual database table description information of the power grid scenario into the database table design diagram model to obtain the database table design diagram data.
[0093] The actual database table description information may refer to the detailed description of the data table structure that actually exists in the power grid scenario, including table name, field name, data type, primary key, foreign key, field constraint conditions, and the relationship between tables, etc. This information is used to describe the actual design and data organization of the current database, reflecting the actual data requirements and layout of the power grid system.
[0094] The database table design data can be structured data generated by the trained database table design model based on the input actual database table description information. These data reflect the model's optimized design of the database table structure and inter-table relationships in the power grid scenario, including the table's structure definition, field type, primary and foreign key relationships, etc., for subsequent analysis and generation of entity relationship diagrams.
[0095] Specifically, after the database table design diagram model has been trained and improved, the actual database table description information is obtained according to the actual needs of the user, and the system further inputs the actual database table description information contained in the power grid scenario into the trained database table design diagram model. The actual database table description information includes the specific structural information of each data table in the power grid scenario, such as table name, field name, data type, field constraint (such as primary key, foreign key, unique constraint, etc.), field length, and the relationship between tables. This information represents the data layout of the actual operation of the power grid system. After inputting this information into the database table design diagram model, the model will process and adjust these actual descriptions according to the learned optimization structure, and generate database table design diagram data that is highly matched with the power grid scenario requirements. This process ensures that the model can provide a database design solution that meets actual operations in a specific scenario based on real business needs.
[0096] Step 504, parse the database table design diagram data to obtain the actual data entity relationship diagram.
[0097] The actual data entity relationship diagram can be the result of analyzing the database table design diagram data. It graphically displays the data table structure and its relationship in the power grid scenario. Each node represents a data table, and the edge represents the relationship between tables (such as foreign key relationship). The diagram is used to intuitively represent the logical relationship and data flow of data in the power grid scenario.
[0098] Specifically, the system performs a detailed analysis of the database table design data generated by the model. The database table design data includes the table structure definition and field association information. The system converts this data into a more intuitive actual data entity relationship diagram (ER diagram) through the parser. During the analysis process, the system will identify the fields, field types, primary and foreign key relationships of each table and its associated tables, and generate a graphical structure in which nodes represent tables and edges represent the relationships between tables. After the analysis is completed, the generated actual data entity relationship diagram can clearly display the data structure, inter-table relationships, and data flow in the power grid scenario, providing a comprehensive visual reference for the implementation and optimization of the database, while helping to further analyze the performance and consistency of the database.
[0099] In this embodiment, by inputting the actual database table description information of the power grid scenario into the database table design model, the database table design data that meets the scenario requirements is generated to ensure that the design is completely consistent with the actual data structure of the power grid scenario. The analysis of the design data further generates an actual data entity relationship diagram, making the data structure and the relationship between tables more intuitive and clear. This process not only ensures that the database design is highly consistent with the actual application scenario, but also improves the database's operating efficiency and data management accuracy in complex power grid scenarios, ultimately providing strong support for the stable operation and data processing of the power grid system.
[0100] In an exemplary embodiment, as shown in FIG6 , after parsing the training table creation statement of the power grid scenario to obtain the training data entity relationship diagram, the method further includes steps 602 to 604. Among them:
[0101] Step 602, identifying entity relationship diagram standard information of the training data entity relationship diagram.
[0102] The standard information of the entity relationship diagram can be the database design specifications extracted from the training data entity relationship diagram, including the relationship between tables, field definitions, primary key and foreign key constraints, data types, and the association between tables. These standard information ensures that the structured expression of the entity relationship diagram meets the established design requirements and provides a standardized data foundation for subsequent steps, ensuring the consistency and accuracy of the database design process.
[0103] Specifically, the system performs a detailed structural analysis on the generated training data entity relationship diagram and identifies the preliminary standard information of the relationship diagram. This standard information includes the basic definition of the table (table name, field name, data type), the primary key and foreign key relationship between tables, constraints (such as uniqueness constraints, non-null constraints), and the specific representation of one-to-many, many-to-many and other associations between tables. By further parsing this information in the first analysis, the system extracts the structured information of all tables in the training data entity relationship diagram, and identifies specific design specifications according to the needs of the power grid scenario, such as field naming rules, data type standardization, etc., to obtain the standard information of the entity relationship diagram. The key to this step is to establish a standard foundation for the entire database design process that meets the actual requirements of the power grid scenario, ensuring that the model results output in subsequent steps are consistent, reliable and compatible.
[0104] Step 604, setting the statement output specification information of the target base large model according to the standard information of the entity relationship diagram.
[0105] Specifically, based on the previously identified entity relationship diagram standard information, the system sets SQL statements or database definition languages that not only meet the standards in the power grid scenario, but can also be correctly parsed and executed by the database system to obtain the statement output specifications of the target base model. Statement output specification information is an important set of rules that defines how the database design statements generated by the model are formatted, including the grammatical structure of database table definitions, field naming conventions, the representation of primary and foreign key associations, and the expression of constraints. This step sets strict statement output rules to ensure that the model always remains consistent with the requirements of the power grid scenario when generating design results, avoids statement output that does not meet database standards, and improves the operability and deployment efficiency of the generated database design diagram model.
[0106] In this embodiment, by identifying the standard information of the entity relationship diagram of the training data, it is ensured that the entity relationship diagram follows a unified design standard, providing a reliable foundation for the database structure design. Subsequently, the statement output specification of the target base large model is set according to the standard information, so that the database statements generated by the model strictly comply with the predefined design rules. This process not only ensures that the output statements are highly consistent and standardized, but also reduces errors or inconsistencies in the design and implementation process, thereby improving the efficiency and accuracy of database design and providing a solid guarantee for data management in complex power grid scenarios.
[0107] In an exemplary embodiment, as shown in FIG7 , the description information of the training database table of the power grid scenario and the description information of the historical database table of the power grid scenario are integrated, and the base model training data corresponding to the target base large model is extracted from the integrated data, including steps 702 to 706. Among them:
[0108] Step 702 , integrating the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario to obtain database fusion description information.
[0109] The database fusion description information can be a comprehensive data set generated by fusing the description information of the training database table currently used in the power grid scenario with the description information of the historical database table. It includes the structure definition, field type, primary key and foreign key relationship of the database table, and the association and evolution of the current and historical data tables. This information reflects the overall view of the database design in the power grid scenario, with both the current operation and historical accumulated data structures, which is used to support model training and optimization.
[0110] Specifically, the system fuses the training database table description information in the current power grid scenario with the historical database table description information. The training database table description information represents the data table structure, field definition, data type, primary and foreign key relationship and other information used by the current system at runtime, while the historical database table description information reflects the evolution of database design in different time periods in past power grid scenarios. The fusion process not only requires merging these two types of data, but also ensures the compatibility between historical data and existing data through consistency checks, data deduplication and conflict resolution. For example, if the historical and current table structures are inconsistent, the system will choose an appropriate way to standardize or map the fields to avoid potential design conflicts. Finally, the system generates a complete database fusion description information that combines the current design and historical data patterns of the power grid scenario, providing a more comprehensive design reference for subsequent model training.
[0111] Step 704: Identify the database design scenario from the database fusion description information.
[0112] The database design scenario can be identified from the database fusion description information, reflecting the database structure and its association mode of the design scenario requirements of specific applications in the power grid scenario. It includes key data tables, inter-table relationships, data flow, query frequency and performance requirements in the power grid system, and clarifies the design requirements and operating characteristics of the database in different business scenarios, providing a targeted reference for subsequent model training.
[0113] Specifically, the system analyzes the structured data in the database fusion description information to understand how different modules of the power grid system use these data tables and determine the most critical tables and their relationships. For example, the system may focus on some core power dispatching, monitoring, or load management tables, which usually play a key role in power grid scenarios. The system analyzes the relationship between these tables and other tables, query frequency, data writing and reading load, etc., to determine the specific database design scenario in the power grid scenario, and further identify the structure and relationship that best represents the current database design scenario. Through this analysis, the system clarifies the specific database design requirements under the database design scenario, ensuring that it can focus on the most critical data tables and relationships in model training.
[0114] Step 706: extracting base model training data from the database fusion description information according to the database design scenario.
[0115] Specifically, the system uses the previously identified database design scenarios to filter out information such as field definitions, table structures, and data constraints related to these tables based on the key tables and relationships in the database design scenarios to ensure that the extracted data can fully reflect the real needs of the power grid system. Next, the system extracts a subset of data related to the core logic of the power grid business, including table connection modes, query modes, and data update frequencies and constraints, to ensure that the model can adapt to the complexity and dynamics of the power grid system when trained on these data, and obtain the base model training data. The key to this step is to provide the base large model with high-quality training data that is highly relevant to the actual business, so that the model can accurately learn the database structure and optimize its application effect in the power grid scenario.
[0116] In this embodiment, by integrating the training database table description information of the power grid scenario and the historical database table description information, a more comprehensive database fusion description information is generated, so that the model can fully consider the characteristics of the current and historical database designs. The database design scenario is identified from the fusion information to ensure that the model can accurately understand the key data structures and application requirements in the power grid system. Subsequently, the base model training data is extracted based on the design scenario to ensure that the training data used is targeted and representative. This process enhances the model's adaptability to complex power grid scenarios, improves the comprehensiveness and accuracy of the database design, and effectively improves the training effect and final application efficiency of the database.
[0117] Furthermore, a training method for generating database table design diagram models based on natural language solves the defect that existing software (such as AIGC) technologies are more open general domain models and cannot be targeted at professional fields, such as the power grid industry, where the general model cannot obtain relevant data training for the relevant data of the domain database. In addition, in order to improve the efficiency of database asset reuse and the effect of generating design results in the field of database design, the base model is trained based on the database-related training set, which can further improve the design effect. Since the logical description of the intermediate text results is more inclined to SQL, in the selection of the base model, after multiple evaluations, the stronger base model of txt2sql was selected for further training, and additional data sets related to SQL of the large model publicly available in the industry were added for training.
[0118] In a specific application embodiment, a specific example of implementing a training method for generating a database table design diagram model based on natural language is as follows:
[0119] In a large power grid, a large amount of power grid operation data is generated every day. This data comes from real-time monitoring of power grid equipment (such as transformers, transmission lines, power stations, etc.). In order to improve the efficiency of data storage and ensure that data can be quickly retrieved and used in scheduling and monitoring, the power grid hopes to automatically generate an optimized database table design diagram to model and store data based on historical data and current power grid scenario requirements.
[0120] 1. Implementation Plan
[0121] The existing data sources include description information of current power grid equipment and historical database information.
[0122] The current equipment information includes data on transformers, transmission lines and power stations, such as the maximum load, operating status and location of transformers collected every day. The historical database stores information such as equipment status and maintenance records over the past few years, which helps predict and analyze the operating status of current equipment.
[0123] 2. Current data collection situation
[0124] The following is the power grid equipment data collected by the power grid every day:
[0125] Transformer data: The maximum load, operating status and location data of 1,000 transformers are collected every day. For example, the transformer in area a has an operating load of 150MW and a status of "normal".
[0126] Transmission line data: Voltage and location information is collected from 500 transmission lines every day. For example, the voltage of the line from area a to area b is 220 kV.
[0127] Power station data: The capacity and operation type of 100 power stations are collected every day. For example, the capacity of the first power station in area a is 1000MW and the operation type is a thermal power station.
[0128] 3. Historical data collection
[0129] The historical database stores substation information from the past five years. Although this data is no longer directly used in the current system, it is still helpful for grid scenario prediction and historical backtracking. The historical data includes the location information and voltage levels of 300 substations.
[0130] 4. Transformer data example
[0131] The following table shows the current operating data of some transformers, including their ID, location, maximum load and status.
[0132]
[0133] 5. Transmission line data example
[0134] Below are the voltage and location data for the transmission lines, including the start and end locations of the lines.
[0135]
[0136] 6. Power station data example
[0137] Power plant data includes the capacity and operation type of the power plant, which is very important for understanding the overall operation of the power plant.
[0138]
[0139] 7. Results Analysis
[0140] The automatically generated database table design allows the power grid to more effectively manage and store power grid equipment data, especially in emergency situations, to quickly query and analyze the operating status of equipment. The generated database design not only integrates current data, but also takes into account historical data, ensuring efficient data storage and query capabilities in long-term operation.
[0141] The code for a specific example of a training method for generating a database table design diagram model based on natural language is as follows:
[0142] # Create a new Document with multi-paragraph formatting
[0143] doc = Document()
[0144] # Add a title
[0145] doc.add_heading('Database table design example in power grid management system', 0)
[0146] # Add an introduction
[0147] doc.add_paragraph('''
[0148] In a large power grid, a large amount of power grid operation data is generated every day. This data comes from real-time monitoring of power grid equipment (such as transformers, transmission lines, power stations, etc.). In order to improve the efficiency of data storage and ensure that data can be quickly retrieved and used in scheduling and monitoring, the power grid hopes to automatically generate an optimized database table design diagram to model and store data based on historical data and current power grid scenario requirements.
[0149] ''')
[0150] # Add a heading for implementation process
[0151] doc.add_heading('Implementation plan', level=1)
[0152] # Add detailed explanation for data sources
[0153] doc.add_paragraph('The existing data sources include the description information of the current power grid equipment and the historical database information.')
[0154] doc.add_paragraph('The current equipment information includes data on transformers, transmission lines and power stations, such as the maximum load, operating status and location of transformers collected every day. The historical database stores information such as equipment status and maintenance records over the past few years, which helps predict and analyze the operating status of the current equipment.')
[0155] # Add current data collection situation
[0156] doc.add_heading('Current data collection situation', level=2)
[0157] doc.add_paragraph('The following is the power grid equipment data collected by the power grid every day:')
[0158] doc.add_paragraph('Transformer data: collect the maximum load, operating status and location data of 1,000 transformers every day. For example, the transformer operating load in area a is 150MW and the status is "normal".')
[0159] doc.add_paragraph('Transmission line data: voltage and location information is collected from 500 transmission lines every day. For example, the voltage of the line from area a to area b is 220kV.')
[0160] doc.add_paragraph('Power station data: collect the capacity and operation type of 100 power stations every day. For example, the capacity of the first power station in area a is 1000MW and the operation type is thermal power station.')
[0161] # Add historical data
[0162] doc.add_heading('Historical data collection', level=2)
[0163] doc.add_paragraph('The historical database stores substation information from the past five years. Although this data is no longer directly used in the current system, it is still helpful for grid scenario prediction and historical backtracking. The historical data includes the location information and voltage levels of 300 substations.')
[0164] # Add goals for database generation
[0165] doc.add_heading('Goal', level=2)
[0166] doc.add_paragraph('The power grid hopes to automatically generate a new database table design diagram that can integrate current and historical equipment information to improve storage and retrieval efficiency and quickly query the operating status of equipment in an emergency.')
[0167] # Add transformer table explanation
[0168] doc.add_heading('Transformer data example', level=2)
[0169] doc.add_paragraph('The following table shows the current operating data of some transformers, including their ID, location, maximum load and status.')
[0170] doc.add_paragraph(df_transformer.to_string(index=False))
[0171] # Add power line table explanation
[0172] doc.add_heading('Transmission line data example', level=2)
[0173] doc.add_paragraph('The following are the voltage and location data of the transmission line, including the starting and ending locations of the line.')
[0174] doc.add_paragraph(df_power_line.to_string(index=False))
[0175] # Add power station table explanation
[0176] doc.add_heading('Power plant data example', level=2)
[0177] doc.add_paragraph('Power plant data includes the capacity and operation type of the power plant, which is very important for understanding the overall operation of the power plant.')
[0178] doc.add_paragraph(df_power_station.to_string(index=False))
[0179] # Final analysis and summary
[0180] doc.add_heading('Result Analysis', level=2)
[0181] doc.add_paragraph('Through the automatically generated database table design diagram, the power grid can more effectively manage and store power grid equipment data, especially in emergency situations, it can quickly query and analyze the operating status of equipment. The generated database design not only integrates current data, but also takes into account historical data to ensure that efficient data storage and query capabilities can be maintained in long-term operation.')
[0182] file_path_multi_paragraph
[0183] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0184] Based on the same inventive concept, the embodiment of the present application also provides a training device for realizing the training method for generating a database table design diagram model based on natural language. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more training devices for generating a database table design diagram model based on natural language provided below can refer to the limitations of the training method for generating a database table design diagram model based on natural language above, and will not be repeated here.
[0185] In an exemplary embodiment, as shown in FIG8 , a training device for generating a database table design diagram model based on natural language is provided, comprising: a relationship diagram obtaining module 802, a model selection module 804, a data extraction module 806 and a model training module 808, wherein:
[0186] A relationship diagram obtaining module 802 is used to parse the training table creation statement of the power grid scenario to obtain a training data entity relationship diagram;
[0187] The model selection module 804 is used to select a target base model from various base models preset in the power grid scenario according to the training data entity relationship diagram;
[0188] The data extraction module 806 is used to fuse the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extract the base model training data corresponding to the target base large model from the fused data;
[0189] The model training module 808 is used to train the target base large model according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
[0190] In one embodiment, the model training module 808 is also used to train the target base large model to generate a design drawing based on the base model training data, until the difference between the target design relationship diagram and the training design relationship diagram is less than the design relationship diagram threshold, so as to obtain the design drawing model to be trained; and to perform scenario design training on the design drawing model to be trained based on the database table design information corresponding to the power grid scenario, until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, so as to obtain the database table design drawing model.
[0191] In one embodiment, the model training module 808 is also used to create training design table creation statements using database table design information; parse the training design table creation statements to obtain training database table design analysis data; fuse the training database table design analysis data and the historical database table design analysis data of the power grid scenario, and extract the design drawing model training data corresponding to the design drawing model to be trained from the fused data; perform scenario design training on the design drawing model to be trained according to the design drawing model training data, until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, and obtain the database table design drawing model.
[0192] In one embodiment, the model training module 808 is also used to input the actual database table description information of the power grid scenario into the database table design diagram model to obtain the database table design diagram data; and parse the database table design diagram data to obtain the actual data entity relationship diagram.
[0193] In one embodiment, the relationship diagram obtaining module 802 is also used to identify the entity relationship diagram standard information of the training data entity relationship diagram; the entity relationship diagram standard information represents the unified standard basis for the training data entity relationship diagram; and the statement output specification information of the target base model is set according to the entity relationship diagram standard information.
[0194] In one embodiment, the data extraction module 806 is also used to fuse the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario to obtain database fusion description information; identify the database design scenario from the database fusion description information; and extract the base model training data from the database fusion description information according to the database design scenario.
[0195] Each module in the training device for generating a database table design model based on natural language can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0196] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store server data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a training method for generating a database table design diagram model based on natural language is implemented.
[0197] Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0198] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0199] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0200] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0201] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0202] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0203] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0204] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A training method for generating a database table design diagram model based on natural language, characterized in that: The method comprises: Parse the table creation statements for power grid scenario training to obtain the entity relationship diagram of training data; According to the training data entity relationship diagram, a target base large model is selected from various base large models preset in the power grid scenario; Fusion the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data; The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
2. The method according to claim 1, characterized in that The target base large model is trained according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, and a database table design diagram model is obtained, including: According to the base model training data, the target base large model is trained to generate a design diagram, until the difference between the target design relationship diagram and the training design relationship diagram is less than the design relationship diagram threshold, thereby obtaining a design diagram model to be trained; According to the database table design information corresponding to the power grid scenario, the scenario design training is performed on the design diagram model to be trained until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than the preset condition, thereby obtaining the database table design diagram model.
3. The method according to claim 2, characterized in that The step of performing scenario design training on the design diagram model to be trained according to the database table design information corresponding to the power grid scenario, until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than the preset condition, and obtaining the database table design diagram model, includes: Use the database table design information to create a training table design statement; Parsing the training table creation statement to obtain training database table design analysis data; The training database table design analysis data and the historical database table design analysis data of the power grid scenario are integrated, and the design drawing model training data corresponding to the design drawing model to be trained is extracted from the integrated data; According to the design drawing model training data, scenario design training is performed on the design drawing model to be trained until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than the preset condition, thereby obtaining the database table design drawing model.
4. The method according to claim 1, characterized in that: After the step of training the target base large model according to the base model training data to obtain a database table design diagram model, the method further includes: Inputting actual database table description information of the power grid scenario into the database table design diagram model to obtain database table design diagram data; The database table design diagram data is parsed to obtain an actual data entity relationship diagram.
5. The method according to claim 1, characterized in that After the step of parsing the training table creation statement for the power grid scenario to obtain the training data entity relationship diagram, the method further includes: Identifying entity relationship diagram standard information of the training data entity relationship diagram; the entity relationship diagram standard information represents a unified standard basis for the training data entity relationship diagram; The statement output specification information of the target base model is set according to the standard information of the entity relationship diagram.
6. The method according to any one of claims 1 to 5, characterized in that: The step of fusing the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extracting the base model training data corresponding to the target base large model from the fused data, includes: Fusion of the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario to obtain database fusion description information; identifying a database design scenario from the database fusion description information; According to the database design scenario, the base model training data is extracted from the database fusion description information.
7. A training device for generating a database table design diagram model based on natural language, characterized in that: The device comprises: A relationship diagram acquisition module is used to parse the table creation statements for training power grid scenarios to obtain the entity relationship diagram of training data; A model selection module, used to select a target base large model from various base large models preset in the power grid scenario according to the training data entity relationship diagram; A data extraction module, used to fuse the training database table description information of the power grid scenario with the historical database table description information of the power grid scenario, and extract the base model training data corresponding to the target base large model from the fused data; The model training module is used to train the target base large model according to the base model training data until the difference between the target data entity relationship diagram and the training data entity relationship diagram is less than a preset condition, thereby obtaining a database table design diagram model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.