Data storage method and device for dynamically creating table structure, equipment and storage medium
By dynamically creating table structures, we solve the problem of unified storage and management of data with different structures, realize simple storage and query of data, reduce the difficulty of database maintenance, and support flexible data display and indexing operations.
Patent Information
- Application Number
- CN202410730729.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-20
AI Technical Summary
The existing technology makes it difficult to dynamically add and uniformly manage data with different structures, resulting in too many data tables and large differences in data volume. Moreover, dynamically added tables cannot be predicted when dividing databases and tables, making database maintenance and query difficult.
By dynamically creating a table structure, the data to be stored is obtained, the target basic information storage table is determined, the data structure is split and stored in the data field storage table, and data record identification and attribute information are generated to achieve unified storage and query of data.
It realizes the unified storage and management of multiple different structures of data, simplifies data storage and query operations, reduces the difficulty of database maintenance, and supports flexible data display and indexing.
Smart Images

Figure CN118673022A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a data storage method, device, equipment and storage medium for dynamically creating a table structure. Background Art
[0002] In the implementation of crawler software and knowledge management software, it is necessary to process and store various types of data. Different types of data have different field structures. When storing, querying, and using these data with different structures, several difficulties need to be solved. First, a dynamic mechanism for creating table fields is required during storage to ensure that data with different structures can be added dynamically. Secondly, in terms of querying and using this type of data, unified management is required to facilitate fast and convenient reading by the application.
[0003] For the storage of data with different structures, the traditional approach is to create corresponding tables for storing data with different structures. When adding or querying data, you need to first find the corresponding table of the data, and then perform add, delete, modify and query operations.
[0004] However, the above-mentioned current storage method, first of all, in terms of table creation, when dynamically adding a table, if there are too many types of data, it will inevitably result in too many data tables. Too many tables will cause certain difficulties in the subsequent database maintenance; second, different tables may need to store very little data, while others may store massive amounts of data, which will result in a large difference in the amount of data stored in each table; third, now for the storage of massive data, it is necessary to implement sharding of libraries and tables. For dynamically added tables, it is very troublesome to implement sharding of tables. Most of the current sharding storage solutions require pre-configuration of sharding solutions, and we cannot predict the dynamically added tables during system operation. Therefore, it is difficult to solve the sharding function of dynamically added tables.
[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0006] The main purpose of the present application is to provide a data storage method, device, equipment and storage medium for dynamically creating a table structure, aiming to solve the technical problem in the prior art that multiple different structured data cannot be stored uniformly.
[0007] To achieve the above purpose, the present application proposes a data storage method for dynamically creating a table structure, the data storage method for dynamically creating a table structure includes:
[0008] Get the data to be stored;
[0009] Determine a target basic information storage table based on the data to be stored;
[0010] Determine the field information corresponding to the associated target data field storage table according to the target basic information storage table;
[0011] Inserting a data title into the data record table according to the data to be stored, and generating a data record identifier;
[0012] Matching the field information with the data value of the data to be stored to obtain matching data in the data to be stored;
[0013] The data attribute information generated by the matched data and the data record identifier is stored in the target data attribute storage table associated with the target data field storage table, thereby completing the storage of the data to be stored.
[0014] In one embodiment, after the step of determining the target basic information storage table based on the data to be stored, the method further includes:
[0015] Acquire a table title based on the data to be stored;
[0016] An item table is created in the data recording table based on the table title, for storing the data to be stored.
[0017] In one embodiment, before the step of obtaining the data to be stored, the method further includes:
[0018] A plurality of basic information storage tables and data field storage tables associated with the basic information storage tables, a plurality of data record tables and a data attribute storage table associated with the data record tables are created.
[0019] In one embodiment, after the step of determining the target basic information storage table based on the data to be stored, the method further includes:
[0020] Get target data;
[0021] Splitting the structure of the target data into preset fields, and creating corresponding data for each field in a data field storage table;
[0022] The structural layer of the target data is constructed by the data field storage table and the basic information storage table.
[0023] In one embodiment, the step of splitting the structure of the target data into preset fields and creating corresponding data for each field in the data field storage table further includes:
[0024] The storage order of each field is recorded when it is stored, which serves as sorting information for display.
[0025] In one embodiment, after completing the step of storing the data to be stored, the method further includes:
[0026] Obtain the field information of the target data in the data attribute storage table;
[0027] The target data is obtained by querying based on matching the field information with the data attribute name stored in the data record table.
[0028] In one embodiment, after the step of obtaining the target data, the method further includes:
[0029] Obtaining a table title stored in a data record table based on target data;
[0030] Based on the table title, query the field information of the target data in the data field storage table;
[0031] Acquire a data record identifier in the data field storage table based on the target data;
[0032] Querying the data attribute information of the target data in the data attribute storage table through the data record identifier;
[0033] Matching the field information and data attribute information of the target data;
[0034] Sorting information is obtained, and the fields of the target data are sorted according to the sorting information, so as to display the target data in the order of the fields.
[0035] In addition, to achieve the above purpose, the present application also proposes a data storage device for dynamically creating a table structure, the device comprising:
[0036] A data acquisition module, used to acquire data to be stored;
[0037] A data processing module, used for determining a target basic information storage table based on the data to be stored;
[0038] Determine the field information corresponding to the associated target data field storage table according to the target basic information storage table; insert a data title into the data record table according to the data to be stored to generate a data record identifier; match the field information with the data value of the data to be stored to obtain the matching data in the data to be stored;
[0039] The data storage module is used to store the matched data and the data record identifier to generate data attribute information into the target data attribute storage table associated with the target data field storage table to complete the storage of the data to be stored.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a data storage device for dynamically creating a table structure, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the data storage method for dynamically creating a table structure as described above.
[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the data storage method for dynamically creating a table structure as described above are implemented.
[0042] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the data storage method for dynamically creating a table structure as described above are implemented.
[0043] One or more technical solutions proposed in this application have at least the following technical effects:
[0044] Acquire the data to be stored; determine the target basic information storage table based on the data to be stored; determine the field information corresponding to the associated target data field storage table according to the target basic information storage table; insert the data title into the data record table according to the data to be stored, and generate a data record identifier; match the field information with the data value of the data to be stored to obtain the matching data in the data to be stored; generate data attribute information from the matching data and the data record identifier and store it in the target data attribute storage table associated with the target data field storage table to complete the storage of the data to be stored. In applications that need to store a variety of data with different structures, storing data will be very convenient; when querying and indexing data, only one table needs to be operated to achieve it. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0047] Figure 1 A flowchart diagram of a data storage method for dynamically creating a table structure according to an embodiment of the present invention;
[0048] Figure 2A basic structure table for creating data storage provided in Embodiment 1 of the method for dynamically creating a table structure of data storage in this application;
[0049] Figure 3 A data adding flow chart provided for the first embodiment of the method for dynamically creating a table structure of data storage in this application;
[0050] Figure 4 A flowchart diagram of a second embodiment of a method for dynamically creating a table structure for data storage in this application;
[0051] Figure 5 A data usage flow chart provided for Example 2 of the data storage method for dynamically creating a table structure in this application;
[0052] Figure 6 A newly added diagram of data tables and data fields provided in Example 2 of the data storage method for dynamically creating a table structure of this application;
[0053] Figure 7 A flowchart diagram of a data storage method for dynamically creating a table structure according to a third embodiment of the present application;
[0054] Figure 8 A schematic diagram of the module structure of a data storage device that dynamically creates a table structure according to an embodiment of the present application;
[0055] Fig. 9 A schematic diagram of the device structure of the hardware operating environment involved in the data storage method for dynamically creating a table structure in an embodiment of the present application.
[0056] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0057] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0058] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0059] Since the existing technology creates corresponding tables to store data of different structures, when adding or querying data, it is necessary to first find the corresponding table of the data and then perform add, delete, modify and query operations. Multiple data of different structures cannot be stored or managed uniformly.
[0060] The present application provides a data storage method for dynamically creating a table structure to solve the problem of unified storage of data with multiple different structures. When the system needs to store data with a new structure, it can automatically and manually create data storage fields, store the values of each field of the data in the corresponding mapping, and flexibly realize the storage, query, and display of data. For other application aspects of the data, such as indexing, sub-library and sub-table, it can provide simple and convenient operations.
[0061] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a data storage device that dynamically creates a table structure, etc. The following takes the data storage device that dynamically creates a table structure as the execution subject and takes crawling a news website data as an example to illustrate this embodiment and the following embodiments.
[0062] Based on this, the embodiment of the present application provides a data storage method for dynamically creating a table structure, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the data storage device method for dynamically creating a table structure in the present application.
[0063] In this embodiment, the method for dynamically creating a data storage device with a table structure includes steps S10 to S40:
[0064] Step S10, obtaining data to be stored;
[0065] In the specific implementation, the data crawled by the crawler has various structures, and the field names of the data are also different. Different data structures require the creation of structural information of this type of data in the s_table and s_table_field tables. Taking crawling a news website data as an example, the data to be crawled is mainly news, and the news mainly includes title, author, release time, keywords, summary, and content.
[0066] Furthermore, a plurality of basic information storage tables, a data field storage table associated with the basic information storage table, a plurality of data record tables and a data attribute storage table associated with the data record table are created.
[0067] like Figure 2 As shown, Figure 2It shows how to create a basic structure table for data storage. Four tables need to be created, including: s_table: basic information storage table, used to store basic information of the table. When data with a new structure needs to be stored, a new data entry needs to be created in the table. The data content includes information such as the table name and table description, which is used to distinguish and identify data with different structures. The s_table includes: data table id, data table name, data table creation time, data table update time, etc.
[0068] s_table_field: data field storage table, used to store data field information, i.e. data fields, associated with s_table. Each data structure consists of multiple fields, and data fields are equivalent to fields in a relational data table. When data with a new structure needs to be stored, it is necessary to store the data structure in this table, split the data structure into fields, and create a new data entry for each field in the table. In this way, this table and the s_table table jointly construct the schema layer for this type of data. The s_table_field includes: field id, field name, table id, field sort, data field creation time, data field update time, etc.
[0069] s_data_record: data record table, a table that stores basic data information, i.e. data records. It mainly records the data id and the table id to which it belongs. It includes: data record id, data name, data category, data table id (s_table_id), data record creation time, data record update time, etc.
[0070] s_data_property: data attribute storage table, a table that stores data attributes, i.e. data attributes. A piece of data consists of multiple attributes, and each attribute needs to store a piece of data in this table, mainly storing the data record id, data field id, attribute value, etc. to which the attribute belongs.
[0071] like Figure 3 As shown, Figure 3 Added a flow chart for the data.
[0072] Step S20, determining a target basic information storage table based on the data to be stored;
[0073] Further, obtaining a table title based on the data to be stored;
[0074] Based on the table title, an item table is created in the data record table to store the table title.
[0075] It should be noted that a news table (also known as a news topic library in the project) is created in the s_table table to store table name information.
[0076] It can be understood that s_table includes: data table id, data table name, data table creation time, and data table update time.
[0077] In the specific implementation, after the crawler obtains the news data, it passes the data in json format to the system. When crawling, it will determine the table where the news data is to be stored, so the table_id value will be passed in together.
[0078] Step S30, determining the field information corresponding to the associated target data field storage table according to the target basic information storage table;
[0079] It should be noted that the field information of the table is created in the s_table_field table. If there are several attributes of the data to be stored, several fields are created. The fields include field name and sort. The field name is used to display the name of the attribute. The sort is used to determine the order of the attributes when displaying data on the page.
[0080] In the specific implementation, the field information of the news data in the s_table_field table is obtained through the table_id in the news data.
[0081] Step S40, inserting a data title into the data record table according to the data to be stored, and generating a data record identifier;
[0082] It should be noted that s_data_record includes: data record id, data name, data category, data table id, data record creation time, and data record update time.
[0083] In the specific implementation, a data entry is inserted into the s_data_record table, the data name (name) field is stored, and the generated data record id (data_record_id) is obtained.
[0084] Step S50, matching the field information with the data value of the data to be stored to obtain the matching data in the data to be stored;
[0085] In the specific implementation, the field information obtained from the s_table_field table is matched with the values in the news JSON data, and the field named "title" is matched with the data with the key "title" in the news JSON data.
[0086] Step S60, storing the data attribute information generated by the matched data and the data record identifier into the target data attribute storage table associated with the target data field storage table, thereby completing the storage of the data to be stored.
[0087] It should be noted that the paired information is inserted into the s_data_property attribute table, and the inserted record includes: the data record id to which the attribute belongs, the field id of the attribute, and the attribute value.
[0088] In the specific implementation, the matched data is added to the data record id (data_record_id), encapsulated into data attribute information, and stored in the s_data_property table.
[0089] The present embodiment provides a data storage method for dynamically creating a table structure, obtaining data to be stored; determining a target basic information storage table based on the data to be stored; determining field information corresponding to an associated target data field storage table according to the target basic information storage table; inserting a data title into a data record table according to the data to be stored to generate a data record identifier; matching the field information with the data value of the data to be stored to obtain matching data in the data to be stored; generating data attribute information from the matching data and the data record identifier and storing it in a target data attribute storage table associated with the target data field storage table to complete the storage of the data to be stored. In applications where a variety of data with different structures need to be stored, storing data will be very convenient.
[0090] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 4 , step S20, the data storage method for dynamically creating a table structure further includes steps S201 to S203:
[0091] Step S201, obtaining target data;
[0092] like Figure 5 As shown, Figure 5 Use a flow chart for your data.
[0093] Step S202, splitting the structure of the target data into preset fields, and creating corresponding data for each field in a data field storage table;
[0094] In a specific implementation, when data with a new structure needs to be stored, the data structure needs to be stored in the s_table_field table, and the data structure needs to be split into fields. Each field needs to create a new data entry in the s_table_field table.
[0095] Furthermore, the storage order of each field is recorded when it is stored, which serves as sorting information during display.
[0096] Step S203: constructing a structural layer of the target data through the data field storage table and the basic information storage table.
[0097] In the specific implementation, the s_table_field table and the s_table table jointly construct the schema layer of this type of data. The s_table_field includes: field id, field name, table id, field sorting, data field creation time, and data field update time.
[0098] The news data structure is stored in the s_table_field table, that is, each field information of the news. Here, six fields need to be newly created: title, author, release time, keywords, summary, and content. Each field data needs to contain table_id. Figure 6 As shown in the figure, in the function of adding a new table, a table named News is added. The structure of the News table includes six fields: title, author, release time, keyword, summary, and content. The order of each field is recorded when it is stored. By adding the function of the new table, the structural construction of the news data is completed.
[0099] The present embodiment provides a data storage method for dynamically creating a table structure to obtain target data; split the structure of the target data into preset fields, and create corresponding data for each field in a data field storage table; record the storage order of the fields when storing each field, which serves as sorting information for display, and jointly construct a structural layer of the target data through the data field storage table and the basic information storage table, and complete the structural construction of the news data through the function of the newly added table.
[0100] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those in the above embodiments can be referred to the above introduction, and will not be described in detail later. Figure 7 , step S60, the data storage method for dynamically creating a table structure further includes steps S601 to S603:
[0101] Step S601, obtaining field information of target data in a data attribute storage table;
[0102] Step S602, matching the field information with the data attribute name stored in the data record table, querying and obtaining the target data;
[0103] It should be noted that the data query function supports name query of data. In this example, the title of the news is queried. The query only needs to query the s_data_record table, enter keywords, and use the name field of the table for matching. All data will be queried, including data with different structures.
[0104] Step S603, obtaining a table title stored in the data record table based on the target data;
[0105] It should be noted that data display is detailed display, which requires displaying all the information of the data. Data display requires passing in data_record_id, which is the data record id of the news.
[0106] Step S604, querying the field information of the target data in the data field storage table based on the table title;
[0107] Step S605, obtaining a data record identifier in a data field storage table based on the target data;
[0108] In the specific implementation, the data record is first queried through data_record_id, and the s_table_id is saved in the data record. Then, the s_table_field table data is queried through s_table_id to obtain all the field information of the news.
[0109] Step S606, querying the data attribute information of the target data in the data attribute storage table through the data record identifier;
[0110] In the specific implementation, the data of the s_data_property table is queried through data_record_id to obtain the data attribute information of the news.
[0111] Step S607, matching the field information of the target data with the data attribute information;
[0112] In the specific implementation, the field information of the news is matched with the attribute information of the news, and the id in the s_table_field table is matched with the field_id in the s_data_property table. The field name and the attribute value are encapsulated during the matching.
[0113] Step S608, obtaining sorting information, and sorting the fields of the target data according to the sorting information, so as to display the target data in the order of the fields.
[0114] In the specific implementation, after all attributes are matched, the sort_num field is used for sorting, so that the attribute values are displayed in the order in which the table fields are created.
[0115] This embodiment provides a data usage method and display method for dynamically creating a table structure. When querying, it is only necessary to query the data in the s_data_record table. The query keyword is queried by matching the value of the data name field. When displaying the data, all field information of the data is queried in the s_table_field table through the data table ID stored in the s_data_record table, that is, table_id; the values of all attributes of the data are queried in the s_data_property table through the data record ID stored in the s_data_record table; the queried field information and attribute values are matched, the attribute values are mapped to the fields, and then the display order of the data fields is sorted according to the sorting information of the fields. Finally, the data is returned and displayed on the page.
[0116] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data storage method of dynamically creating a table structure in the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0117] This application also provides a data storage device for dynamically creating a table structure, please refer to Figure 8 , the data storage device for dynamically creating a table structure includes:
[0118] A data acquisition module 10, used to acquire data to be stored;
[0119] A data processing module 20, used to determine a target basic information storage table based on the data to be stored;
[0120] Determine the field information corresponding to the associated target data field storage table according to the target basic information storage table; insert the data title into the data record table according to the data to be stored, and generate the data record identifier; match the field information with the data value of the data to be stored, and obtain the matching data in the data to be stored;
[0121] The data storage module 30 is used to store the data attribute information generated by the matched data and the data record identifier into the target data attribute storage table associated with the target data field storage table, so as to complete the storage of the data to be stored.
[0122] The data storage device for dynamically creating a table structure provided by the present application adopts the data storage method for dynamically creating a table structure in the above-mentioned embodiment, which can solve the technical problem that multiple data with different structures cannot be stored uniformly in the prior art. Compared with the prior art, the beneficial effects of the data storage device for dynamically creating a table structure provided by the present application are the same as the beneficial effects of the data storage method for dynamically creating a table structure provided by the above-mentioned embodiment, and other technical features of the data storage device for dynamically creating a table structure are the same as the features disclosed in the above-mentioned embodiment method, which will not be described in detail here.
[0123] The present application provides a data storage device for dynamically creating a table structure, and the data storage device for dynamically creating a table structure includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data storage method for dynamically creating a table structure in the above-mentioned embodiment 1.
[0124] Reference below Fig. 9 , which shows a schematic diagram of the structure of a data storage device suitable for implementing the dynamic creation of a table structure in the embodiment of the present application. The data storage device for dynamically creating a table structure in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The data storage device for dynamically creating a table structure shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0125] like Fig. 9As shown, the data storage device for dynamically creating a table structure may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the xxx device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the data storage device of dynamically creating table structures to communicate wirelessly or wired with other devices to exchange data. Although the data storage device of dynamically creating table structures with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0126] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0127] The data storage device for dynamically creating a table structure provided by the present application adopts the data storage method for dynamically creating a table structure in the above embodiment, which can solve the technical problem that multiple data with different structures cannot be stored uniformly in the prior art. Compared with the prior art, the beneficial effects of the data storage device for dynamically creating a table structure provided by the present application are the same as the beneficial effects of the data storage device method for dynamically creating a table structure provided by the above embodiment, and other technical features of the data storage device for dynamically creating a table structure are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0128] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0129] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0130] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data storage method for dynamically creating a table structure in the above-mentioned embodiment.
[0131] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0132] The computer-readable storage medium may be included in a data storage device for dynamically creating a table structure; or may exist independently without being assembled into a data storage device for dynamically creating a table structure.
[0133] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0136] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data storage method for dynamically creating a table structure, and can solve the technical problem that multiple different structure data cannot be uniformly stored in the prior art. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the data storage method for dynamically creating a table structure provided by the above-mentioned embodiment, and will not be repeated here.
[0137] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the data storage method for dynamically creating a table structure as described above.
[0138] The computer program product provided by the present application can solve the technical problem that multiple data with different structures cannot be stored uniformly in the prior art. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the data storage method for dynamically creating a table structure provided by the above embodiment, and will not be repeated here.
[0139] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A data storage method for dynamically creating a table structure, characterized in that: The data storage method for dynamically creating a table structure includes: Get the data to be stored; Determine a target basic information storage table based on the data to be stored; Determine the field information corresponding to the associated target data field storage table according to the target basic information storage table; Inserting a data title into the data record table according to the data to be stored, and generating a data record identifier; Matching the field information with the data value of the data to be stored to obtain matching data in the data to be stored; The data attribute information generated by the matched data and the data record identifier is stored in the target data attribute storage table associated with the target data field storage table, thereby completing the storage of the data to be stored.
2. The data storage method for dynamically creating a table structure according to claim 1, characterized in that: After the step of determining the target basic information storage table based on the data to be stored, the method further includes: Acquire a table title based on the data to be stored; An item table is created in the data record table based on the table title for storing the table title.
3. The data storage method for dynamically creating a table structure according to claim 1, characterized in that: Before the step of obtaining the data to be stored, the method further includes: A plurality of basic information storage tables, a data field storage table associated with the basic information storage table, a plurality of data record tables and a data attribute storage table associated with the data record table are created.
4. The data storage method for dynamically creating a table structure according to claim 1, characterized in that: After the step of determining the target basic information storage table based on the data to be stored, the method further includes: Get target data; Splitting the structure of the target data into preset fields, and creating corresponding data for each field in a data field storage table; The structural layer of the target data is constructed by the data field storage table and the basic information storage table.
5. The data storage method for dynamically creating a table structure as claimed in claim 4, characterized in that: The step of splitting the structure of the target data into preset fields and creating corresponding data for each field in the data field storage table also includes: The storage order of each field is recorded when it is stored, which serves as sorting information for display.
6. The data storage method for dynamically creating a table structure according to claim 1, characterized in that: After completing the step of storing the data to be stored, the method further includes: Obtain the field information of the target data in the data attribute storage table; The target data is obtained by querying based on matching the field information with the data attribute name stored in the data record table.
7. The data storage method for dynamically creating a table structure according to claim 6, characterized in that: After the step of obtaining the target data, the method further includes: Obtaining a table title stored in a data record table based on target data; Based on the table title, query the field information of the target data in the data field storage table; Acquire a data record identifier in the data field storage table based on the target data; Querying the data attribute information of the target data in the data attribute storage table through the data record identifier; Matching the field information and data attribute information of the target data; Sorting information is obtained, and the fields of the target data are sorted according to the sorting information, so as to display the target data in the order of the fields.
8. A data storage device for dynamically creating a table structure, characterized in that: The device comprises: A data acquisition module, used to acquire data to be stored; A data processing module, used for determining a target basic information storage table based on the data to be stored; Determine the field information corresponding to the associated target data field storage table according to the target basic information storage table; insert a data title into the data record table according to the data to be stored to generate a data record identifier; match the field information with the data value of the data to be stored to obtain the matching data in the data to be stored; The data storage module is used to store the matched data and the data record identifier to generate data attribute information into the target data attribute storage table associated with the target data field storage table to complete the storage of the data to be stored.
9. A data storage device for dynamically creating a table structure, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data storage method for dynamically creating a table structure according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data storage method for dynamically creating a table structure according to any one of claims 1 to 7 are implemented.
