CN112506952A - Data inquiry device and data inquiry method - Google Patents
Data inquiry device and data inquiry method Download PDFInfo
- Publication number
- CN112506952A CN112506952A CN202011441967.5A CN202011441967A CN112506952A CN 112506952 A CN112506952 A CN 112506952A CN 202011441967 A CN202011441967 A CN 202011441967A CN 112506952 A CN112506952 A CN 112506952A
- Authority
- CN
- China
- Prior art keywords
- data
- query
- sql script
- data query
- result
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/283—Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/02—Banking, e.g. interest calculation or account maintenance
Abstract
The application provides a data query device, a data query method, motor equipment and a computer readable storage medium, which are applied to the field of data query and retrieval. The application includes: an input query module configured to receive a data query request; the request analysis module analyzes the data query request and extracts a data table and/or field information corresponding to the data to be queried; and the script generation module generates a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information. The data query device disclosed by the application improves the existing data query system. The method can directly convert the text application of data query into the executable SQL script, thereby reducing the workload of compiling the SQL script by manual analysis requirements.
Description
Technical Field
The present application relates to the field of query and retrieval of data, and in particular, to a data query method, a data query device, an electronic device, and a computer-readable storage medium.
Background
Nowadays, with the development of financial business, the daily generated transaction data and derived data volume of banks becomes more and more huge. In order to manage these data, the financial institution may establish its own database, and when some data information in the database needs to be queried, first analyze the corresponding database field name of the specifically needed data, then search the database fields that need to be extracted, which database tables exist, and if multiple database tables are involved, find out the primary key and condition needed to associate these database tables. Finally, an SQL script is written and a query is executed on the database.
Disclosure of Invention
The application provides a data query method and a data query device, which use NLP2SQL technology and aim to improve the existing data query system. According to the data query method disclosed by the application, the text application of data query can be directly converted into the executable SQL script, so that the workload of compiling the SQL script by manual analysis requirements is reduced. The technical scheme adopted by the application is as follows:
in a first aspect, a data query apparatus is provided, which includes:
an input query module configured to receive a data query request;
the request analysis module analyzes the data query request and extracts a data table and/or field information corresponding to the data to be queried; and
and the script generation module generates a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query apparatus further includes a script correction module, where the script correction module verifies the generated SQL script statement against the data table and/or the field information, and corrects the SQL script statement if the SQL script statement does not correspond to the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query apparatus further includes a model training module, wherein the model training module trains the long-term and short-term memory model according to a result of the script correction module correcting the SQL script statement.
Optionally, in some embodiments of the present application, the data query apparatus further includes a result output module, wherein the result output module includes a data result generation unit and a data result output unit, wherein,
the data result generating unit generates corresponding query result data according to the SQL script statement, and
the data result output unit includes a prediction model, wherein the prediction model scores the query result data and outputs the query result data having a score higher than a predetermined threshold.
In another aspect, a data query method is provided, which includes the following steps:
receiving a data query request;
analyzing the data query request, and extracting a data table and/or field information corresponding to the data to be queried; and
and generating a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query method further includes the following steps:
and checking the generated SQL script statement and the data table and/or the field information, and correcting the SQL script statement under the condition that the SQL script statement does not correspond to the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query method further includes the following steps:
and training the long-term and short-term memory model for the correction result of the SQL script statement.
Optionally, in some embodiments of the present application, the data query method further includes the following steps:
and generating corresponding query result data according to the SQL script statement, grading the query result data, and outputting the query result data with the grade higher than a predetermined threshold value.
In a third aspect, an electronic device is provided, including:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: a method of querying data according to any embodiment of the present application is performed.
In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used for storing computer instructions, which when run on a computer, make the computer execute the data query method according to any embodiment of the present application.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic structural diagram of a data query device according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating steps of a data query method according to an embodiment of the present application; and
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the present application provides a data query device 10, which includes:
an input query module 1, wherein the input query module 1 is configured to receive a data query request;
specifically, the input query module 1 receives a query request for data and serves as an input of the data query device 10. For example, it may be configured as a user interactive interface for receiving different data query requests.
The request analysis module 2 analyzes the data query request, and extracts a data table and/or field information corresponding to the data to be queried;
specifically, a data dictionary is established by using the Chinese information corresponding to the data warehouse table, then word segmentation processing is carried out on the text content of the data query request, Chinese words corresponding to the required data table and fields are extracted, and the table name and the field name required by the requirement are associated.
And
and the script generation module 3 generates a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query apparatus 10 further includes a script correction module 4, wherein the script correction module 4 checks the generated SQL script statement against the data table and/or the field information, and corrects the SQL script statement if the SQL script statement does not correspond to the data table and/or the field information.
That is, for example, the SQL script generated by the system and the related table and field information may be presented to the data operator, and the data operator may modify the SQL script according to the actual situation and store it locally.
Optionally, in some embodiments of the present application, the data query apparatus 10 further includes a model training module 5, wherein the model training module 5 trains the long-short term memory model according to the result of the script correction module correcting the SQL script statement. That is, the modified SQL script can be used to update and train the above-mentioned long-short term memory model.
Optionally, in some embodiments of the present application, the data query apparatus 10 further includes a result output module 6, wherein the result output module 6 includes a data result generation unit and a data result output unit, wherein,
the data result generating unit generates corresponding query result data according to the SQL script statement, and
the data result output unit includes a prediction model, wherein the prediction model scores the query result data and outputs the query result data having a score higher than a predetermined threshold.
In particular, where the apparatus disclosed herein generates a variety of query result data, the user is presented with data (and possibly more) having a score above a predetermined threshold after scoring according to the predictive model. Similarly, the user can score the result on the human-computer interface by himself, so that the execution accuracy and the prediction accuracy can be continuously improved.
An embodiment of the present application provides a data query method, as shown in fig. 2, the method may include the following steps:
step S101: receiving a data query request;
specifically, a query request for data is received and serves as an input to the data query device 10. For example, it may be configured as a user interactive interface for receiving different data query requests.
Step S102, analyzing the data query request, and extracting a data table and/or field information corresponding to the data to be queried;
specifically, a data dictionary is established by using the Chinese information corresponding to the data warehouse table, then word segmentation processing is carried out on the text content of the data query request, Chinese words corresponding to the required data table and fields are extracted, and the table name and the field name required by the requirement are associated.
And
and S103, generating a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
Optionally, in some embodiments of the present application, the data query method further includes the following steps: step S104: and checking the generated SQL script statement and the data table and/or the field information, and correcting the SQL script statement under the condition that the SQL script statement does not correspond to the data table and/or the field information.
That is, for example, the SQL script and the related table and field information may be displayed to the data operator, and the data operator may modify the SQL script according to the actual situation and store the modified SQL script locally.
Optionally, in some embodiments of the present application, the data query method further includes the following steps: step S105: and training the long-term and short-term memory model according to the correction result of the script correction module on the SQL script statement. That is, the modified SQL script can be used to update and train the above-mentioned long-short term memory model.
Optionally, in some embodiments of the present application, the data query method further includes step S106 of generating corresponding query result data according to the SQL script statement, scoring the query result data by using a prediction model, and outputting the query result data with a score higher than a predetermined threshold.
In particular, where multiple types of query result data are generated, the data (and possibly more) that score above a predetermined threshold are presented to the user after scoring according to the predictive model. And also, the user can score the result on the human-computer interface by himself so as to continuously improve the execution accuracy and the prediction accuracy.
An embodiment of the present application provides an electronic device, as shown in fig. 3, an electronic device 40 shown in fig. 3 includes: a processor 401 and a memory 403. Wherein the processor 401 is coupled to the memory 403, such as via a bus 402. Further, the electronic device 40 may also include a transceiver 404. It should be noted that the transceiver 404 is not limited to one in practical applications, and the structure of the electronic device 40 is not limited to the embodiment of the present application. The processor 401 is applied to the embodiment of the present application, and is used to implement the functions of the modules shown in fig. 1. The transceiver 404 includes a receiver and/or a transmitter.
The processor 401 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 401 may also be a combination of computing functions, e.g., comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
The memory 403 may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 403 is used for storing application program codes for executing the scheme of the application, and the execution is controlled by the processor 401. The processor 401 is configured to execute application program codes stored in the memory 403 to realize the functions of the data query device 10 provided by the embodiment shown in fig. 1.
The present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the method shown in the above embodiments is implemented.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations should also be regarded as the protection scope of the present application.
Claims (10)
1. A data query apparatus, comprising:
an input query module configured to receive a data query request;
the request analysis module analyzes the data query request and extracts a data table and/or field information corresponding to the data to be queried; and
and the script generation module generates a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
2. The data query device according to claim 1, further comprising a script correction module, wherein the script correction module checks the generated SQL script statement against the data table and/or field information, and corrects the SQL script statement if the SQL script statement does not correspond to the data table and/or field information.
3. The data query device according to claim 2, further comprising a model training module, wherein the model training module trains the long-short term memory model according to a result of the script correction module correcting the SQL script statement.
4. The data query device of claim 3, further comprising a result output module, wherein the result output module comprises a data result generation unit and a data result output unit, wherein,
the data result generating unit generates corresponding query result data according to the SQL script statement, and
the data result output unit includes a prediction model, wherein the prediction model scores the query result data and outputs the query result data having a score higher than a predetermined threshold.
5. A data query method, comprising the steps of:
receiving a data query request;
analyzing the data query request, and extracting a data table and/or field information corresponding to the data to be queried; and
and generating a corresponding SQL script statement through a long-term and short-term memory model based on the data table and/or the field information.
6. The data query method of claim 5, further comprising the steps of:
and checking the generated SQL script statement and the data table and/or the field information, and correcting the SQL script statement under the condition that the SQL script statement does not correspond to the data table and/or the field information.
7. The data query method of claim 6, further comprising the steps of:
and training the long-term and short-term memory model for the correction result of the SQL script statement.
8. The data query method of claim 7, further comprising the steps of:
and generating corresponding query result data according to the SQL script statement, grading the query result data, and outputting the query result data with the grade higher than a predetermined threshold value.
9. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: performing the data query method of any one of claims 5 to 8.
10. A computer-readable storage medium for storing computer instructions which, when executed on a computer, cause the computer to perform the data query method of any one of claims 5 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011441967.5A CN112506952A (en) | 2020-12-11 | 2020-12-11 | Data inquiry device and data inquiry method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011441967.5A CN112506952A (en) | 2020-12-11 | 2020-12-11 | Data inquiry device and data inquiry method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112506952A true CN112506952A (en) | 2021-03-16 |
Family
ID=74970900
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011441967.5A Pending CN112506952A (en) | 2020-12-11 | 2020-12-11 | Data inquiry device and data inquiry method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112506952A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113362177A (en) * | 2021-06-30 | 2021-09-07 | 中国农业银行股份有限公司 | Transaction data backtracking method and device |
-
2020
- 2020-12-11 CN CN202011441967.5A patent/CN112506952A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113362177A (en) * | 2021-06-30 | 2021-09-07 | 中国农业银行股份有限公司 | Transaction data backtracking method and device |
CN113362177B (en) * | 2021-06-30 | 2024-03-19 | 中国农业银行股份有限公司 | Transaction data backtracking method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102237702B1 (en) | Entity relationship data generating method, apparatus, equipment and storage medium | |
US11409813B2 (en) | Method and apparatus for mining general tag, server, and medium | |
US20180276525A1 (en) | Method and neural network system for human-computer interaction, and user equipment | |
US8452772B1 (en) | Methods, systems, and articles of manufacture for addressing popular topics in a socials sphere | |
US10824816B2 (en) | Semantic parsing method and apparatus | |
CN111046656B (en) | Text processing method, text processing device, electronic equipment and readable storage medium | |
CN105183720A (en) | Machine translation method and apparatus based on RNN model | |
CN110597844B (en) | Unified access method for heterogeneous database data and related equipment | |
US20130110500A1 (en) | Method, system, and appartus for selecting an acronym expansion | |
US20220405484A1 (en) | Methods for Reinforcement Document Transformer for Multimodal Conversations and Devices Thereof | |
CN111459977B (en) | Conversion of natural language queries | |
CN110795541B (en) | Text query method, text query device, electronic equipment and computer readable storage medium | |
CN108536728A (en) | A kind of data query method and apparatus | |
US20200012650A1 (en) | Method and apparatus for determining response for user input data, and medium | |
CN115827819A (en) | Intelligent question and answer processing method and device, electronic equipment and storage medium | |
CN112686053A (en) | Data enhancement method and device, computer equipment and storage medium | |
CN115392235A (en) | Character matching method and device, electronic equipment and readable storage medium | |
US20120030201A1 (en) | Querying documents using search terms | |
CN113569559B (en) | Short text entity emotion analysis method, system, electronic equipment and storage medium | |
CN112506952A (en) | Data inquiry device and data inquiry method | |
CN116186219A (en) | Man-machine dialogue interaction method, system and storage medium | |
WO2019148797A1 (en) | Natural language processing method, device, computer apparatus, and storage medium | |
CN114238689A (en) | Video generation method, video generation device, electronic device, storage medium, and program product | |
CN113468258A (en) | Heterogeneous data conversion method and device and storage medium | |
CN114020774A (en) | Method, device and equipment for processing multiple rounds of question-answering sentences and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |