CN117009319B - Database operation method, system and storage medium based on large language model - Google Patents
Database operation method, system and storage medium based on large language model Download PDFInfo
- Publication number
- CN117009319B CN117009319B CN202310988665.7A CN202310988665A CN117009319B CN 117009319 B CN117009319 B CN 117009319B CN 202310988665 A CN202310988665 A CN 202310988665A CN 117009319 B CN117009319 B CN 117009319B
- Authority
- CN
- China
- Prior art keywords
- verification
- database
- language model
- authority
- hash
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 238000012795 verification Methods 0.000 claims description 129
- 238000004458 analytical method Methods 0.000 claims description 22
- 238000011017 operating method Methods 0.000 claims description 5
- 238000012217 deletion Methods 0.000 claims description 3
- 230000037430 deletion Effects 0.000 claims description 3
- 238000013461 design Methods 0.000 description 6
- 238000010276 construction Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 210000001503 joint Anatomy 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
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/21—Design, administration or maintenance of databases
-
- 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/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- 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
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/436—Semantic checking
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Storage Device Security (AREA)
Abstract
The invention belongs to the technical field of database management, and particularly discloses a database operation method, a system and a storage medium based on a large language model. The invention can realize double authority management, effectively ensure the safety and reliability of database operation, improve the convenience and diversity of database operation and improve the efficiency of database operation.
Description
Technical Field
The invention belongs to the technical field of database management, and particularly relates to a database operation method, a database operation system and a database storage medium based on a large language model.
Background
Databases are warehouses that organize, store, and manage data according to a data structure, and are divided into relational databases and non-relational databases. The format of the relational database storage can intuitively reflect the relation among entities, most of the relational database storage complies with the SQL (structured query language ) standard, and the relational database adopts the structured query language (namely SQL) to perform CRUD (data writing, data reading, data updating and data deleting) operation on the database, namely the operation of the relational database is realized by virtue of written SQL sentences. The existing relational database operation mode by writing operation sentences has low operation efficiency, poor operation convenience and diversity, and insufficient operation safety and reliability due to the lack of an effective operation supervision mechanism.
Disclosure of Invention
The object of the present invention is to provide a method, a system and a storage medium for database operation based on a large language model, which are used for solving the above problems in the prior art.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
in a first aspect, a method for operating a database based on a large language model is provided, including:
acquiring an operation management data set for a target relational database, wherein the operation management data set comprises an operation verification encryption packet and an operation information encryption packet;
decrypting the operation verification encryption packet and the operation information encryption packet respectively to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text;
performing hash operation on the authority check data to obtain hash check codes, substituting the hash check codes into a preset authority table for search matching, and judging that the authority check passes when the same hash check codes are matched in the authority table;
when judging that the authority verification passes, substituting the operation number into an authority table, and determining the authority operation type associated with the operation number under the corresponding hash verification code, wherein the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding authority operation type;
performing semantic analysis on the operation content text based on the large language model, and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks;
performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords passing the verification as tasks to be executed;
compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating database operation sentences, importing the database operation sentences into a target relational database, and enabling the target relational database to execute the database operation sentences to perform corresponding database operations.
In one possible design, the type of authority operation includes any combination of a read operation, a write operation, an update operation, and a delete operation, and the type of operation key includes a read operation key, a write operation key, an update operation key, or a delete operation key.
In one possible design, when the operation type keyword includes a read operation keyword, the corresponding operation task includes a table name, a field name and a primary key; when the operation type keyword comprises a writing operation keyword, the corresponding operation task comprises a table name, a field name, a main key and a writing parameter, and when the operation type keyword comprises an updating operation keyword, the corresponding operation task comprises a table name, a field name, a main key and an updating parameter; when the operation type keyword comprises a deletion operation keyword, the corresponding operation task comprises a table name, a field name and a main key.
In one possible design, when the operation type keyword includes a read operation keyword, the read operation keyword and a database operation sentence generated after compiling a corresponding task to be executed are SELECT sentences; when the operation type keyword comprises a writing operation keyword, the writing operation keyword and a database operation sentence generated after compiling a corresponding task to be executed are INSERT sentences; when the operation type keywords comprise UPDATE operation keywords, the UPDATE operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are UPDATE sentences; when the operation type keywords comprise deleting operation keywords, the deleting operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are DELETE sentences.
In one possible design, the decrypting the operation verification encryption packet and the operation information encryption packet includes:
invoking a pre-stored private key to asymmetrically decrypt the operation verification encryption packet to obtain verification data;
and calling a pre-stored private key to asymmetrically decrypt the operation information encryption packet to obtain the operation information.
In one possible design, the performing a hash operation on the rights verification data to obtain a hash check code includes:
and carrying out hash operation on the right check data by adopting an MD5 information abstract algorithm to obtain a corresponding hash value as a hash check code.
In one possible design, when semantic analysis is performed on the operation content text based on the large language model, the large language model of the third party platform is called through the large language model API to perform semantic analysis on the operation content text, so that operation content output by the large language model of the third party platform is obtained; when compiling the tasks to be executed and the operation type keywords corresponding to the tasks to be executed based on the large language model, the large language model API calls the large language model of the third party platform to compile the tasks to be executed and the operation type keywords corresponding to the tasks to be executed, and database operation sentences output by the large language model of the third party platform are obtained.
In a second aspect, a database operating system based on a large language model is provided, which comprises an acquisition unit, a decryption unit, a verification unit, a matching unit, an analysis unit, a verification unit and an execution unit, wherein:
an acquisition unit configured to acquire an operation management data set for a target relational database, the operation management data set including an operation verification encryption packet and an operation information encryption packet;
the decryption unit is used for respectively decrypting the operation verification encryption packet and the operation information encryption packet to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text;
the verification unit is used for carrying out hash operation on the permission verification data to obtain hash verification codes, substituting the hash verification codes into a preset permission table for search matching, and judging that the permission verification is passed when the same hash verification codes are matched in the permission table;
the matching unit is used for substituting the operation number into the authority table when judging that the authority verification passes, and determining the authority operation type associated with the operation number under the corresponding hash verification code, wherein the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding authority operation type;
the analysis unit is used for carrying out semantic analysis on the operation content text based on the large language model and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks;
the verification unit is used for performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords passing the verification as tasks to be executed;
the execution unit is used for compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating a database operation statement, importing the database operation statement into the target relational database, and enabling the target relational database to execute the database operation statement to perform corresponding database operation.
In a third aspect, a large language model based database operating system is provided, comprising:
a memory for storing instructions;
and a processor for reading the instructions stored in the memory and executing the method according to any one of the above first aspects according to the instructions.
In a fourth aspect, a computer readable storage medium is provided, wherein instructions are stored on the computer readable storage medium, which when run on a computer, cause the computer to perform the method of any one of the first aspects.
The beneficial effects are that: the invention obtains the verification data and the operation information by decrypting the operation management data set, performs authority verification by using the verification data, determines the authority operation type, performs semantic analysis based on a large language model by using the operation information, determines the operation type keyword and the operation task, performs operation type verification on the operation type keyword by using the authority operation type, compiles the task to be executed and the operation type keyword corresponding to the task to be executed based on the large language model after verification, generates a database operation sentence, and finally guides the database operation sentence into a target relational database, so that the target relational database executes the database operation sentence to complete corresponding database operation, thereby realizing high-efficiency and intelligent database operation management. The invention can realize double authority management through corresponding database operation authority verification and operation type verification, effectively ensure the safety and reliability of database operation, and replace the traditional operation sentence construction method through operation semantic analysis and operation sentence compilation based on a large language model, thereby improving the convenience and diversity of database operation and improving the efficiency of database operation.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram showing the steps of the method of example 1 of the present invention;
FIG. 2 is a schematic diagram showing the construction of a system in embodiment 2 of the present invention;
FIG. 3 is a schematic diagram showing the construction of a system in embodiment 3 of the present invention.
Detailed Description
It should be noted that the description of these examples is for aiding in understanding the present invention, but is not intended to limit the present invention. Specific structural and functional details disclosed herein are merely representative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
It will be appreciated that the term "coupled" is to be interpreted broadly, and may be a fixed connection, a removable connection, or an integral connection, for example, unless explicitly stated and limited otherwise; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the terms in the embodiments can be understood by those of ordinary skill in the art according to the specific circumstances.
In the following description, specific details are provided to provide a thorough understanding of example embodiments. However, it will be understood by those of ordinary skill in the art that the example embodiments may be practiced without these specific details. For example, a system may be shown in block diagrams in order to avoid obscuring the examples with unnecessary detail. In other embodiments, well-known processes, structures, and techniques may be shown without unnecessary detail in order to avoid obscuring the embodiments.
Example 1:
the present embodiment provides a database operation method based on a large language model, which can be applied to a corresponding database server, as shown in fig. 1, and the method includes the following steps:
s1, acquiring an operation management data set for a target relational database, wherein the operation management data set comprises an operation verification encryption packet and an operation information encryption packet.
In the specific implementation, the database manager can edit the verification data and the operation information at the corresponding management terminal according to the actual database operation, then the verification data and the operation information are respectively and asymmetrically encrypted by using the configured encryption public key to obtain an operation verification encryption packet and an operation information encryption packet, the operation verification encryption packet and the operation information encryption packet are utilized to form an operation management data set, the operation management data set is transmitted to the database server, and the transmission safety of the verification data and the operation information can be fully ensured through the asymmetric encryption data transmission, so that interception and tampering of the verification data and the operation information are prevented.
S2, decrypting the operation verification encryption packet and the operation information encryption packet respectively to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text.
In the implementation, after the database server acquires the operation management data set, a prestored private key is called to perform asymmetric decryption on the operation verification encryption packet to obtain verification data, and meanwhile, the private key is used to perform asymmetric decryption on the operation information encryption packet to obtain operation information. The verification data comprise operation numbers and authority verification data, the operation information comprises operation content texts which can be edited by database management personnel, the editing mode can be text input or voice text conversion after voice input, and the operation information can be selected according to actual requirements.
S3, carrying out hash operation on the permission check data to obtain hash check codes, substituting the hash check codes into a preset permission table for search matching, and judging that the permission check passes when the same hash check codes are matched in the permission table.
In specific implementation, the database server can adopt the MD5 information abstract algorithm to carry out hash operation on the authority check data to obtain a corresponding hash value as a hash check code, then substitutes the hash check code into a preset authority table to carry out search matching, judges that the authority check is passed when the same hash check code is matched in the authority table, and judges that the authority check is failed if the same hash check code is not matched in the authority table, then the authority check data is problematic.
S4, substituting the operation number into a permission table when the permission verification is judged to pass, and determining the permission operation type associated with the operation number under the corresponding hash verification code, wherein the permission table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding permission operation type.
When the authority verification is passed, the database server substitutes the operation number into the authority table to determine the authority operation type associated with the operation number under the corresponding hash verification code, the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, each operation number is associated with the corresponding authority operation type, and the authority operation type comprises any combination of reading operation, writing operation, updating operation and deleting operation. Illustratively, the rights table is shown in Table one below
List one
In the permission table, if the matched hash check code is 11111111 and the operation number is D, the corresponding permission operation type is a delete operation, if the matched hash check code is 22222222 and the operation number is e, the corresponding permission operation type is a combination operation 1, the combination operation 1 is a combination of a read operation, a write operation and an update operation, and so on. The corresponding combination operation in the table may also be set according to the actual requirement, for example, the combination operation N may be a read operation, a write operation, an update operation, and a delete operation.
S5, carrying out semantic analysis on the operation content text based on the large language model, and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks.
In specific implementation, the database server can perform semantic analysis on the operation content text based on a large language model, and extract corresponding operation content, and illustratively, the operation content text can be input by adopting a locally stored large language model subjected to deep learning training to perform semantic analysis, so as to obtain the operation content, or the operation content text can be subjected to semantic analysis by calling a large language model of a third party platform through a large language model API, so as to obtain the operation content output by the large language model of the third party platform, and the large language model can adopt large language models such as PaLM 2, chatGPT, BLOOM, MT-NLG and the like, so that the operation content can be selected according to actual requirements.
The operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks, wherein the operation type keywords comprise reading operation keywords (such as reading, inquiring and the like), writing operation keywords (such as writing, inserting and the like), updating operation keywords (such as updating, modifying and the like) or deleting operation keywords (such as deleting, clearing and the like). When the operation type keywords comprise reading operation keywords, the corresponding operation tasks comprise table names, field names and primary keys; when the operation type keyword comprises a writing operation keyword, the corresponding operation task comprises a table name, a field name, a main key and a writing parameter, and when the operation type keyword comprises an updating operation keyword, the corresponding operation task comprises a table name, a field name, a main key and an updating parameter; when the operation type keyword comprises a deletion operation keyword, the corresponding operation task comprises a table name, a field name and a main key. Through the text editing and large language model semantic recognition modes, convenience and diversity of database operation can be effectively improved, and efficiency of database operation is improved.
S6, performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords which pass verification as tasks to be executed.
In specific implementation, the database server performs operation type verification on each operation type keyword by using the authority operation type, if the operation type keyword is consistent with the association of the authority operation type, the operation type verification is passed, otherwise, the operation type verification is not passed, for example, the operation type keyword is "delete", the authority operation type is combined operation 1, and the combined operation 1 only comprises a combination of a read operation, a write operation and an update operation, and does not comprise a delete operation, so the operation type verification is passed, and the like. And taking the operation task corresponding to each operation type keyword which passes verification as a task to be executed.
S7, compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating a database operation statement, importing the database operation statement into a target relational database, and enabling the target relational database to execute the database operation statement to perform corresponding database operation.
In specific implementation, the database server may compile the task to be executed and the operation type keyword corresponding to the task to be executed based on the large language model to obtain a corresponding database operation sentence, for example, a locally stored large language model subjected to deep learning training may be adopted to input the task to be executed and the operation type keyword corresponding to the task to be executed to obtain a corresponding database operation sentence, or a large language model of a third party platform may be called through an API of the large language model to compile the input task to be executed and the operation type keyword corresponding to the task to be executed to obtain a corresponding database operation sentence output by the large language model of the third party platform, and the large language model may adopt large language models such as PaLM 2, chatGPT, BLOOM, MT-NLG and the like, and may be selected according to actual requirements.
When the operation type keywords comprise reading operation keywords, the operation type keywords and database operation sentences generated after compiling corresponding tasks to be executed are SELECT sentences; when the operation type keyword comprises a writing operation keyword, the writing operation keyword and a database operation sentence generated after compiling a corresponding task to be executed are INSERT sentences; when the operation type keywords comprise UPDATE operation keywords, the UPDATE operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are UPDATE sentences; when the operation type keywords comprise deleting operation keywords, the deleting operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are DELETE sentences. After obtaining the corresponding database operation statement, the database server imports the corresponding database operation statement into the target relational database, so that the target relational database executes the database operation statement to perform the corresponding database operation, such as reading and deleting the parameters corresponding to a certain field in a certain table in the database, or inserting and updating the parameters of the corresponding primary key of a certain field in a certain table in the database, and the like.
The method can realize double authority management through corresponding verification of database operation authority and operation type verification, effectively ensure the safety and reliability of database operation, replace the traditional operation sentence construction method through operation semantic analysis and operation sentence compilation based on a large language model, improve the convenience and diversity of database operation and improve the efficiency of database operation.
Example 2:
the embodiment provides a database operating system based on a large language model, as shown in fig. 2, which comprises an acquisition unit, a decryption unit, a verification unit, a matching unit, an analysis unit, a verification unit and an execution unit, wherein:
an acquisition unit configured to acquire an operation management data set for a target relational database, the operation management data set including an operation verification encryption packet and an operation information encryption packet;
the decryption unit is used for respectively decrypting the operation verification encryption packet and the operation information encryption packet to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text;
the verification unit is used for carrying out hash operation on the permission verification data to obtain hash verification codes, substituting the hash verification codes into a preset permission table for search matching, and judging that the permission verification is passed when the same hash verification codes are matched in the permission table;
the matching unit is used for substituting the operation number into the authority table when judging that the authority verification passes, and determining the authority operation type associated with the operation number under the corresponding hash verification code, wherein the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding authority operation type;
the analysis unit is used for carrying out semantic analysis on the operation content text based on the large language model and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks;
the verification unit is used for performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords passing the verification as tasks to be executed;
the execution unit is used for compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating a database operation statement, importing the database operation statement into the target relational database, and enabling the target relational database to execute the database operation statement to perform corresponding database operation.
Example 3:
the present embodiment provides a database operating system based on a large language model, as shown in fig. 3, including, at a hardware level:
the data interface is used for establishing data butt joint between the processor and the corresponding management terminal and the target relational database;
a memory for storing instructions;
and a processor for reading the instructions stored in the memory and executing the database operating method based on the large language model in embodiment 1 according to the instructions.
Optionally, the device further comprises an internal bus. The processor and memory and data interfaces may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or an EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc.
The Memory may include, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), flash Memory (Flash Memory), first-in first-out Memory (First Input First Output, FIFO), and/or first-in last-out Memory (First In Last Out, FILO), etc. The processor may be a general-purpose processor including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Example 4:
the present embodiment provides a computer-readable storage medium having instructions stored thereon, which when executed on a computer, cause the computer to perform the large language model-based database operating method of embodiment 1. The computer readable storage medium refers to a carrier for storing data, and may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash Memory, and/or a Memory Stick (Memory Stick), etc., where the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable system.
The present embodiment also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of database operations in embodiment 1 based on a large language model. Wherein the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable system.
Finally, it should be noted that: the foregoing description is only of the preferred embodiments of the invention and is not intended to limit the scope of the invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method of database operation based on a large language model, comprising:
acquiring an operation management data set for a target relational database, wherein the operation management data set comprises an operation verification encryption packet and an operation information encryption packet;
decrypting the operation verification encryption packet and the operation information encryption packet respectively to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text;
performing hash operation on the authority check data to obtain hash check codes, substituting the hash check codes into a preset authority table for search matching, and judging that the authority check passes when the same hash check codes are matched in the authority table;
when judging that the authority verification passes, substituting the operation number into an authority table, and determining the authority operation type associated with the operation number under the corresponding hash verification code, wherein the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding authority operation type;
performing semantic analysis on the operation content text based on the large language model, and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks;
performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords passing the verification as tasks to be executed;
compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating database operation sentences, importing the database operation sentences into a target relational database, and enabling the target relational database to execute the database operation sentences to perform corresponding database operations.
2. The large language model based database operation method according to claim 1, wherein the authority operation type includes any combination of a read operation, a write operation, an update operation, and a delete operation, and the operation type keyword includes a read operation keyword, a write operation keyword, an update operation keyword, or a delete operation keyword.
3. The large language model based database operating method according to claim 2, wherein when the operation type keyword includes a read operation keyword, its corresponding operation task includes a table name, a field name and a primary key; when the operation type keyword comprises a writing operation keyword, the corresponding operation task comprises a table name, a field name, a main key and a writing parameter, and when the operation type keyword comprises an updating operation keyword, the corresponding operation task comprises a table name, a field name, a main key and an updating parameter; when the operation type keyword comprises a deletion operation keyword, the corresponding operation task comprises a table name, a field name and a main key.
4. The large language model based database operation method according to claim 2, wherein when the operation type keyword includes a read operation keyword, the read operation keyword and a database operation sentence generated after compiling a corresponding task to be executed are SELECT sentences; when the operation type keyword comprises a writing operation keyword, the writing operation keyword and a database operation sentence generated after compiling a corresponding task to be executed are INSERT sentences; when the operation type keywords comprise UPDATE operation keywords, the UPDATE operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are UPDATE sentences; when the operation type keywords comprise deleting operation keywords, the deleting operation keywords and database operation sentences generated after compiling corresponding tasks to be executed are DELETE sentences.
5. The large language model based database operation method according to claim 1, wherein the decrypting the operation verification encryption packet and the operation information encryption packet, respectively, comprises:
invoking a pre-stored private key to asymmetrically decrypt the operation verification encryption packet to obtain verification data;
and calling a pre-stored private key to asymmetrically decrypt the operation information encryption packet to obtain the operation information.
6. The method for operating a database based on a large language model according to claim 1, wherein the performing a hash operation on the rights verification data to obtain a hash check code includes:
and carrying out hash operation on the right check data by adopting an MD5 information abstract algorithm to obtain a corresponding hash value as a hash check code.
7. The database operation method based on the large language model according to claim 1, wherein when the operation content text is subjected to semantic analysis based on the large language model, the large language model of the third party platform is called through the large language model API to carry out semantic analysis on the operation content text, so as to obtain the operation content output by the large language model of the third party platform; when compiling the tasks to be executed and the operation type keywords corresponding to the tasks to be executed based on the large language model, the large language model API calls the large language model of the third party platform to compile the tasks to be executed and the operation type keywords corresponding to the tasks to be executed, and database operation sentences output by the large language model of the third party platform are obtained.
8. The database operating system based on the large language model is characterized by comprising an acquisition unit, a decryption unit, a verification unit, a matching unit, an analysis unit, a verification unit and an execution unit, wherein:
an acquisition unit configured to acquire an operation management data set for a target relational database, the operation management data set including an operation verification encryption packet and an operation information encryption packet;
the decryption unit is used for respectively decrypting the operation verification encryption packet and the operation information encryption packet to obtain verification data and operation information, wherein the verification data comprises an operation number and authority verification data, and the operation information comprises an operation content text;
the verification unit is used for carrying out hash operation on the permission verification data to obtain hash verification codes, substituting the hash verification codes into a preset permission table for search matching, and judging that the permission verification is passed when the same hash verification codes are matched in the permission table;
the matching unit is used for substituting the operation number into the authority table when judging that the authority verification passes, and determining the authority operation type associated with the operation number under the corresponding hash verification code, wherein the authority table comprises a plurality of hash verification codes, each hash verification code is associated with a plurality of operation numbers, and each operation number is associated with the corresponding authority operation type;
the analysis unit is used for carrying out semantic analysis on the operation content text based on the large language model and extracting corresponding operation content, wherein the operation content comprises a plurality of operation tasks and operation type keywords corresponding to the operation tasks;
the verification unit is used for performing operation type verification on the operation type keywords according to the authority operation types, and taking the operation tasks corresponding to the operation type keywords passing the verification as tasks to be executed;
the execution unit is used for compiling the task to be executed and the operation type keywords corresponding to the task to be executed based on the large language model, generating a database operation statement, importing the database operation statement into the target relational database, and enabling the target relational database to execute the database operation statement to perform corresponding database operation.
9. A large language model based database operating system comprising:
a memory for storing instructions;
a processor for reading the instructions stored in the memory and executing the large language model based database operating method according to any one of claims 1 to 7 according to the instructions.
10. A computer readable storage medium having instructions stored thereon which, when executed on a computer, cause the computer to perform the large language model based database operating method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310988665.7A CN117009319B (en) | 2023-08-07 | 2023-08-07 | Database operation method, system and storage medium based on large language model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310988665.7A CN117009319B (en) | 2023-08-07 | 2023-08-07 | Database operation method, system and storage medium based on large language model |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117009319A CN117009319A (en) | 2023-11-07 |
CN117009319B true CN117009319B (en) | 2024-01-26 |
Family
ID=88563222
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310988665.7A Active CN117009319B (en) | 2023-08-07 | 2023-08-07 | Database operation method, system and storage medium based on large language model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117009319B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110858249A (en) * | 2018-08-24 | 2020-03-03 | 中移(杭州)信息技术有限公司 | Database file encryption method, database file decryption method and related devices |
WO2022052639A1 (en) * | 2020-09-10 | 2022-03-17 | 北京达佳互联信息技术有限公司 | Data query method and apparatus |
CN114238273A (en) * | 2021-12-15 | 2022-03-25 | 平安科技(深圳)有限公司 | Database management method, device, equipment and storage medium |
CN114677373A (en) * | 2022-05-27 | 2022-06-28 | 广州青莲网络科技有限公司 | Printed matter content error detection method and device, electronic equipment and medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10505729B2 (en) * | 2016-11-09 | 2019-12-10 | Sap Se | Secure database featuring separate operating system user |
-
2023
- 2023-08-07 CN CN202310988665.7A patent/CN117009319B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110858249A (en) * | 2018-08-24 | 2020-03-03 | 中移(杭州)信息技术有限公司 | Database file encryption method, database file decryption method and related devices |
WO2022052639A1 (en) * | 2020-09-10 | 2022-03-17 | 北京达佳互联信息技术有限公司 | Data query method and apparatus |
CN114238273A (en) * | 2021-12-15 | 2022-03-25 | 平安科技(深圳)有限公司 | Database management method, device, equipment and storage medium |
CN114677373A (en) * | 2022-05-27 | 2022-06-28 | 广州青莲网络科技有限公司 | Printed matter content error detection method and device, electronic equipment and medium |
Non-Patent Citations (2)
Title |
---|
HealthBlock: A secure blockchain-based healthcare data management system;Bessem Zaabar 等;《Computer Networks》;1-16 * |
加密数据库关键词快速检索方法研究;项军政;咸鹤群;田程亮;李敏;;信息网络安全(10);34-39 * |
Also Published As
Publication number | Publication date |
---|---|
CN117009319A (en) | 2023-11-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8630841B2 (en) | Regular expression word verification | |
Guerrouj et al. | Tidier: an identifier splitting approach using speech recognition techniques | |
JP2022538861A (en) | Pinning Artifacts for Expanding Search Keys and Search Spaces in Natural Language Understanding (NLU) Frameworks | |
US9965472B2 (en) | Content revision using question and answer generation | |
WO2022052639A1 (en) | Data query method and apparatus | |
CN108090351B (en) | Method and apparatus for processing request message | |
CN110276071B (en) | Text matching method and device, computer equipment and storage medium | |
KR20220028038A (en) | Derivation of multiple semantic expressions for utterances in a natural language understanding framework | |
US20230035121A1 (en) | Automatic event graph construction method and device for multi-source vulnerability information | |
CN110688151B (en) | Safety translation and analysis method for Ether house identity intelligent contract | |
CN110909229A (en) | Webpage data acquisition and storage system based on simulated browser access | |
CN112559709A (en) | Knowledge graph-based question and answer method, device, terminal and storage medium | |
CA2809021C (en) | Systems and methods for lexicon generation | |
CN112580363A (en) | Requirement document processing method and device, computer equipment and storage medium | |
CN110060154A (en) | Works based on block chain deposit card method, system, device and equipment | |
US20200065330A1 (en) | XML Data Manipulation Method and Apparatus | |
CN111831624A (en) | Data table creating method and device, computer equipment and storage medium | |
CN110147673A (en) | A kind of loophole position mask method and device based on text and source code symbol extraction | |
CN117009319B (en) | Database operation method, system and storage medium based on large language model | |
Guo et al. | A novel vulnerable code clone detector based on context enhancement and patch validation | |
WO2019148797A1 (en) | Natural language processing method, device, computer apparatus, and storage medium | |
CN115906086A (en) | Method, system and storage medium for detecting webpage backdoor based on code attribute graph | |
CN111984970A (en) | SQL injection detection method and system, electronic equipment and storage medium | |
CN112202822B (en) | Database injection detection method and device, electronic equipment and storage medium | |
CN113971216B (en) | Data processing method and device, electronic equipment and memory |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |