SQL script generation method and device based on large model and electronic equipment

By obtaining the configuration information and logical description text of data indicators, and using a large model to generate SQL scripts, it solves the problem of time-consuming and error-prone problems of manual writing of SQL scripts, and realizes efficient and automated SQL script generation.

CN119938002APending Publication Date: 2025-05-06BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411998565.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

Manually writing SQL scripts is time-consuming, inefficient and error-prone.

Method used

By obtaining the configuration information of the data metrics to be generated, the logical description text of the data metrics is determined, and a large model is used to generate the corresponding structured query language SQL script.

Benefits of technology

Improves the efficiency of SQL script generation, reduces the occurrence of manual errors, and realizes automatic generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938002A_ABST
    Figure CN119938002A_ABST
Patent Text Reader

Abstract

The invention provides an SQL script generation method and device based on a large model and electronic equipment, and relates to the technical field of artificial intelligence, in particular to the technical fields of deep learning, big data, databases, large models and the like. According to the specific implementation scheme, in combination with configuration information of a to-be-generated data index, a logic description text of the to-be-generated data index is determined, and based on the logic description text, a corresponding structured query language (SQL) script is generated through a large model. Therefore, in combination with the logic description text of the to-be-generated data index, the SQL script for generating the data index can be automatically generated through the large model, and the efficiency of obtaining the SQL script is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the technical fields of deep learning, big data, databases, big models, etc., and in particular to a SQL script generation method, device and electronic device based on a big model. Background Art

[0002] In the field of data processing, it is usually necessary to manually write the corresponding Structured Query Language (SQL) script based on the data indicators to be generated. However, manual writing is time-consuming, inefficient, and prone to errors. Summary of the invention

[0003] The present invention provides a method, device and electronic device for generating SQL scripts based on a large model.

[0004] According to one aspect of the present disclosure, a method for generating SQL scripts based on a big model is provided, the method comprising: obtaining configuration information of a data indicator to be generated; determining a logical description text of the data indicator based on the configuration information; and generating a corresponding structured query language SQL script through a big model based on the logical description text, the SQL script being used to generate the data indicator.

[0005] According to another aspect of the present disclosure, a SQL script generation device based on a big model is provided, the device comprising: a first acquisition module, used to acquire configuration information of a data indicator to be generated; a determination module, used to determine a logical description text of the data indicator according to the configuration information; a generation module, used to generate a corresponding structured query language SQL script through a big model based on the logical description text, the SQL script being used to generate the data indicator.

[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the large model-based SQL script generation method proposed above in the present disclosure.

[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the SQL script generation method based on the large model proposed above in the present disclosure.

[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the SQL script generation method based on a large model proposed above in the present disclosure.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0011] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0012] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;

[0013] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;

[0014] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0015] Figure 5 It is a schematic block diagram of an electronic device used to implement the SQL script generation method based on a large model according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0016] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0017] Figure 1 It is a schematic diagram according to the first embodiment of the present disclosure. It should be noted that the SQL script generation method based on a large model in the embodiment of the present disclosure can be applied to a SQL script generation device based on a large model, and the device can be an electronic device, or can be configured in an electronic device so that the electronic device can perform the SQL script generation function. The following embodiments are described by taking the execution subject as an electronic device as an example.

[0018] It should be noted that the method in this embodiment can be applied to multiple fields, for example, smart e-commerce, smart water, smart buildings, smart finance, etc.

[0019] Among them, the electronic device can be any device with computing capabilities, such as a personal computer (PC), a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a smart speaker, a server, a server cluster, and other hardware devices with various operating systems, touch screens and / or display screens.

[0020] like Figure 1 As shown, the SQL script generation method based on the large model may include the following steps:

[0021] Step 101, obtaining configuration information of the data indicator to be generated.

[0022] It should be noted that the configuration information in this embodiment may include: various information configured for the data indicator.

[0023] Among them, data indicators are quantitative data standards used to measure, monitor and analyze the performance of a business activity, process or system.

[0024] It is understandable that in different fields, the corresponding data indicators are different. For example, in the field of smart e-commerce, data indicators may include: order volume, order processing time, product inventory, order amount, etc.

[0025] For example, the configuration information may include: the indicator name configured for the data indicator, the indicator definition, the data type of the data indicator, the unit of measurement of the data indicator, the atomic indicator based on which the data indicator is generated and the source table of the atomic indicator, the calculation logic based on which the atomic indicator generates the data indicator, the conditions for filtering the atomic indicator, the sorting parameters configured for the atomic indicator, etc. This embodiment does not make any specific limitations on this.

[0026] In some exemplary embodiments, a possible implementation method for obtaining the configuration information of the data indicator to be generated is: providing a configuration interface for the data indicator to be generated, and determining the configuration information of the data indicator according to the configuration operation on the configuration interface. Thus, the user can visually configure the configuration information of the data indicator through the configuration interface, which facilitates the user to configure the configuration information of the data indicator.

[0027] Among them, the configuration interface may include: indicator name configuration area of ​​data indicators, indicator definition configuration area, source table options of atomic indicators, calculation logic editing area, filter condition configuration area, sorting parameter configuration area, data type configuration area of ​​data indicators and measurement unit configuration area, etc., to facilitate users to configure relevant configuration information of data indicators in the corresponding area.

[0028] Step 102: Determine the logical description text of the data indicator according to the configuration information.

[0029] It is understandable that in different application scenarios, the method of determining the logical description text of the data indicator is different according to the configuration information, and an exemplary description is as follows:

[0030] As an example, various elements required for generating a logic description text may be extracted from the configuration information, and the logic description text of the data indicator may be generated based on the extracted elements.

[0031] As another example, the configuration information may be input into a pre-trained logic description text generation model to generate a logic description text of the data indicator through the logic description text generation model.

[0032] Step 103, based on the logical description text, a corresponding structured query language SQL script is generated through the large model, and the SQL script is used to generate data indicators.

[0033] Among them, the big model is a large neural network model trained using deep learning algorithms, designed to understand and generate natural language text. The big model is trained with a large amount of text data, and is able to capture the complexity and nuances of language, so as to perform various natural language processing tasks, such as text generation, code generation, question-answering systems, semantic understanding and reasoning, etc. This model is designed to improve the model's expressiveness and predictive performance, and can handle more complex tasks and data, showing human-like intelligence.

[0034] The large model in the disclosed embodiment may be the following large models, such as the large language model LLM, GPT3 (Generative Pre-trained Transformer), GPT4, T5 (Text-to-Text Transfer Transformer), LLaMA (Large Language Model Meta AI, lightweight large model), etc.

[0035] In some embodiments, the logic description text may be input into the big model to generate a corresponding structured query language SQL script through the big model, and the SQL script is used to generate data indicators.

[0036] In other embodiments, prompt words may be generated based on the logic description text and input into the big model to generate corresponding SQL scripts through the big model, wherein the prompt words are used to prompt the big model to generate corresponding SQL scripts based on the logic description text.

[0037] The SQL script generation method based on the big model of the embodiment of the present disclosure determines the logical description text of the data indicator to be generated in combination with the configuration information of the data indicator to be generated, and generates the corresponding structured query language SQL script through the big model based on the logical description text. Thus, in combination with the logical description text of the data indicator to be generated, the SQL script for generating the data indicator can be automatically generated through the big model, thereby improving the efficiency of obtaining the SQL script.

[0038] In order to clearly explain the process of determining the logical description text of the data indicator according to the configuration information, the embodiment of the present disclosure also provides a method for generating SQL scripts based on a large model. Figure 2 The large model-based SQL script generation method provided in this embodiment is further described in an exemplary manner.

[0039] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure.

[0040] like Figure 2 As shown, the method may include the following steps:

[0041] Step 201, obtaining configuration information of the data indicator to be generated.

[0042] It should be noted that, for the specific description of step 201, reference may be made to the relevant descriptions in other embodiments, which will not be repeated here.

[0043] Step 202: when it is determined that the indicator type of the data indicator is an atomic indicator type, a source table of the data indicator is extracted from the configuration information, and a logical description text of the data indicator is determined according to the source table.

[0044] Among them, the source table, also known as the fact table, is the actual data generated in the actual business processing process of different business scenarios. For example, in the smart e-commerce scenario, the source table is the order table, which describes the data generated in the process of placing an order.

[0045] For example, in a smart e-commerce scenario, the data indicator can be the user's order payment amount, and the corresponding source table can be the user order table.

[0046] In some embodiments, the indicator type of the data indicator may be determined based on the content included in the configuration information.

[0047] Among them, data indicator types can include atomic indicator types, derived indicator types, and composite indicator types.

[0048] In this embodiment, the logical description text of the data indicator is accurately determined by combining the atomic indicator of the data indicator generated in the configuration information, the source table of the atomic indicator, and the calculation logic based on which the atomic indicator generates the data indicator, which helps the subsequent large model to accurately generate the corresponding SQL script.

[0049] Step 203: When it is determined that the indicator type of the data indicator is a derived indicator type, at least one atomic indicator based on which the data indicator is generated and a source table of the atomic indicator are obtained from the configuration information.

[0050] Step 204: Determine the calculation logic based on which the atomic indicator generates the data indicator from the configuration information.

[0051] Step 205, determining the logical description text of the data indicator according to the atomic indicator, the source table and the calculation logic.

[0052] In some embodiments, the atomic indicator, source table and calculation logic can be added to a preset logic description template to obtain the logic description text of the data indicator. Thus, in combination with the logic description template, the logic description text of the data indicator can be obtained quickly and accurately.

[0053] In some exemplary embodiments, when a user wants to generate a data indicator under the value of a certain dimension based on an atomic indicator under the value of the dimension, correspondingly, the user can set a filtering condition for the atomic indicator that generates the data indicator, so as to filter the atomic indicators in the source table in combination with the dimension in the filtering condition and the target value of the dimension. Therefore, in some embodiments, the configured filtering condition can also be obtained from the configuration information, wherein the filtering condition includes: the dimension and the target value of the dimension, wherein the target value is used to filter the atomic indicator in the source table to obtain the filtered atomic indicator, wherein the filtered atomic indicator is used to generate the data indicator under the target value of the dimension.

[0054] The target value may be a specific value range, or a specific value or type, etc. For example, if the dimension is a region dimension, the target value of the dimension may be region 1, region 2, or region 3, etc. For another example, if the dimension is a time dimension, the target value of the time dimension may be from July 12, 2024 to December 7, 2024, etc.

[0055] Among them, the filtered atomic indicators all meet the filtering conditions, that is, the filtered atomic indicators only include atomic indicators under the target value of the dimension.

[0056] The number of dimensions may be one or more. For example, when the number of dimensions is one, the dimension may be a time dimension or a region dimension. For another example, when the number of dimensions is two, the two dimensions may be a time dimension and a region dimension respectively.

[0057] Correspondingly, the implementation method of determining the logical description text of the data indicator according to the atomic indicator, the source table and the calculation logic can be: determining the logical description text of the data indicator according to the filtering condition, the atomic indicator, the source table and the calculation logic. Thus, the logical description text of the data indicator is further accurately determined.

[0058] The dimensions in this embodiment are stored in a dimension table.

[0059] It is understandable that in different business scenarios, the dimensions included in the dimension table are different. For example, in the field of smart e-commerce, the dimension table may include but is not limited to: order dimension, user dimension, product dimension, region dimension, time dimension, etc. For another example, in the field of smart finance, the dimension table may include but is not limited to: customer dimension, product dimension, market dimension, time dimension, etc.

[0060] Step 206: When it is determined that the indicator type of the data indicator is a composite indicator type, determine from the configuration information at least one derived indicator based on which the data indicator is generated and a first calculation logic based on which the derived indicator generates the data indicator.

[0061] Step 207: Determine from the configuration information at least one atomic indicator based on which the derived indicator is generated, a source table of the atomic indicators, and a second calculation logic based on which the atomic indicators generate the derived indicators.

[0062] Step 208: Determine a third calculation logic for generating data indicators based on the atomic indicators according to the first calculation logic and the second calculation logic.

[0063] Step 209, determining the logical description text of the data indicator according to the atomic indicator, the source table and the third calculation logic.

[0064] In this embodiment, by extracting information from the configuration information, combining the first calculation logic based on which the derived indicator generates the data indicator, and the second calculation logic based on which the atomic indicator generates the derived indicator, the third calculation logic for generating the data indicator based on the atomic indicator is accurately determined, and combining the atomic indicator, the source table of the atomic indicator and the third calculation logic, the logical description text of the data indicator is accurately determined, which helps the subsequent large model to accurately generate the corresponding SQL script.

[0065] In some embodiments, the atomic indicator, the source table and the third calculation logic may be added to the logic description template to obtain the logic description text of the data indicator, thereby accurately determining the logic description text.

[0066] In some exemplary embodiments, when a user wants to generate a data indicator under the value of a certain dimension based on an atomic indicator under the value of the dimension, correspondingly, the user can set a filtering condition for the atomic indicator that generates the data indicator, so as to filter the atomic indicators in the source table in combination with the dimension in the filtering condition and the target value of the dimension. Therefore, in some embodiments, the configured filtering condition can also be obtained from the configuration information, wherein the filtering condition includes: the dimension and the target value of the dimension, wherein the target value is used to filter the atomic indicator in the source table to obtain the filtered atomic indicator, wherein the filtered atomic indicator is used to generate the data indicator under the target value of the dimension.

[0067] Among them, the filtered atomic indicators all meet the filtering conditions, that is, the filtered atomic indicators only include atomic indicators under the target value of the dimension.

[0068] The number of dimensions may be one or more. For example, the dimension may be a time dimension, or a region dimension, or may be a time dimension and a region dimension.

[0069] Correspondingly, the implementation method of determining the logical description text of the data indicator according to the atomic indicator, the source table and the third calculation logic can be: determining the logical description text of the data indicator according to the filtering condition, the atomic indicator, the source table and the third calculation logic.

[0070] Step 210, based on the logical description text, a corresponding structured query language SQL script is generated through the large model, and the SQL script is used to generate data indicators.

[0071] It should be noted that, for the specific description of step 210, reference may be made to the relevant descriptions in other embodiments, which will not be repeated here.

[0072] In this embodiment, after obtaining the configuration information of the data indicator to be generated, the corresponding information is extracted from the configuration information in combination with the indicator type of the data indicator, and the logical description text of the data indicator is accurately determined in combination with the extracted information, and the corresponding SQL script is accurately generated in combination with the logical description text and the large model.

[0073] In order to clearly understand the present disclosure, Figure 3 The method of this embodiment is further described illustratively.

[0074] Figure 3is a schematic diagram according to a third embodiment of the present disclosure.

[0075] like Figure 3 As shown, the method may include:

[0076] Step 301, obtaining configuration information of the data indicator to be generated.

[0077] Step 302: Determine the logical description text of the data indicator according to the configuration information.

[0078] It should be noted that, for the specific description of step 301 - step 302, reference may be made to the relevant description in other embodiments, which will not be repeated here.

[0079] Step 303, input the logic description text into the large model to obtain the optimized logic description text.

[0080] In this embodiment, in order to provide clear instructions to the large model and guide it to generate the required output, a first prompt word can be generated based on the logic description text, wherein the first prompt word is used to instruct to optimize the logic description text, and the first prompt word is input into the large model to obtain the optimized logic description text. Thus, providing clear instructions to the large model through the first prompt word helps to improve the accuracy of the optimized logic description text generated by the large model.

[0081] In some embodiments, the logic description text may be added to a corresponding position in a preset first prompt word template to generate the first prompt word.

[0082] The first prompt word template refers to a prompt word template that is preset so that the large model can optimize the logic description text.

[0083] The first prompt word template may also include optimization requirements for the logic description text.

[0084] In some embodiments, the first prompt word template may also include: a logic description text example for reference when optimizing the logic description text, so that the large model can optimize the input logic description text based on the framework of the logic description text example.

[0085] The logic description text example refers to the logic description text based on which the large model can accurately generate the corresponding SQL script.

[0086] The optimized logic description text is similar to or identical to the framework of the logic description text example.

[0087] Step 304, input the optimized logic description text into the large model to obtain the SQL script.

[0088] Among them, the SQL script is used to generate the data indicator.

[0089] In some embodiments, in order to provide clear instructions to the large model and guide it to generate the required output, a second prompt word can be generated according to the optimized logic description text, wherein the second prompt word is used to instruct the generation of an SQL script based on the optimized logic description text; the second prompt word is input into the large model to obtain the SQL script. Thus, providing clear instructions to the large model through the second prompt word helps to improve the accuracy of the SQL script generated by the large model.

[0090] In some embodiments, the optimized logic description text may be added to the second prompt word template to obtain the second prompt word.

[0091] The second prompt word template refers to a prompt word template that is preset to guide the large model to generate an SQL script based on the optimized logic description text.

[0092] For example, the second prompt word template is as follows:

[0093] 1. Data table: ``

[0094] Main fields: `<field name 1>`, `<field name 2>`, ...

[0095] 2. Data indicators:

[0096] Metric 1: Calculate the <aggregation method> of <field name>, for example, sum, average, maximum, minimum.

[0097] Indicator 2: Count the total count of `<field name>` grouped by `<category field>`.

[0098] 3. Filter conditions:

[0099] Filter records where <field name> meets <condition>, e.g. date range, numeric range, specific category.

[0100] 4. Grouping and Sorting:

[0101] Group by `<grouping field>`.

[0102] Sort by <sort field> in ascending or descending order.

[0103] 5. Output fields:

[0104] Show only the following fields: `<fieldname1>`, `<fieldname2>`, ...

[0105] 6. Other requirements:

[0106] Limit query results to `<number of rows>` rows, etc.

[0107] It can be understood that the logical description of the data indicator includes the field value of the target field, wherein the target field is the field corresponding to the characters to be replaced in the second prompt word template, and the field value corresponding to the target field can be used to replace the characters to be replaced in the second prompt word template to obtain the second prompt word.

[0108] Among them, `<…>` in the second prompt word template in the above example represents the characters to be replaced.

[0109] It is understandable that after the SQL script is generated, subsequent development can be performed based on the SQL script.

[0110] In this embodiment, after determining the logical description text of the data indicator in combination with the configuration information of the data indicator to be generated, the logical description text is optimized through the big model to obtain the optimized logical description text, and the optimized logical description text is input into the big model to improve the accuracy of the corresponding SQL script generated by the big model.

[0111] In order to implement the above embodiments, the present disclosure also provides a SQL script generation device based on a large model.

[0112] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure.

[0113] like Figure 4 As shown, the SQL script generation device 40 based on the large model may include: a first acquisition module 401, a determination module 402 and a generation module 403, wherein:

[0114] The first acquisition module 401 is used to acquire configuration information of the data indicator to be generated.

[0115] The determination module 402 is used to determine the logical description text of the data indicator according to the configuration information.

[0116] The generation module 403 is used to generate a corresponding structured query language SQL script based on the logical description text through the large model, and the SQL script is used to generate data indicators.

[0117] As a possible implementation method of the embodiment of the present disclosure, the determination module 402 is specifically used to: when it is determined that the indicator type of the data indicator is a derived indicator type, obtain at least one atomic indicator based on which the data indicator is generated and a source table of the atomic indicator from the configuration information; determine from the configuration information the calculation logic based on which the atomic indicator generates the data indicator; and determine the logical description text of the data indicator based on the atomic indicator, the source table and the calculation logic.

[0118] As a possible implementation of the embodiment of the present disclosure, the device may further include:

[0119] A second acquisition module is used to acquire the configured filtering conditions from the configuration information, wherein the filtering conditions include: a dimension and a target value of the dimension, wherein the target value is used to filter the atomic indicators in the source table to obtain the filtered atomic indicators, wherein the filtered atomic indicators are used to generate data indicators under the target value of the dimension;

[0120] The determination module 402 is specifically used for:

[0121] Determine the logical description text of the data indicator based on the filter conditions, atomic indicators, source tables, and calculation logic.

[0122] As a possible implementation method of the embodiment of the present disclosure, the determination module 402 is specifically used to: add the atomic indicator, the source table and the calculation logic to the preset logic description template to obtain the logic description text of the data indicator.

[0123] As a possible implementation method of the embodiment of the present disclosure, the determination module 402 is specifically used to: when it is determined that the indicator type of the data indicator is a composite indicator type, determine from the configuration information at least one derivative indicator based on which the data indicator is generated and the first calculation logic based on which the derivative indicator generates the data indicator; from the configuration information, determine at least one atomic indicator based on which the derivative indicator is generated, the source table of the atomic indicator, and the second calculation logic based on which the atomic indicator generates the derivative indicator; according to the first calculation logic and the second calculation logic, determine the third calculation logic for generating the data indicator based on the atomic indicator; according to the atomic indicator, the source table and the third calculation logic, determine the logical description text of the data indicator.

[0124] As a possible implementation of the embodiment of the present disclosure, the first acquisition module 401 is specifically used to: provide a configuration interface for the data indicator to be generated; and determine the configuration information of the data indicator according to the configuration operation on the configuration interface.

[0125] As a possible implementation of the embodiment of the present disclosure, the generating module 403 includes:

[0126] The first generating unit is used to input the logic description text into the large model to obtain the optimized logic description text;

[0127] The second generation unit is used to input the optimized logic description text into the large model to obtain an SQL script.

[0128] As a possible implementation method of the embodiment of the present disclosure, the first generation unit is specifically used to: generate a first prompt word according to the logic description text, wherein the first prompt word is used to indicate that the logic description text is to be optimized; input the first prompt word into the large model to obtain the optimized logic description text.

[0129] As a possible implementation method of the embodiment of the present disclosure, the second generation unit is specifically used to: generate a second prompt word according to the optimized logic description text, wherein the second prompt word is used to indicate the generation of an SQL script based on the optimized logic description text; input the second prompt word into the large model to obtain the SQL script.

[0130] It should be noted that the aforementioned explanation of the SQL script generation method embodiment based on the large model is also applicable to the data device embodiment and will not be repeated here.

[0131] The SQL script generation device based on the big model of the embodiment of the present disclosure determines the logical description text of the data indicator to be generated in combination with the configuration information of the data indicator to be generated, and generates the corresponding structured query language SQL script through the big model based on the logical description text. Thus, in combination with the logical description text of the data indicator to be generated, the SQL script for generating the data indicator can be automatically generated through the big model, thereby improving the efficiency of obtaining the SQL script.

[0132] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, comply with the relevant laws and regulations, and do not violate public order and good morals.

[0133] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0134] Figure 5 It is a schematic block diagram of an electronic device for implementing the SQL script generation method based on a large model of an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0135] like Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0136] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0137] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as a SQL script generation method based on a large model. For example, in some embodiments, the SQL script generation method based on a large model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the SQL script generation method based on the large model described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the large model-based SQL script generation method in any other appropriate manner (for example, by means of firmware).

[0138] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0139] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable large-model-based SQL script generating device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0140] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0141] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0142] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0143] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0144] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0145] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for generating SQL scripts based on a large model, comprising: Get the configuration information of the data indicators to be generated; Determine the logic description text of the data indicator according to the configuration information; Based on the logic description text, a corresponding structured query language SQL script is generated through a large model, and the SQL script is used to generate the data index.

2. The method according to claim 1, wherein: Determining the logical description text of the data indicator according to the configuration information includes: In the case where it is determined that the indicator type of the data indicator is a derived indicator type, obtaining at least one atomic indicator based on which the data indicator is generated and a source table of the atomic indicator from the configuration information; Determining, from the configuration information, a calculation logic based on which the atomic indicator generates the data indicator; The logical description text of the data indicator is determined according to the atomic indicator, the source table and the calculation logic.

3. The method according to claim 2, wherein: The method further comprises: From the configuration information, the configured filtering condition is obtained, wherein the filtering condition includes: a dimension and a target value of the dimension, wherein the target value is used to filter the atomic indicators in the source table to obtain filtered atomic indicators, wherein the filtered atomic indicators are used to generate the data indicators under the target value of the dimension; Wherein, determining the logic description text of the data indicator according to the atomic indicator, the source table and the calculation logic includes: The logical description text of the data indicator is determined according to the filtering condition, the atomic indicator, the source table and the calculation logic.

4. The method according to claim 2, wherein: The step of determining the logic description text of the data indicator according to the atomic indicator, the source table and the calculation logic includes: The atomic indicator, the source table and the calculation logic are added to a preset logic description template to obtain a logic description text of the data indicator.

5. The method according to claim 1, wherein: Determining the logical description text of the data indicator according to the configuration information includes: In the case where it is determined that the indicator type of the data indicator is a composite indicator type, determining from the configuration information at least one derived indicator based on which the data indicator is generated and a first calculation logic based on which the derived indicator generates the data indicator; Determine from the configuration information at least one atomic indicator based on which the derived indicator is generated, a source table of the atomic indicator, and a second calculation logic based on which the atomic indicator generates the derived indicator; Determine, according to the first calculation logic and the second calculation logic, a third calculation logic for generating the data indicator based on the atomic indicator; The logical description text of the data indicator is determined according to the atomic indicator, the source table and the third calculation logic.

6. The method according to claim 1, wherein: The step of obtaining configuration information of the data indicator to be generated includes: Provide a configuration interface for the data indicators to be generated; According to the configuration operation on the configuration interface, the configuration information of the data indicator is determined.

7. The method according to claim 1, wherein: The method of generating a corresponding structured query language SQL script based on the logic description text through a large model includes: Inputting the logic description text into the large model to obtain an optimized logic description text; The optimized logic description text is input into the large model to obtain the SQL script.

8. The method according to claim 7, wherein: The step of inputting the logic description text into the large model to obtain an optimized logic description text includes: Generate a first prompt word according to the logic description text, wherein the first prompt word is used to indicate that the logic description text is to be optimized; The first prompt word is input into the large model to obtain the optimized logic description text.

9. The method according to claim 8, wherein: The step of inputting the optimized logic description text into the large model to obtain the SQL script includes: Generate a second prompt word according to the optimized logic description text, wherein the second prompt word is used to instruct to generate an SQL script based on the optimized logic description text; The second prompt word is input into the large model to obtain the SQL script.

10. A SQL script generation device based on a large model, comprising: A first acquisition module is used to acquire configuration information of the data indicator to be generated; A determination module, used to determine the logical description text of the data indicator according to the configuration information; A generation module is used to generate a corresponding structured query language SQL script through a large model based on the logical description text, and the SQL script is used to generate the data indicator.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.