Data processing method and device, electronic equipment and storage medium

By optimizing parallel retrieval in heterogeneous databases and large language model feedback loops, the high cross-database adaptation failure rate of structured query language was solved, and efficient query result output was achieved.

CN120653665APending Publication Date: 2025-09-16BEIJING JINGDONG YUANSHENG TECH CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510805159.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In the existing technology, the failure rate of structured query language in cross-database adaptation is high, resulting in query failure.

Method used

By parallel searching the query data entered by the user in a pre-built heterogeneous database, a preliminary structured query language is constructed using a large language model, and syntax verification is performed in the database execution engine. If it fails, the error information is fed back to the large language model for correction until the preset conditions are met.

Benefits of technology

It achieves fast matching of heterogeneous knowledge sources, reduces the failure rate of structured query language in cross-database adaptation, and improves the success rate and efficiency of queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653665A_ABST
    Figure CN120653665A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. Obtaining query data input by a user, performing parallel retrieval on the query data in a pre-constructed heterogeneous database, and determining retrieval result data; constructing cue words according to the retrieval result data, inputting the cue words into a pre-trained large language model, and outputting a preliminary structured query language; inputting the preliminary structured query language into a database execution engine for grammar verification, and outputting an execution result; and if the execution result does not meet the preset condition, feeding back the execution result to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset condition. According to the method, rapid matching of the heterogeneous knowledge sources is realized in a manner of combining the heterogeneous database with parallel retrieval, and the problem that a structured query language is relatively high in failure rate during cross-database adaptation is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, electronic device, and storage medium. Background Art

[0002] In the digital age, logistics supply chain management encompasses the entire process from raw material procurement, production and processing, product transportation, and final delivery. Each link generates massive amounts of multi-dimensional data assets, including supplier information, inventory distribution, warehouse orders, delivery status, and more. This data is characterized by heterogeneous structures. Querying this data requires manual extraction from disparate systems and data association through the writing of complex structured query language statements.

[0003] In related technologies, intelligent question-answering based on large language models enables natural language queries. However, due to the heterogeneity of data models, structured query language has a high failure rate when adapting across databases, resulting in query failure.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention

[0005] The present disclosure provides a data processing method, device, electronic device, and storage medium, which, at least to a certain extent, overcome the problem of high failure rate of structured query language in cross-database adaptation in related technologies.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.

[0007] According to one aspect of the present disclosure, a data processing method is provided, comprising: obtaining query data input by a user, performing parallel searching of the query data in a pre-constructed heterogeneous database, and determining search result data; constructing prompt words based on the search result data, inputting the prompt words into a pre-trained large language model, and outputting preliminary structured query language; inputting the preliminary structured query language into a database execution engine for syntax verification, and outputting an execution result; and if the execution result does not meet a preset condition, feeding the execution result back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset condition.

[0008] In some embodiments, the pre-built heterogeneous database includes: determining the heterogeneous database according to a pre-built table metadata vector library and a pre-built question-answer pair vector library.

[0009] In some embodiments, determining the heterogeneous database based on a pre-built table metadata vector library and a pre-built question-answer pair vector library includes: parsing the original database schema definition language into structured data objects; converting the structured data objects into standardized table metadata according to preset standards; vectorizing the standardized table metadata to determine the table metadata vector library; vectorizing the synthetic question-answer pair data and the historical interactive question-answer pair data to determine the question-answer pair vector library; and determining the heterogeneous database based on the table metadata vector library and the question-answer pair vector library.

[0010] In some embodiments, the query data is searched in parallel in a pre-built heterogeneous database to determine the retrieval result data, including: after vectorizing the query data, indexing in parallel in the table metadata vector library and the question-answer pair vector library respectively to determine the table and question-answer pairs associated with the query data; sorting the table and the question-answer pairs to determine the retrieval result data.

[0011] In some embodiments, the retrieval result data includes: contextual knowledge, user queries, constraints and logical checks; constructing prompt words based on the retrieval result data includes: injecting natural language descriptions into the contextual knowledge, user queries, constraints and logical checks according to a preset template to determine the prompt words.

[0012] In some embodiments, the execution result is fed back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets a preset condition, including: if the execution result includes an error log, the error information in the error log is injected into a natural language description according to a preset template, and a prompt word including error feedback is determined; the prompt word including error feedback is input into the large language model, and the large language model outputs a corrected structured query language based on the prompt word including error feedback and the preliminary structured query language; the corrected structured query language is input into the database execution engine for syntax verification, and the execution result is output.

[0013] In some embodiments, the method further includes: outputting a visualization display result in structured query language based on a visualization library.

[0014] According to another aspect of the present disclosure, a data processing device is provided, comprising: a retrieval module for acquiring query data input by a user, performing parallel retrieval of the query data in a pre-constructed heterogeneous database, and determining retrieval result data; a structured query language output module for constructing prompt words based on the retrieval result data, inputting the prompt words into a pre-trained large language model, and outputting preliminary structured query language; a grammar verification module for inputting the preliminary structured query language into a database execution engine for grammar verification, and outputting an execution result; and a feedback optimization module for feeding back the execution result to the large language model if the execution result does not meet preset conditions, until the execution result of the structured query language output by the large language model in the database execution engine meets preset conditions.

[0015] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned data processing methods by executing the executable instructions.

[0016] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data processing method described above is implemented.

[0017] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, any one of the above-mentioned data processing methods is implemented.

[0018] The data processing method provided in the embodiments of the present disclosure obtains query data input by the user, searches the query data in parallel in a pre-built heterogeneous database, and determines the search result data; constructs prompt words based on the search result data, inputs the prompt words into a pre-trained large language model, and outputs a preliminary structured query language; inputs the preliminary structured query language into the database execution engine for syntax verification, and outputs the execution result; if the execution result does not meet the preset conditions, the execution result is fed back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset conditions. The present disclosure achieves rapid matching of heterogeneous knowledge sources by combining heterogeneous databases with parallel search, solving the problem of high failure rate of structured query language during cross-database adaptation.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0021] Figure 1 A schematic diagram showing a data processing system structure according to an embodiment of the present disclosure;

[0022] Figure 2 A flow chart of a data processing method according to an embodiment of the present disclosure is shown;

[0023] Figure 3 A flowchart showing a specific example of a data processing method according to an embodiment of the present disclosure is provided;

[0024] Figure 4 A flowchart showing another specific example of a data processing method according to an embodiment of the present disclosure;

[0025] Figure 5 A flowchart showing another specific example of a data processing method according to an embodiment of the present disclosure;

[0026] Figure 6 A flowchart showing another specific example of a data processing method according to an embodiment of the present disclosure;

[0027] Figure 7 A flowchart showing another specific example of a data processing method according to an embodiment of the present disclosure;

[0028] Figure 8 A schematic diagram of a data processing device according to an embodiment of the present disclosure is shown;

[0029] Figure 9 A structural block diagram of a computer device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0031] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0032] For ease of understanding, before introducing the embodiments of the present disclosure, several terms involved in the embodiments of the present disclosure are first explained as follows:

[0033] Database Schema Definition Language: DDL, Data Definition Language, is a language used to describe real-world entities to be stored in a database;

[0034] Structured Query Language: SQL;

[0035] Large Language Model: LLM, Large Language Model.

[0036] The specific implementation of the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.

[0037] Figure 1 FIG. 1 shows an exemplary application system architecture diagram to which the data processing method in the embodiment of the present disclosure can be applied. Figure 1 As shown, the system architecture may include a terminal device 101 , a network 102 and a server 103 .

[0038] The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103 , and can be a wired network or a wireless network.

[0039] Optionally, the above-mentioned wireless network or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network). In some embodiments, technologies and / or formats including Hypertext Markup Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPSec), etc. can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.

[0040] The terminal device 101 can be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart watches, wearable devices, augmented reality devices, virtual reality devices, etc.

[0041] Optionally, the client of the application installed in different terminal devices 101 is the same, or the client of the same type of application based on different operating systems. Based on the different terminal platforms, the specific form of the client of the application can also be different, for example, the application client can be a mobile phone client, a PC client, etc.

[0042] In one example of the present disclosure, a terminal device obtains query data input by a user, searches the query data in parallel in a pre-built heterogeneous database, and determines retrieval result data; constructs prompt words based on the retrieval result data, inputs the prompt words into a pre-trained large language model, and outputs a preliminary structured query language; inputs the preliminary structured query language into a database execution engine for syntax verification, and outputs an execution result; if the execution result does not meet a preset condition, the execution result is fed back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset condition.

[0043] The server 103 may be a server that provides various services, such as a background management server that provides support for the devices operated by the user using the terminal device 101. The background management server may analyze and process the received request and other data, and feed back the processing results to the terminal device.

[0044] Optionally, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0045] Those skilled in the art will know that Figure 1 The number of terminal devices, networks, and servers in the embodiment is merely illustrative, and any number of terminal devices, networks, and servers may be provided based on actual needs. This embodiment of the present disclosure does not limit this.

[0046] Figure 2 A flow chart of a data processing method according to an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the data processing method provided in the embodiment of the present disclosure includes the following steps:

[0047] S202 , obtaining query data input by the user, searching the query data in parallel in a pre-built heterogeneous database, and determining search result data.

[0048] It should be noted that the query data can be in natural language. For example, "Which are the three cities with the highest order volume?" or "Show the stations in region A with more than 100 dispatch orders in the past three days." The heterogeneous database can be a collection of multiple related database systems, enabling data sharing and transparent access. For example, a database of heterogeneous knowledge sources. The parallel search can be a parallel search of each database within the heterogeneous database. For example, the parallel search uses a multi-way joint index and leverages the hybrid search capabilities of a vector database to implement parallel queries.

[0049] In a specific example, a heterogeneous database is determined based on a pre-built table metadata vector library and a pre-built question-answer pair vector library.

[0050] S204: construct prompt words based on the search result data, input the prompt words into a pre-trained large language model, and output a preliminary structured query language.

[0051] It should be noted that the aforementioned large language model can be a natural language processing model built using deep learning technology, capable of understanding and generating natural language text. By training on massive amounts of text data, the large language model learns the statistical laws and patterns of language, enabling it to handle various natural language tasks such as text classification, sentiment analysis, machine translation, dialogue systems, and text generation. The aforementioned prompt words can be used to guide the large language model to generate specific outputs or complete specific tasks.

[0052] S206: Input the preliminary structured query language into the database execution engine for syntax verification, and output the execution result.

[0053] It should be noted that the database execution engine can be used to perform syntax (logic) verification on the structured query language generated by the large speech model and ultimately return an execution result. The execution result can be data returned if the execution is successful (preset conditions are met), or log information returned if the execution fails (preset conditions are not met, for example, a syntax error), including error information.

[0054] S208: If the execution result does not meet the preset conditions, the execution result is fed back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset conditions.

[0055] It should be noted that the aforementioned preset condition can be determining whether the execution result returns a log message containing an error message. For example, if a log message containing an error message is returned, the execution result does not meet the preset condition, and the error message is fed back to the large language model for iterative correction until the execution engine returns valid data (or the maximum number of retries is reached). If the execution engine returns valid data, the large language model inference process is immediately terminated, and the final result is output.

[0056] The present disclosure realizes fast matching of heterogeneous knowledge sources by combining heterogeneous databases with parallel retrieval, and solves the problem of high failure rate of structured query language in cross-database adaptation.

[0057] In one embodiment of the present disclosure, Figure 3 As shown, the data processing method provided in the embodiment of the present disclosure can determine the pre-built heterogeneous database through the following steps, and can realize the unified vectorization of heterogeneous data:

[0058] S302, parsing the original database schema definition language into structured data objects;

[0059] S304, converting the structured data object into standardized table metadata according to a preset standard;

[0060] S306, vectorizing the standardized table metadata to determine a table metadata vector library;

[0061] S308, vectorizing the synthesized question-answer pair data and the historical interactive question-answer pair data to determine a question-answer pair vector library;

[0062] S310: Determine a heterogeneous database based on the table metadata vector library and the question-answer pair vector library.

[0063] It should be noted that the aforementioned preset standards may be standardized processing. For example, the table structure in the database may be standardized, including the unified formatting of information such as field names, data types, primary keys, and foreign keys. The aforementioned synthetic question-answer pair data synthesis traverses the database table according to predefined rules (query modes such as filtering, aggregation, and joining), automatically generating specific <natural language, structured query language> question-answer pair data. The aforementioned question-answer pair vector library may be a historical question-answer pair vector library, which collects, records, and organizes correct <natural language, structured query language> question-answer pair data generated during the interaction between users and intelligent agents, including query requirements and expressions in real business scenarios.

[0064] In one embodiment of the present disclosure, Figure 4 As shown, the data processing method provided in the embodiment of the present disclosure can determine the search result data through the following steps. Through vectorization and parallel indexing, the efficiency and accuracy of data association search are improved. At the same time, the orderliness and relevance of the search results are ensured by combining the sorting step:

[0065] S402: After the query data is vectorized, it is indexed in parallel in the table metadata vector library and the question-answer pair vector library to determine the table and question-answer pair associated with the query data;

[0066] S404: Sort the table and question-answer pairs to determine the search result data.

[0067] In a specific example, to answer a user query for the three cities with the highest order volume, it's necessary to associate sales information with address information and count the number of orders in each city. First, join the sales and address tables using the address ID. After joining, group by the city field and count the number of orders for each city. Finally, sort the tables in descending order by order volume and select the top three cities.

[0068] In one embodiment of the present disclosure, Figure 5 As shown, the data processing method provided in the embodiment of the present disclosure includes the search result data including contextual knowledge, user query, constraint conditions, and logical verification. The data processing method includes the following steps to construct prompt words based on the search result data. By injecting natural language descriptions, the large language password can be guided to generate a response through human-like chain reasoning:

[0069] S502: injecting a natural language description into the context knowledge, user query, constraint conditions and logic verification according to a preset template to determine a prompt word.

[0070] It should be noted that the above natural language description can be a thought chain prompt word. By injecting the thought chain prompt word, the model can be guided to follow the preset logic and dynamically adjust the output results.

[0071] In one embodiment of the present disclosure, Figure 6 As shown, S208 in the data processing method provided in the embodiment of the present disclosure specifically includes the following steps to correct the structured query language. Through the feedback loop driven by the error log, accurate mapping from natural language to structured query language is achieved, and the output results can be dynamically optimized:

[0072] S602, if the execution result includes an error log, inject the error information in the error log into a natural language description according to a preset template, and determine a prompt word including error feedback;

[0073] S604: Input the prompt word including the error feedback into the large language model, and the large language model outputs a corrected structured query language based on the prompt word including the error feedback and the preliminary structured query language;

[0074] S606: Input the corrected structured query language into the database execution engine for syntax verification, and output the execution result.

[0075] In a specific example, if the execution succeeds and returns data, the large language model's reasoning is correct, and the process ends. If the execution fails, the execution engine will record the error message and feed it back to the large language model using a specific prompt word template. The large language model then uses the feedback error message and the initial structured query language to perform internal reasoning and optimization again, generating a revised structured query language.

[0076] In one embodiment of the present disclosure, Figure 7 As shown, the data processing method provided in the embodiments of the present disclosure can be used to present visual results through the following steps, converting technical data processing into intuitive visual language, thereby improving user experience:

[0077] S702: Outputting visualization results of the structured query language based on the visualization library.

[0078] In a specific example, the functions and parameters that need to be visualized are determined based on the data characteristics of the query results, and then the visualization library is called for real-time rendering to generate a visualization page or image.

[0079] Based on the same inventive concept, the present disclosure also provides a data processing device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.

[0080] Figure 8 A schematic diagram of a data processing device according to an embodiment of the present disclosure is shown. Figure 8 As shown, the device includes: a retrieval module 81, a structured query language output module 82, a grammar checking module 83 and a feedback optimization module 84.

[0081] The retrieval module 81 is used to obtain the query data input by the user, search the query data in parallel in the pre-built heterogeneous database, and determine the search result data;

[0082] The structured query language output module 82 is used to construct prompt words based on the search result data, input the prompt words into the pre-trained large language model, and output preliminary structured query language;

[0083] Syntax check module 83, used to input the preliminary structured query language into the database execution engine for syntax check and output the execution result;

[0084] The feedback optimization module 84 is used to feed back the execution result to the large language model if the execution result does not meet the preset conditions, until the execution result of the structured query language output by the large language model in the database execution engine meets the preset conditions.

[0085] In one example of the present disclosure, the heterogeneous database pre-constructed in the above-mentioned data processing device includes determining the heterogeneous database based on a pre-constructed table metadata vector library and a pre-constructed question-answer pair vector library.

[0086] In one example of the present disclosure, the heterogeneous database pre-constructed in the above-mentioned data processing device specifically includes parsing the original database schema definition language into structured data objects; converting the structured data objects into standardized table metadata according to preset standards; vectorizing the standardized table metadata to determine the table metadata vector library; vectorizing the synthetic question-answer pair data and the historical interactive question-answer pair data to determine the question-answer pair vector library; and determining the heterogeneous database based on the table metadata vector library and the question-answer pair vector library.

[0087] In one example of the present disclosure, the above-mentioned retrieval module is also used to vectorize the query data, and then index it in parallel in the table metadata vector library and the question-answer pair vector library respectively, to determine the tables and question-answer pairs associated with the query data; sort the tables and question-answer pairs, and determine the retrieval result data.

[0088] In one example of the present disclosure, the retrieval result data in the above-mentioned data processing device includes: context knowledge, user query, constraint conditions and logical verification; the above-mentioned structured query language output module is also used to inject natural language descriptions into the context knowledge, user query, constraint conditions and logical verification according to a preset template to determine the prompt words.

[0089] In one example of the present disclosure, the feedback optimization module is further configured to, if the execution result includes an error log, inject the error information in the error log into a natural language description according to a preset template, and determine a prompt word including the error feedback; input the prompt word including the error feedback into a large language model, and the large language model outputs a corrected structured query language based on the prompt word including the error feedback and the preliminary structured query language; input the corrected structured query language into a database execution engine for syntax verification, and output an execution result.

[0090] In an example of the present disclosure, the data processing device further includes a visualization module for outputting a visualization display result in a structured query language based on a visualization library.

[0091] It should be noted that the aforementioned retrieval module 81, structured query language output module 82, syntax checking module 83, and feedback optimization module 84 correspond to steps S202 to S208 in the method embodiment. The examples and application scenarios implemented by these modules and corresponding steps are the same, but are not limited to the contents disclosed in the aforementioned method embodiment. It should be noted that the aforementioned modules, as part of the apparatus, can be executed in a computer system, such as a set of computer-executable instructions.

[0092] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods, or program products. Therefore, various aspects of the present disclosure may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."

[0093] Refer to the following Figure 9 1 and 2 to describe the electronic device 900 according to this embodiment of the present disclosure. Figure 9 The electronic device 900 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0094] like Figure 9 As shown, electronic device 900 is implemented as a general-purpose computing device. Components of electronic device 900 may include, but are not limited to, at least one processing unit 910, at least one storage unit 920, and a bus 930 connecting various system components (including storage unit 920 and processing unit 910).

[0095] The storage unit stores program codes, which can be executed by the processing unit 910, so that the processing unit 910 performs the steps described in the above “Exemplary Method” section of this specification according to various exemplary embodiments of the present disclosure.

[0096] For example, the processing unit 910 can execute the following steps of the above-mentioned method embodiment: obtain query data input by the user, search the query data in parallel in a pre-built heterogeneous database, and determine the search result data; construct prompt words based on the search result data, input the prompt words into a pre-trained large language model, and output a preliminary structured query language; input the preliminary structured query language into the database execution engine for syntax verification, and output the execution result; if the execution result does not meet the preset conditions, feed the execution result back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset conditions.

[0097] For example, the processing unit 910 may execute the following steps of the above method embodiment: determining a heterogeneous database according to a pre-built table metadata vector library and a pre-built question-answer pair vector library.

[0098] For example, the processing unit 910 can execute the following steps of the above-mentioned method embodiment: parsing the original database schema definition language into structured data objects; converting the structured data objects into standardized table metadata according to preset standards; vectorizing the standardized table metadata and determining the table metadata vector library; vectorizing the synthetic question-answer pair data and the historical interactive question-answer pair data to determine the question-answer pair vector library; and determining a heterogeneous database based on the table metadata vector library and the question-answer pair vector library.

[0099] For example, the processing unit 910 can execute the following steps of the above method embodiment: after vectorizing the query data, index it in parallel in the table metadata vector library and the question-answer pair vector library respectively to determine the table and question-answer pairs associated with the query data; sort the table and question-answer pairs to determine the retrieval result data.

[0100] For example, the processing unit 910 may execute the following steps of the above method embodiment: injecting a natural language description into the context knowledge, user query, constraint conditions and logic verification according to a preset template, and determining a prompt word.

[0101] For example, the processing unit 910 can execute the following steps of the above-mentioned method embodiment: if the execution result includes an error log, the error information in the error log is injected into the natural language description according to a preset template, and the prompt words including the error feedback are determined; the prompt words including the error feedback are input into the large language model, and the large language model outputs a corrected structured query language based on the prompt words including the error feedback and the preliminary structured query language; the corrected structured query language is input into the database execution engine for syntax verification, and the execution result is output.

[0102] For example, the processing unit 910 may execute the following steps of the above method embodiment: outputting a visualization display result in a structured query language based on a visualization library.

[0103] The storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 9201 and / or a cache memory unit 9202 , and may further include a read-only memory unit (ROM) 9203 .

[0104] The storage unit 920 may also include a program / utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0105] Bus 930 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0106] The electronic device 900 can also communicate with one or more external devices 940 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 900, and / or any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 950. Furthermore, the electronic device 900 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 via a bus 930. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 900, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0107] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0108] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer program product, which includes: a computer program, which implements the above data processing method when executed by a processor.

[0109] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided. The computer-readable storage medium may be a readable signal medium or a readable storage medium. A program product capable of implementing the above-mentioned method of the present disclosure is stored thereon. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the "Exemplary Methods" section above of this specification.

[0110] More specific examples of computer-readable storage media in the present disclosure may include, but are not limited to, an electrical connection having one or more conductors, 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), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0111] In the present disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0112] Alternatively, the program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0113] In a specific implementation, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, and the like, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a standalone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0114] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0115] Furthermore, although the steps of the method of the present disclosure are described in a particular order in the accompanying drawings, this does not require or imply that the steps must be performed in this particular order, or that all steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0116] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0117] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the appended claims.

Claims

1. A data processing method, characterized in that: include: Obtaining query data input by the user, searching the query data in parallel in a pre-built heterogeneous database, and determining search result data; Constructing prompt words based on the search result data, inputting the prompt words into a pre-trained large language model, and outputting preliminary structured query language; Inputting the preliminary structured query language into a database execution engine for syntax verification and outputting an execution result; If the execution result does not meet the preset condition, the execution result is fed back to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset condition.

2. The data processing method according to claim 1, wherein: The pre-built heterogeneous database includes: The heterogeneous database is determined according to a pre-built table metadata vector library and a pre-built question-answer pair vector library.

3. The data processing method according to claim 2, characterized in that: Determining the heterogeneous database according to the pre-built table metadata vector library and the pre-built question-answer pair vector library includes: Parse the original database schema definition language into structured data objects; According to a preset standard, the structured data object is converted into standardized table metadata; Vectorize the standardized table metadata and determine the table metadata vector library; Vectorize the synthetic question-answer pair data and the historical interactive question-answer pair data to determine the question-answer pair vector library; The heterogeneous database is determined according to the table metadata vector library and the question-answer pair vector library.

4. The data processing method according to claim 2, wherein: The step of searching the query data in parallel in a pre-built heterogeneous database to determine the search result data includes: After vectorizing the query data, indexing the table metadata vector library and the question-answer pair vector library in parallel respectively to determine the table and question-answer pair associated with the query data; The table and the question-answer pairs are sorted to determine search result data.

5. The data processing method according to claim 1, wherein: The search result data includes: context knowledge, user query, constraint conditions and logical verification; The constructing of prompt words according to the search result data includes: In the context knowledge, user query, constraint conditions and logic verification, a natural language description is injected according to a preset template to determine a prompt word.

6. The data processing method according to claim 1, wherein if the execution result does not meet the preset condition, feeding back the execution result to the large language model until the execution result of the structured query language output by the large language model in the database execution engine meets the preset condition comprises: If the execution result includes an error log, inject the error information in the error log into a natural language description according to a preset template, and determine a prompt word including error feedback; Inputting the prompt word including the error feedback into the large language model, and the large language model outputting a revised structured query language based on the prompt word including the error feedback and the preliminary structured query language; The modified structured query language is input into the database execution engine for syntax verification, and the execution result is output.

7. The data processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: Based on the visualization library, output visualization results of structured query language.

8. A data processing device, characterized in that: include: A search module is used to obtain query data input by the user, search the query data in parallel in a pre-built heterogeneous database, and determine the search result data; a structured query language output module, configured to construct prompt words based on the search result data, input the prompt words into a pre-trained large language model, and output preliminary structured query language; A syntax checking module, configured to input the preliminary structured query language into a database execution engine for syntax checking and output an execution result; A feedback optimization module is used to feed back the execution result to the large language model if the execution result does not meet the preset conditions, until the execution result of the structured query language output by the large language model in the database execution engine meets the preset conditions.

9. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the data processing method according to any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 7 is implemented.

11. A computer program product comprising: A computer program or instruction, characterized in that when the computer program or instruction is executed by a processor, it implements the data processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method, system and equipment for generating SQL (Structured Query Language) statement based on large model

    CN119127913A

  • LLM and vector model-based Text2SQL intelligent question and answer query method and system

    CN119149575A

  • System and method for improving reflection ability of NL2SQL model based on SQL grammar check

    CN119988419A

  • Database query training method and device based on RAG and large model

    CN120104635A