Data storage methods, devices, computer equipment and storage media
By receiving user input of database name, table name, and interface description information, the system generates the target table creation statement and stores the data corresponding to the log data fields, thus solving the information redundancy problem caused by full log storage and improving the flexibility and intelligence of log storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2022-11-18
- Publication Date
- 2026-06-30
AI Technical Summary
Existing business system log data storage methods can only save the full amount of log data, resulting in information redundancy, wasted data storage resources, poor storage flexibility, and a lack of intelligence.
By receiving user input of the database name, table name, and interface description, the system generates the target table creation statement based on the table creation statement template, filters and stores the target data corresponding to the log data fields, thus avoiding the saving of all log data.
It effectively avoids information redundancy, improves the flexibility and intelligence of log storage, and enhances the user experience.
Smart Images

Figure CN115809241B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, and in particular to data storage methods, devices, computer equipment and storage media. Background Technology
[0002] Logs can record information about hardware, software, and system problems, and can also monitor events occurring within the system. Currently, logs are a very common type of data in the fintech field. Many fintech companies, such as insurance companies, use logs to examine the causes of errors or to find traces left by attackers during attacks. However, the inventors discovered that current log data storage methods used in most business systems can only store the full log data generated by interfaces, resulting in information redundancy, wasted data storage resources, poor flexibility, and a lack of intelligence in log storage. Summary of the Invention
[0003] The purpose of this application is to propose a data storage method, apparatus, computer equipment, and storage medium to solve the technical problems of existing log data storage methods applied to most business systems, which can only save the full amount of log data generated by the interface, resulting in information redundancy, waste of data storage resources, poor flexibility and lack of intelligence in log storage.
[0004] To address the aforementioned technical problems, this application provides a data storage method, employing the following technical solution:
[0005] If a data storage request triggered by a user is received, a pre-defined information population page will be displayed;
[0006] Receive the library name, table name, and interface description information entered by the user on the information filling page;
[0007] Based on the table name, a preset table creation statement template is displayed, and the table creation statement template is modified based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field;
[0008] Create a corresponding data table based on the target table creation statement;
[0009] Based on the log file of the target interface corresponding to the interface description information, obtain the target data corresponding to the log data field;
[0010] The target data is filled into the data table to generate a target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name.
[0011] Furthermore, the step of displaying a preset table creation statement template based on the table name specifically includes:
[0012] Retrieve the specified data table corresponding to the table name;
[0013] Obtain the table structure of the specified data table;
[0014] The table creation statement template is generated based on the table structure;
[0015] The template for the table creation statement is displayed.
[0016] Furthermore, the step of modifying the table creation statement template based on the user-input modification information to obtain the corresponding target table creation statement specifically includes:
[0017] Based on the interface description information, parse out all fields corresponding to the target interface;
[0018] Display all of the aforementioned full fields;
[0019] Receive the user's input selection information for all of the full fields;
[0020] Obtain the specified field corresponding to the selected information to obtain the log data field;
[0021] The target table creation statement is obtained by modifying the table creation statement template based on the log data fields.
[0022] Furthermore, the step of creating the corresponding data table based on the target table creation statement specifically includes:
[0023] Retrieve the preset statement specifications;
[0024] The target table creation statement is validated based on the statement specification to determine whether the target table creation statement conforms to the statement specification.
[0025] If the statement conforms to the specified specification, then the step of creating the corresponding data table based on the target table creation statement is executed.
[0026] Furthermore, the step of obtaining the target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information specifically includes:
[0027] Read the log file of the target interface corresponding to the interface description information from the database corresponding to the database name;
[0028] Based on the log data fields, the log file is filtered to obtain the field parameter data corresponding to the log data fields from the log file.
[0029] Use the field parameter data as the target data.
[0030] Furthermore, the step of filtering the log file based on the log data field and obtaining the field parameter data corresponding to the log data field from the log file specifically includes:
[0031] Create database query statements corresponding to each of the log data fields;
[0032] Execute each of the database query statements to obtain the data query results corresponding to each of the database query statements from the log data in the database;
[0033] All the data query results are used as field parameter data corresponding to the log data fields.
[0034] Furthermore, the step of filling the data table with the target data to generate a target data table corresponding to the table name, and storing the target data table in the database corresponding to the database name, specifically includes:
[0035] The target data is filled into the parameter filling positions associated with the log data fields contained in the data table one by one to obtain the filled data table;
[0036] The filled data table is used as the target data table;
[0037] The target data table is stored in the database.
[0038] To address the aforementioned technical problems, this application also provides a data storage device, which employs the following technical solution:
[0039] The display module is used to populate the page with preset information if a data storage request triggered by a user is received.
[0040] The receiving module is used to receive the library name, table name and interface description information entered by the user on the information filling page;
[0041] The modification module is used to display a preset table creation statement template based on the table name, and modify the table creation statement template based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field;
[0042] A creation module is used to create a corresponding data table based on the target table creation statement;
[0043] The acquisition module is used to acquire target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information;
[0044] The storage module is used to fill the target data into the data table, generate a target data table corresponding to the table name, and store the target data table in the database corresponding to the database name.
[0045] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0046] If a data storage request triggered by a user is received, a pre-defined information population page will be displayed;
[0047] Receive the library name, table name, and interface description information entered by the user on the information filling page;
[0048] Based on the table name, a preset table creation statement template is displayed, and the table creation statement template is modified based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field;
[0049] Create a corresponding data table based on the target table creation statement;
[0050] Based on the log file of the target interface corresponding to the interface description information, obtain the target data corresponding to the log data field;
[0051] The target data is filled into the data table to generate a target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name.
[0052] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0053] If a data storage request triggered by a user is received, a pre-defined information population page will be displayed;
[0054] Receive the library name, table name, and interface description information entered by the user on the information filling page;
[0055] Based on the table name, a preset table creation statement template is displayed, and the table creation statement template is modified based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field;
[0056] Create a corresponding data table based on the target table creation statement;
[0057] Based on the log file of the target interface corresponding to the interface description information, obtain the target data corresponding to the log data field;
[0058] The target data is filled into the data table to generate a target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name.
[0059] Compared with the prior art, the embodiments of this application have the following main advantages:
[0060] When this embodiment receives a data storage request triggered by a user, it first displays a preset information population page; then it receives the database name, table name, and interface description information entered by the user on the information population page; next, it displays a preset table creation statement template based on the table name, and modifies the table creation statement template based on the modification information entered by the user to obtain the corresponding target table creation statement; subsequently, it creates a corresponding data table based on the target table creation statement; and based on the log file of the target interface corresponding to the interface description information, it obtains the target data corresponding to the log data field; finally, it populates the data table with the target data, generates the target data table corresponding to the table name, and stores the target data table in the database corresponding to the database name. This embodiment filters the log file in the database corresponding to the target interface based on the log storage identification information entered by the user, so that only the log data corresponding to the log data field needs to be saved in the database, thus avoiding the need to save all the log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improves the flexibility and intelligence of log storage, and is conducive to improving the user experience. Attached Figure Description
[0061] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0063] Figure 2 A flowchart of an embodiment of the data storage method according to this application;
[0064] Figure 3 This is a schematic diagram of the structure of one embodiment of the data storage device according to this application;
[0065] Figure 4This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0067] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0068] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0069] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0070] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0071] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0072] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0073] It should be noted that the data storage method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the data storage device is generally located in the server / terminal device.
[0074] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0075] Continue to refer to Figure 2 A flowchart of an embodiment of the data storage method according to this application is shown. The data storage method includes the following steps:
[0076] Step S201: If a data storage request triggered by a user is received, a preset information population page is displayed.
[0077] In this embodiment, the data storage method operates on an electronic device (e.g., Figure 1 The server / terminal device shown can receive user-triggered data storage requests via wired or wireless connections. It should be noted that the aforementioned wireless connection methods include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future-developed wireless connection methods. Users can trigger the generation of the aforementioned data storage request by clicking a pre-set data storage button. The aforementioned information population page is a pre-built page based on business needs, containing information related to log data storage.
[0078] Step S202: Receive the library name, table name, and interface description information entered by the user on the information filling page.
[0079] In this embodiment, the aforementioned library name refers to the name of the database used to store the interface's log data, and the aforementioned table name can refer to the name of a data table containing a table structure corresponding to the user's actual business needs. The aforementioned interface description information refers to the interface description information of the target interface, which has a one-to-one correspondence with the target interface, and may include the target interface's interface name, input parameter fields, output parameter fields, etc. The aforementioned library name, table name, and interface description information can be collectively referred to as log storage identification information.
[0080] Step S203: Display a preset table creation statement template based on the table name, and modify the table creation statement template based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field.
[0081] In this embodiment, the specific implementation process of displaying a preset table creation statement template based on the table name and modifying the table creation statement template based on the modification information input by the user to obtain the corresponding target table creation statement will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0082] Step S204: Create a corresponding data table based on the target table creation statement.
[0083] In this embodiment, the target table creation statement is executed to create the corresponding data table.
[0084] Step S205: Based on the log file of the target interface corresponding to the interface description information, obtain the target data corresponding to the log data field.
[0085] In this embodiment, the specific implementation process of obtaining the target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information will be further described in detail in subsequent specific embodiments of this application, and will not be elaborated on here.
[0086] Step S206: Fill the target data into the data table to generate a target data table corresponding to the table name, and store the target data table in the database corresponding to the database name.
[0087] In this embodiment, after generating the target data table, the user can customize the order, naming, and remarks of the fields within the target data table, modify existing field names, and add or delete fields in the target data table. The specific implementation process of filling the data table with the target data, generating the target data table corresponding to the table name, and storing the target data table in the database corresponding to the database name will be described in further detail in subsequent embodiments of this application, and will not be elaborated upon here.
[0088] When this application receives a data storage request triggered by a user, it first displays a preset information population page; then it receives the database name, table name, and interface description information entered by the user on the information population page; next, it displays a preset table creation statement template based on the table name, and modifies the table creation statement template based on the modification information entered by the user to obtain the corresponding target table creation statement; subsequently, it creates the corresponding data table based on the target table creation statement; and based on the log file of the target interface corresponding to the interface description information, it obtains the target data corresponding to the log data field; finally, it populates the data table with the target data, generating the target data table corresponding to the table name, and stores the target data table in the database corresponding to the database name. This application filters the log file in the database corresponding to the target interface based on the log storage identification information entered by the user, so that only the log data corresponding to the log data field needs to be saved in the database, thus avoiding the need to save all the log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improves the flexibility and intelligence of log storage, and is conducive to improving the user experience.
[0089] In some optional implementations, step S203, which involves displaying a preset table creation statement template based on the table name, includes the following steps:
[0090] Retrieve the specified data table corresponding to the table name.
[0091] In this embodiment, there is a one-to-one mapping relationship between the table name and the data table, and the specified data table corresponding to the table name can be obtained from the database based on the mapping relationship.
[0092] Obtain the table structure of the specified data table.
[0093] In this embodiment, a data table is a location in the database where data is stored; it is a structured file. The table structure is used to define a data table's fields, types, primary keys, foreign keys, and indexes, etc.
[0094] The table creation statement template is generated based on the table structure.
[0095] In this embodiment, a table creation statement is a statement used to create a data table. After obtaining the specified data table corresponding to the table name, the table structure of the specified data table is read, and then a table creation statement can be generated according to the table structure.
[0096] The template for the table creation statement is displayed.
[0097] In this embodiment, there is no specific limitation on how the table creation statement template is displayed; it can be set according to actual usage needs.
[0098] This application obtains a specified data table corresponding to the table name; then obtains the table structure of the specified data table; and then generates and displays the table creation statement template based on the table structure. This realizes the generation of a matching table creation statement template based on the table name input by the user, allowing users to define the table structure for storing the required log data according to their actual needs, thereby improving the flexibility and intelligence of log storage and enhancing the user experience.
[0099] In some optional implementations of this embodiment, step S203, which modifies the table creation statement template based on the user-input modification information to obtain the corresponding target table creation statement, includes the following steps:
[0100] Based on the interface description information, parse out all fields corresponding to the target interface.
[0101] In this embodiment, the target interface corresponding to the interface description information can be determined first. Then, all corresponding input parameter fields, i.e., the aforementioned full set of fields, are automatically parsed based on the dictionary structure of the target interface. The dictionary structure of the target interface supports one or more levels of dictionary structure parsing.
[0102] Display all of the full fields mentioned.
[0103] In this embodiment, there is no specific limitation on the display method of the above full fields, which can be set according to actual usage needs.
[0104] Receive the user's input selection information for all of the full fields.
[0105] In this embodiment, users can select the fields corresponding to the log data that need to be stored from all the full fields according to their actual business needs, thereby improving the user experience.
[0106] Obtain the specified field corresponding to the selected information to obtain the log data field.
[0107] In this embodiment, after obtaining the specified field corresponding to the selection information, the specified field is used as the aforementioned log data field.
[0108] The target table creation statement is obtained by modifying the table creation statement template based on the log data fields.
[0109] In this embodiment, the fields of the data table to be constructed contained in the above table creation statement template can be replaced based on the log data fields to obtain the target table creation statement.
[0110] This application parses all fields corresponding to the target interface based on the interface description information and displays all of these fields. Then, it receives user input selecting all of these fields. Next, it obtains the specified field corresponding to the selection information to obtain the log data field. Finally, it modifies the table creation statement template based on the log data field to obtain the target table creation statement. This embodiment allows users to select log data fields requiring focused monitoring and storage from all the full fields corresponding to the target interface based on their individual needs. Subsequently, only the portion of log data corresponding to this specific log data field needs to be saved, eliminating the need to save all log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improving the flexibility and intelligence of log storage and enhancing the user experience.
[0111] In some alternative implementations, step S204 includes the following steps:
[0112] Get the preset statement specifications.
[0113] In this embodiment, the aforementioned statement specification is a standard specification pre-constructed based on actual business needs to determine whether a table creation statement is qualified. This specification may define the standard statement format and standard syntax rules for table creation statements.
[0114] The target table creation statement is validated based on the stated statement specification to determine whether the target table creation statement conforms to the stated statement specification.
[0115] In this embodiment, validating the target table creation statement based on the statement specification means checking whether the target table creation statement conforms to the above standard statement format and the above standard syntax rules.
[0116] If the statement conforms to the specified specification, then the step of creating the corresponding data table based on the target table creation statement is executed.
[0117] In this embodiment, if the target table creation statement conforms to both the standard statement format and the standard syntax rules described above, then the target table creation statement is determined to conform to the statement specification. If the target table creation statement is found to be inconsistent with the statement specification, a modification reminder message corresponding to that specification will be generated and displayed to remind the user to further modify the target table creation statement so that the final target table creation statement conforms to the statement specification.
[0118] After obtaining the target table creation statement, this application intelligently acquires a preset statement specification; and further verifies the target table creation statement based on the statement specification to determine whether the target table creation statement conforms to the statement specification. Only when the target table creation statement is detected to conform to the statement specification will the processing step of creating the corresponding data table based on the target table creation statement be executed, effectively ensuring the standardization and accuracy of the generated target table creation statement and improving the standardization of data storage request processing.
[0119] In some alternative implementations, step S205 includes the following steps:
[0120] Read the log file of the target interface corresponding to the interface description information from the database corresponding to the database name.
[0121] In this embodiment, the database stores log files corresponding to different interfaces, and each interface's log file has a one-to-one correspondence with each interface. After determining the target interface based on the interface description information, the log file of the target interface corresponding to the interface description information can be read from the database.
[0122] Based on the log data fields, the log file is filtered to obtain the field parameter data corresponding to the log data fields from the log file.
[0123] In this embodiment, the contents of the log file can be read first and converted into a corresponding list. Then, the list can be iterated around based on the log data fields. The target field that matches the log data fields can be queried from the list. Then, the parameter data corresponding to the target field can be filtered out from the list to obtain the above parameter data.
[0124] Use the field parameter data as the target data.
[0125] This application reads the log file of the target interface corresponding to the interface description information from the database corresponding to the database name; then filters the log file based on the log data fields, obtains the field parameter data corresponding to the log data fields from the log file, and uses the field parameter data as the target data. By filtering the log file corresponding to the target interface in the database based on the log data fields, only the log data corresponding to the log data fields needs to be saved in the database, thus avoiding the need to save all the log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improves the flexibility and intelligence of log storage, and enhances the user experience.
[0126] In some optional implementations of this embodiment, the step of filtering the log file based on the log data field and obtaining the field parameter data corresponding to the log data field from the log file includes the following steps:
[0127] Create database query statements corresponding to each of the log data fields.
[0128] In this embodiment, for each log data field, the field identifier corresponding to the log data field can be obtained based on a preset mapping table. Then, the file identifier of the log file containing the log data field is detected from the database. The field identifier and the file identifier are then determined as the first preset parameter and the second preset parameter reserved in the preset structured query statement SQL, respectively, to obtain the database query statement corresponding to the log data field.
[0129] Execute each of the database query statements to obtain the data query results corresponding to each of the database query statements from the log data in the database.
[0130] In this embodiment, by executing each database query statement, the data query result corresponding to the database query statement can be obtained from the log data in the database.
[0131] All the data query results are used as field parameter data corresponding to the log data fields.
[0132] This application creates database query statements corresponding to each of the log data fields; then executes each database query statement to obtain data query results corresponding to each database query statement from the log data in the database; and then uses all the data query results as field parameter data corresponding to the log data fields. This application constructs corresponding database query statements based on log data fields, and then executes these database query statements to quickly and accurately obtain field parameter data corresponding to the log data fields from the database and use it as the aforementioned target data, ensuring both the efficiency and accuracy of target data acquisition.
[0133] In some optional implementations of this embodiment, step S206 includes the following steps:
[0134] The target data is filled into the parameter filling positions associated with the log data fields contained in the data table one by one to obtain the filled data table.
[0135] In this embodiment, for each target data, the target data can be filled into the parameter filling position of the target data field corresponding to the target data contained in the data table, that is, the data column to which the target data field belongs.
[0136] The filled data table is used as the target data table.
[0137] The target data table is stored in the database.
[0138] In this embodiment, after storing the target data table into the database, the log files of the target interface in the database can be further deleted to free up available space in the database.
[0139] This application obtains a filled data table by filling the target data one-to-one into the parameter filling positions associated with the log data fields contained in the data table, and uses the filled data table as the target data table; then, the target data table is stored in the database, thereby achieving accurate filling of the target data in the data table, ensuring the data accuracy of the generated target data table, and ensuring the storage accuracy of the target data table.
[0140] It should be emphasized that, to further ensure the privacy and security of the aforementioned target data table, the target data table can also be stored in a node of a blockchain.
[0141] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0142] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0143] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0144] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0145] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0146] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a data storage device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0147] like Figure 3 As shown, the data storage device 300 described in this embodiment includes: a display module 301, a receiving module 302, a modification module 303, a creation module 304, an acquisition module 305, and a storage module 306. Wherein:
[0148] The display module 301 is used to display a preset information population page if a data storage request triggered by a user is received.
[0149] The receiving module 302 is used to receive the library name, table name and interface description information entered by the user on the information filling page;
[0150] The modification module 303 is used to display a preset table creation statement template based on the table name, and modify the table creation statement template based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field;
[0151] Module 304 is used to create a corresponding data table based on the target table creation statement;
[0152] The acquisition module 305 is used to acquire target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information;
[0153] The storage module 306 is used to fill the target data into the data table, generate a target data table corresponding to the table name, and store the target data table in the database corresponding to the database name.
[0154] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0155] In some optional implementations of this embodiment, the receiving module 302 includes:
[0156] The first acquisition submodule is used to acquire the specified data table corresponding to the table name;
[0157] The second acquisition submodule is used to acquire the table structure of the specified data table;
[0158] A generation submodule is used to generate the table creation statement template based on the table structure.
[0159] The first display submodule is used to display the table creation statement template.
[0160] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0161] In some optional implementations of this embodiment, the receiving module 302 further includes:
[0162] The parsing submodule is used to parse out all fields corresponding to the target interface based on the interface description information;
[0163] The second display submodule is used to display all of the aforementioned full fields;
[0164] A receiving submodule is used to receive the user's input selection information for all of the full fields;
[0165] The third acquisition submodule is used to acquire the specified field corresponding to the selection information to obtain the log data field;
[0166] The modification submodule is used to modify the table creation statement template based on the log data fields to obtain the target table creation statement.
[0167] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned implementation method, and will not be repeated here.
[0168] In some optional implementations of this embodiment, the creation module 304 includes:
[0169] The fourth submodule is used to obtain preset statement specifications;
[0170] The validation submodule is used to validate the target table creation statement based on the statement specification, and to determine whether the target table creation statement conforms to the statement specification.
[0171] The execution submodule is used to execute the step of creating the corresponding data table based on the target table creation statement if the statement conforms to the statement specification.
[0172] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0173] In some optional implementations of this embodiment, the acquisition module 305 includes:
[0174] The reading submodule is used to read the log file of the target interface corresponding to the interface description information from the database corresponding to the database name;
[0175] The filtering submodule is used to filter data in the log file based on the log data field and obtain field parameter data corresponding to the log data field from the log file.
[0176] The first determining submodule is used to use the field parameter data as the target data.
[0177] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0178] In some optional implementations of this embodiment, the filtering submodule includes:
[0179] A creation unit is used to create database query statements corresponding to each of the log data fields;
[0180] The acquisition unit is used to execute each of the database query statements and obtain the data query results corresponding to each of the database query statements from the log data in the database;
[0181] The determining unit is used to treat all the data query results as field parameter data corresponding to the log data fields.
[0182] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0183] In some optional implementations of this embodiment, the storage module 306 includes:
[0184] The fill submodule is used to fill the target data one-to-one into the parameter fill positions associated with the log data fields contained in the data table, so as to obtain the filled data table;
[0185] The second determining submodule is used to use the filled data table as the target data table;
[0186] The storage submodule is used to store the target data table into the database.
[0187] In this embodiment, the operations performed by the above modules or units correspond one-to-one with the steps of the data storage method in the aforementioned embodiments, and will not be repeated here.
[0188] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0189] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0190] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0191] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit and its external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for data storage methods. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.
[0192] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute computer-readable instructions for the data storage method.
[0193] The network interface 43 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 4 and other electronic devices.
[0194] Compared with the prior art, the embodiments of this application have the following main advantages:
[0195] In this embodiment, upon receiving a data storage request triggered by a user, a preset information population page is first displayed. Then, the database name, table name, and interface description information entered by the user on the information population page are received. Next, a preset table creation statement template is displayed based on the table name, and the template is modified based on the user's input modification information to obtain the corresponding target table creation statement. Subsequently, a corresponding data table is created based on the target table creation statement. Based on the log file of the target interface corresponding to the interface description information, the target data corresponding to the log data field is obtained. Finally, the target data is populated into the data table to generate the target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name. This embodiment filters the log file corresponding to the target interface in the database based on the log storage identifier information entered by the user. This ensures that only a portion of the log data corresponding to the log data field needs to be saved in the database, eliminating the need to save all log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improves the flexibility and intelligence of log storage, and enhances the user experience.
[0196] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the data storage method described above.
[0197] Compared with the prior art, the embodiments of this application have the following main advantages:
[0198] In this embodiment, upon receiving a data storage request triggered by a user, a preset information population page is first displayed. Then, the database name, table name, and interface description information entered by the user on the information population page are received. Next, a preset table creation statement template is displayed based on the table name, and the template is modified based on the user's input modification information to obtain the corresponding target table creation statement. Subsequently, a corresponding data table is created based on the target table creation statement. Based on the log file of the target interface corresponding to the interface description information, the target data corresponding to the log data field is obtained. Finally, the target data is populated into the data table to generate the target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name. This embodiment filters the log file corresponding to the target interface in the database based on the log storage identifier information entered by the user. This ensures that only a portion of the log data corresponding to the log data field needs to be saved in the database, eliminating the need to save all log data in the log file. This effectively avoids information redundancy and waste of data storage resources, improves the flexibility and intelligence of log storage, and enhances the user experience.
[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0200] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A data storage method, characterized in that, Includes the following steps: If a data storage request triggered by a user is received, a pre-defined information population page will be displayed; Receive the library name, table name, and interface description information entered by the user on the information filling page; Based on the table name, a preset table creation statement template is displayed, and the table creation statement template is modified based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field; Create a corresponding data table based on the target table creation statement; Based on the log file of the target interface corresponding to the interface description information, obtain the target data corresponding to the log data field; The target data is filled into the data table to generate a target data table corresponding to the table name, and the target data table is stored in the database corresponding to the database name; The step of displaying a preset table creation statement template based on the table name specifically includes: Retrieve the specified data table corresponding to the table name; Obtain the table structure of the specified data table; The table creation statement template is generated based on the table structure; This displays the template for the table creation statement; A data table is a location in a database where data is stored. It is a structured file. The table structure is used to define the fields, types, primary keys, foreign keys, and indexes of a data table. A table creation statement is a statement used to create a data table. After obtaining the specified data table corresponding to the table name, the table structure of the specified data table is read, and then the table creation statement is generated according to the table structure.
2. The data storage method according to claim 1, characterized in that, The step of modifying the table creation statement template based on the user-input modification information to obtain the corresponding target table creation statement specifically includes: Based on the interface description information, parse out all fields corresponding to the target interface; Display all of the aforementioned full fields; Receive the user's input selection information for all of the full fields; Obtain the specified field corresponding to the selected information to obtain the log data field; The target table creation statement is obtained by modifying the table creation statement template based on the log data fields.
3. The data storage method according to claim 1, characterized in that, The step of creating the corresponding data table based on the target table creation statement specifically includes: Retrieve the preset statement specifications; The target table creation statement is validated based on the statement specification to determine whether the target table creation statement conforms to the statement specification. If the statement conforms to the specified specification, then the step of creating the corresponding data table based on the target table creation statement is executed.
4. The data storage method according to claim 1, characterized in that, The step of obtaining the target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information specifically includes: Read the log file of the target interface corresponding to the interface description information from the database corresponding to the database name; Based on the log data fields, the log file is filtered to obtain the field parameter data corresponding to the log data fields from the log file. Use the field parameter data as the target data.
5. The data storage method according to claim 4, characterized in that, The step of filtering data in the log file based on the log data fields and obtaining field parameter data corresponding to the log data fields from the log file specifically includes: Create database query statements corresponding to each of the log data fields; Execute each of the database query statements to obtain the data query results corresponding to each of the database query statements from the log data in the database; All the data query results are used as field parameter data corresponding to the log data fields.
6. The data storage method according to claim 1, characterized in that, The steps of filling the target data into the data table to generate a target data table corresponding to the table name, and storing the target data table in the database corresponding to the database name, specifically include: The target data is filled into the parameter filling positions associated with the log data fields contained in the data table one by one to obtain the filled data table; The filled data table is used as the target data table; The target data table is stored in the database.
7. A data storage device, characterized in that, include: The display module is used to populate the page with preset information if a data storage request triggered by a user is received. The receiving module is used to receive the library name, table name and interface description information entered by the user on the information filling page; The modification module is used to display a preset table creation statement template based on the table name, and modify the table creation statement template based on the modification information input by the user to obtain the corresponding target table creation statement; wherein, the modification information includes at least a log data field; A creation module is used to create a corresponding data table based on the target table creation statement; The acquisition module is used to acquire target data corresponding to the log data field based on the log file of the target interface corresponding to the interface description information; The storage module is used to fill the target data into the data table, generate a target data table corresponding to the table name, and store the target data table in the database corresponding to the database name; The receiving module includes: The first acquisition submodule is used to acquire the specified data table corresponding to the table name; The second acquisition submodule is used to acquire the table structure of the specified data table; A generation submodule is used to generate the table creation statement template based on the table structure. The first display submodule is used to display the table creation statement template; A data table is a location in a database where data is stored. It is a structured file. The table structure is used to define the fields, types, primary keys, foreign keys, and indexes of a data table. A table creation statement is a statement used to create a data table. After obtaining the specified data table corresponding to the table name, the table structure of the specified data table is read, and then the table creation statement is generated according to the table structure.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the data storage method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data storage method as described in any one of claims 1 to 6.