Data table generation method and device
Through custom templates and automated analysis technology, data tables of different storage engines are generated, which solves the problem of inefficient data table creation in data warehouse development, improves work efficiency and reduces learning costs.
Patent Information
- Application Number
- CN202310631813.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2024-12-03
AI Technical Summary
In data warehouse development, creating data tables that store results requires developers to manually write scripts, resulting in inefficiency and high learning costs for table building syntax specifications for different storage engines, especially when there are many fields, the workload increases and the cost of mechanized tasks is spent. More time.
Provide a data table generation method and device, which quickly generates data tables for designated storage engines through custom templates, automatically parsing input information to generate table construction statements, simplifying the development process and reducing the learning cost of table construction syntax specifications for different storage engines.
It realizes the rapid generation of data tables based on custom templates, automatic parsing of field information, simplifies the development process, improves work efficiency, and reduces the learning cost of table building syntax specifications for different storage engines.
Smart Images

Figure CN119066062A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating a data table. Background Art
[0002] In the data warehouse development work, the results of model indicators are all in the form of "tables". For the development of new model indicators, in order to avoid multiple changes or additions and deletions in the field structure of the result table due to the uncertainty of the intermediate process during the development process, the actual development process is often to complete the development and debugging of the indicator field processing logic according to business needs before creating the final result table. In addition, for each model indicator in the data warehouse, the business system using the model often needs to push the data from the data warehouse to the storage accessible to the business system (such as Mysql, Elasticsearch, HBASE, Redis, etc.) before accessing it. When pushing data from the data warehouse to other storage engines, you must first establish the "table" required for storage in the corresponding storage engine (the storage carrier names of different storage systems are different, and the present invention uniformly refers to them as data tables).
[0003] In the process of implementing the present invention, it is found that currently creating a data table for storing results must be completed by a developer in a hard-coded manner. Under different business scenario requirements, different scripts must be written to achieve the purpose, which is not convenient and efficient enough. In particular, when there are many fields in the table, the required workload will also increase, and it will take more time to complete more mechanical tasks, resulting in low work efficiency. In addition, developers are also required to be familiar with the table building syntax specifications of various storage engines, and the learning cost is high. Summary of the invention
[0004] In view of this, the embodiment of the present invention provides a data table generation method and device, which can quickly generate a data table of a specified storage engine category according to a custom template, and can automatically parse the input information to obtain each field information for different storage engines, and then combine the preset template information to generate a table creation statement for the corresponding storage engine with one click. The template can be configured once and reused, and field information can be input quickly, which simplifies the development process and improves work efficiency, and reduces the learning cost of different storage engine table creation syntax specifications.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for generating a data table is provided, comprising:
[0006] In response to a data table generation request, obtaining input information and storage carrier elements corresponding to the data table to be generated, wherein the storage carrier elements include a storage engine type;
[0007] Obtain a corresponding data table object template according to the storage engine type;
[0008] Parsing the input information to obtain data field information of the data table to be generated;
[0009] Generate a table creation statement according to the storage carrier element, the data table object template and the data field information, and use the table creation statement to generate a data table.
[0010] Optionally, parsing the input information to obtain data field information of the data table to be generated includes: determining a regular expression according to a data format corresponding to the input information, and using the regular expression to match the input information line by line to obtain the data field information of the data table to be generated.
[0011] Optionally, the data format corresponding to the input information is determined according to the value of a data format keyword, and the data format keyword includes: a field name keyword, a field type keyword, and a field comment keyword.
[0012] Optionally, after parsing the input information to obtain data field information of the data table to be generated, the method further includes: displaying the parsed data field information in a table through a page so that the user can perform partial correction on the data field information.
[0013] Optionally, the data table object template is generated in the following manner: obtaining the data table object syntax specification corresponding to each storage engine respectively; for each storage engine, using placeholders to pre-reserve the positions in the data table object syntax specification that need to be filled with content according to actual usage scenarios, to obtain the data table object template corresponding to the storage engine.
[0014] Optionally, generating a table creation statement according to the storage carrier element, the data table object template and the data field information includes: replacing placeholders in the data table object template according to the storage carrier element and the data field information to generate a table creation statement.
[0015] Optionally, the placeholder includes a storage carrier element placeholder and a data field placeholder; and according to the storage carrier element and the data field information, the placeholder in the data table object template is replaced, including: replacing the storage carrier element placeholder in the data table object template according to the storage carrier element, and replacing the data field placeholder in the data table object template according to the data field information.
[0016] Optionally, the placeholders include keyword format placeholders and content format placeholders; and according to the storage carrier elements and the data field information, the placeholders in the data table object template are replaced, including: according to the storage carrier elements and the data field information, the keyword format placeholders are replaced by keyword matching; according to the storage carrier elements and the data field information, the data corresponding to the content format placeholders are generated, and the content format placeholders are replaced with the data corresponding to the content format placeholders.
[0017] According to another aspect of an embodiment of the present invention, there is provided a device for generating a data table, comprising:
[0018] A data acquisition module, configured to acquire input information and storage carrier elements corresponding to the data table to be generated in response to a data table generation request, wherein the storage carrier elements include a storage engine type;
[0019] A template acquisition module, used to acquire a corresponding data table object template according to the storage engine type;
[0020] A field parsing module, used for parsing the input information to obtain data field information of the data table to be generated;
[0021] The data table generation module is used to generate a table creation statement according to the storage carrier element, the data table object template and the data field information, and use the table creation statement to generate a data table.
[0022] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a data table provided in an embodiment of the present invention.
[0023] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for generating a data table provided in the embodiments of the present invention is implemented.
[0024] An embodiment of the above invention has the following advantages or beneficial effects: by responding to a data table generation request, obtaining the input information and storage carrier elements corresponding to the data table to be generated, the storage carrier elements include the storage engine type; obtaining the corresponding data table object template according to the storage engine type; parsing the input information to obtain the data field information of the data table to be generated; generating a table creation statement according to the storage carrier elements, the data table object template and the data field information, and using the table creation statement to generate the data table. The technical solution realizes the rapid generation of a data table of a specified storage engine category according to a custom template, and can automatically parse the input information for different storage engines to obtain each field information, and then combine the preset template information to generate the table creation statement of the corresponding storage engine with one click. The template is configured once and reused, and field information is quickly input, which simplifies the development process and improves work efficiency, and reduces the learning cost of different storage engine table creation syntax specifications.
[0025] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0027] Figure 1 is a schematic diagram of main steps of a method for generating a data table according to an embodiment of the present invention;
[0028] Figure 2 It is a schematic diagram of a data table generation process according to an embodiment of the present invention;
[0029] Figure 3 is a schematic diagram of main modules of a device for generating a data table according to an embodiment of the present invention;
[0030] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0031] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0033] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution disclosed in the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0034] In the introduction of the embodiments of the present invention, the professional terms and their definitions are as follows:
[0035] Schema: It is a recommended standard originally issued by W3C in May 2001, which points out how to describe the elements of XML documents in a formal manner. The schema in the present invention refers to the general term for describing the organizational structure and field information of a data table, and is referred to as a "data table object" in the description of the embodiment;
[0036] Hive: A data warehouse tool based on Hadoop, used for data extraction, transformation, and loading. It is a mechanism for storing, querying, and analyzing large-scale data stored in Hadoop.
[0037] Elasticsearch: It is a distributed, highly scalable, and highly real-time search and data analysis engine. Before searching and analyzing data, the data must first be submitted to the Elasticsearch database;
[0038] Paradigm: A database term that refers to a set of relational patterns that conform to a certain level. The construction of a database must follow certain rules. In a relational database, this rule is the paradigm;
[0039] JSON: JavaScript Object Notation, JS object notation, is a lightweight data exchange format;
[0040] DDL: Data Definition Language, database schema definition language, is a language used to describe real-world entities to be stored in the database.
[0041] In order to solve the problems existing in the prior art, the present invention provides a method for generating a data table, which can automatically parse the quickly input field column information to obtain each field information for different storage engines, and then generate the "table" statement of the corresponding storage engine in one click in combination with the preset template information. The template can be configured and reused once, field information can be input quickly, the development process can be simplified to improve work efficiency, and the learning cost of the syntax specifications for building tables for different storage engines can be reduced. As a complete independent function, the present invention enables developers to focus on the definition of template paradigms and data table object (schema) templates of the same engine when facing different storage engines. The background automatically completes the output of schema results corresponding to different input information according to the specified template information. At the same time, the schema template is highly reusable for the same engine, and one-time definition and reuse are achieved.
[0042] Figure 1 FIG. 1 is a schematic diagram of the main steps of the method for generating a data table according to an embodiment of the present invention. Figure 1 As shown, the method for generating a data table in the embodiment of the present invention mainly includes the following steps S101 to S104.
[0043] Step S101: In response to a data table generation request, input information and storage carrier elements corresponding to the data table to be generated are obtained, wherein the storage carrier elements include a storage engine type.
[0044] In the present invention, the template paradigm is used to shield the table creation specification details between different storage engines. Regardless of the storage engine executed, the indispensable elements of the storage carrier are: namespace, unique carrier name and data type. Taking the Mysql database as an example, the namespace is represented by the database, and the carrier name is represented by the unique table name under the database. The present invention is not limited to a specific storage engine, therefore, the storage engine type is also one of the indispensable elements, that is, the storage carrier elements of the present invention include: namespace, carrier name, data type and storage engine type. In addition, during implementation, according to different scenarios, the storage carrier elements may also include annotation information, the expression form of scheme statements and other information.
[0045] In addition, when a data table generation request is received, a storage carrier element can be obtained from it, and then the storage carrier element is represented or defined by the following rule g:
[0046] Engine.NameSpace.Table[defaultDateType[DataType,...],DateFor mat,Comment].
[0047] In the above rule g, DataFormat indicates the representation of the schema statement. The schema representation of the SQL storage engine is defined with the keyword DDL, the schema representation of the Json storage engine is defined with the keyword JSON, and so on. Comment indicates whether the field needs comment information, which is defined with TRUE and FALSE.
[0048] When using, the model paradigm is defined according to rule g. In order to avoid repeated definition of the paradigm when using it multiple times, the defined paradigm is saved in the metadata database MySQL of this system for quick selection when it is reused. At the same time, the defined template paradigm is supported to provide the function of sharing and publishing, further reducing the waste of resources caused by repeated definition work.
[0049] Specifically, in one embodiment of the present invention, assuming that data is to be pushed or saved to the ElasticSearch storage engine, the target index is index_tmp, the doc is doc_tmp, the default data type is keyword, the data types involved in the table are keyword and integer, and the data format is json, then the defined template paradigm is:
[0050] elasticsearch.index_tmp.doc_tmp[keyword[keyword,integer],json].
[0051] By using the template paradigm to represent storage carrier elements, the corresponding storage carrier elements can be easily obtained when generating table creation statements later.
[0052] Step S102: Obtain a corresponding data table object template according to the storage engine type.
[0053] According to one embodiment of the present invention, the data table object template is generated in the following manner: respectively obtaining the data table object syntax specification corresponding to each storage engine; for each storage engine, using placeholders to pre-occupy the positions in the data table object syntax specification that need to be filled with content according to the actual usage scenario, to obtain the data table object template corresponding to the storage engine.
[0054] Since the schema syntax specifications of data tables in different storage engines are not the same, it is necessary to pre-set the corresponding schema syntax specifications in the system, and support any storage engine by supporting the addition of custom schema syntax specifications. After obtaining the corresponding syntax specifications, placeholders are used to pre-fill the positions in the syntax specifications that need to be filled in according to the actual usage scenario. Thus, the data table object schema template of the corresponding storage engine is obtained. Here, the placeholders can include, for example, keyword format placeholders ({{KEY}} format placeholders) and content format placeholders ([[content]] format placeholders).
[0055] Step S103: Parse the input information to obtain data field information of the data table to be generated. In an embodiment of the present invention, the input information may be, for example, the following two situations: one is a SQL script for data processing (usually an insert into select type of SQL), and the other is data in an existing data table (e.g., a hive table) in a data warehouse.
[0056] When the input information is an SQL script for data processing, the SQL script contains complete field information of the result table, such as the contents of the select to from parts shown in the code in Table 1 below. At this time, this part of the text is directly parsed as input information to obtain the data field information of the data table to be generated.
[0057] Table 1
[0058]
[0059] When the input information is data from an existing data table in the data warehouse, the field information in the data table can be obtained by, for example, viewing the table structure of the existing data table. There may be many ways to view the data table structure, but the obtained field information is generally as shown in Table 2 below. At this time, this part of the text is directly parsed as input information to obtain the data field information of the data table to be generated.
[0060] Table 2
[0061]
[0062] According to an embodiment of the present invention, parsing the input information to obtain data field information of the data table to be generated may specifically include: determining a regular expression according to a data format corresponding to the input information, and using the regular expression to match the input information line by line to obtain data field information of the data table to be generated. Specifically, the data format corresponding to the input information is determined according to the value of a data format keyword, and the data format keyword includes: a field name keyword, a field type keyword, and a field comment keyword.
[0063] In actual use, the format of input information may be varied, but no matter what storage engine is used, the information elements of the field mainly include three types: field name, field type and field comment, where comment is optional. The problem of different input formats is solved by using template paradigm keywords. Therefore, in an embodiment of the present invention, the data format keywords are defined to include field name keywords, field type keywords and field comment keywords. The field name keyword is defined as CN, the field type keyword is defined as CT, and the field comment keyword is defined as CC. Because there may be a situation where the information elements of the field are missing, the missing situation is indicated by adding [0 / 1] after the keyword, such as CC[0] indicating that the field comment keyword CC is partially included (partially missing), and CC[1] indicates that it must be included. The input information will include the values (0 or 1) corresponding to each data format keyword or provide data samples for parsing and generating regular expressions, and the three elements (field name, field type, field comment) contained in the parsing result of the input information can also be encapsulated. Among them, the data sample does not need to pay attention to the blank characters between the data grids, and when the input data length is inconsistent, the data sample is defined according to the longest data.
[0064] Parse the input information with the help of regular parsing. The specific steps are as follows:
[0065] For the input information given in Table 1, assuming that the format of the given data sample is "as CN[1]--CC[0]", the keywords of the given data sample are parsed to obtain the input information including the field name and some existing field comment information. The regular expression generated is: (.+)\s+as\s+--\s+(.*), and then the input information is processed row by row, and the values in the first bracket and the second bracket are extracted as the field name and field comment. Since SQL does not contain field type information, all field types are set to the model data type given in the template paradigm definition, and the results are encapsulated.
[0066] For the input information given in Table 2, the table structure information obtained by different methods may have differences in order and number of results. Therefore, it is necessary to define the input order and quantity information when inputting information. The given data sample format is "CN[1]CT[1]CC[1]", and the generated regular expression is: (.+)\s+([a-zA-Z]+)\s+(.+), which is matched line by line, and the text in the first bracket, the second bracket, and the third bracket is extracted as the field name, field type, and field comment, and the result is encapsulated.
[0067] According to one embodiment of the present invention, after the input information is parsed to obtain the data field information of the data table to be generated, the parsed data field information can also be displayed in a table through a page, so that the user can make partial corrections to the data field information. After all the input information is parsed, in order to make the results accurate, the results are listed in a table through a web page for the user to make partial corrections to the fields. The field type information uses the type value given in the template paradigm to fill in the drop-down box option drop-down option, which is displayed in a drop-down box format, which is convenient for the user to modify and provide user-friendly operation, which serves as a functional enhancement. Finally, the automatically parsed data is replaced with the corrected data.
[0068] Step S104: Generate a table creation statement according to the storage carrier element, the data table object template and the data field information, and use the table creation statement to generate a data table.
[0069] According to one embodiment of the present invention, generating a table creation statement based on the storage carrier element, the data table object template and the data field information may specifically include: replacing the placeholders in the data table object template based on the storage carrier element and the data field information to generate a table creation statement.
[0070] In a specific embodiment of the present invention, the placeholders are classified according to the content corresponding to them, and include storage carrier element placeholders and data field placeholders. Replacing the placeholders in the data table object template according to the storage carrier element and the data field information includes: replacing the storage carrier element placeholder in the data table object template according to the storage carrier element, and replacing the data field placeholder in the data table object template according to the data field information.
[0071] In another specific embodiment of the present invention, the placeholders are classified according to the formats corresponding to the placeholders, and include keyword format placeholders and content format placeholders. Among them, the keyword format placeholder is a {{KEY}} format placeholder, that is, a placeholder represented by "{{}}", and the content format placeholder is a "[[content]]" format placeholder, that is, a placeholder represented by "[[]]". The content format placeholders may also include some keyword format placeholders. Replacing the placeholders in the data table object template according to the storage carrier elements and the data field information may include: replacing the keyword format placeholder by keyword matching according to the storage carrier elements and the data field information; generating data corresponding to the content format placeholder according to the storage carrier elements and the data field information, and replacing the content format placeholder with the data corresponding to the content format placeholder. Specifically, for the {{KEY}} format placeholder, the corresponding value is matched directly from the storage carrier element and data field information through keyword matching, and then directly replaced; for the [[content]] format placeholder, it represents the field iteration part, and the {{KEY}} placeholder existing in the [[content]] content is also directly matched and replaced. For the content other than {{key}} in the [[content]] content, it remains unchanged, and is appended at the end according to the actual field content iteration. The element connector (comma) in the [[content]] content at the end is not retained, and the [[content]] content can be generated. Then the [[content]] content can be used to replace the [[content]] format placeholder in the template.
[0072] After replacing all placeholders in the data table object template, you can generate a table creation statement, and then use the table creation statement to generate a data table. It is possible to quickly generate a data table of a specified storage engine category based on a custom template. For different storage engines, it can automatically parse the input information to obtain each field information, and then combine the preset template information to generate the corresponding storage engine's "table" creation statement with one click. It realizes one-time configuration and reuse of templates, fast field information input, simplifies the development process, improves work efficiency, and reduces the learning cost of different storage engine table creation syntax specifications.
[0073] In the embodiment of the present invention, the above-mentioned step S102 and step S103 may be executed simultaneously or sequentially, and the sequence between the two steps is not fixed.
[0074] Figure 2 FIG. 1 is a schematic diagram of a data table generation process according to an embodiment of the present invention. Figure 2As shown, in an embodiment of the present invention, when generating a data table, first obtain the front-end information input by the user; parse the front-end information to obtain data field information, and perform model paradigm processing on the front-end information to obtain storage carrier elements, which include storage engine types; then obtain the corresponding data table object template according to the storage engine type; thereafter, generate a data table by combining the storage carrier elements, the data table object template and the data field information.
[0075] Figure 3 Schematic diagram of the main modules of the device for generating a data table according to an embodiment of the present invention. Figure 3 As shown, the data table generation device 300 of the embodiment of the present invention mainly includes:
[0076] The data acquisition module 301 is used to obtain input information and storage carrier elements corresponding to the data table to be generated in response to the data table generation request, wherein the storage carrier elements include a storage engine type;
[0077] The template acquisition module 302 is used to acquire the corresponding data table object template according to the storage engine type;
[0078] A field parsing module 303 is used to parse the input information to obtain data field information of the data table to be generated;
[0079] The data table generating module 304 is used to generate a table building statement according to the storage carrier element, the data table object template and the data field information, and use the table building statement to generate a data table.
[0080] According to an embodiment of the present invention, the field parsing module 303 may also be used to: determine a regular expression according to a data format corresponding to the input information, and use the regular expression to match the input information line by line to obtain data field information of the data table to be generated.
[0081] According to another embodiment of the present invention, the data format corresponding to the input information is determined according to the value of a data format keyword, and the data format keyword includes: a field name keyword, a field type keyword, and a field comment keyword.
[0082] According to another embodiment of the present invention, the data table generating device 300 may further include a field correction module (not shown in the figure), which is used for: after parsing the input information to obtain the data field information of the data table to be generated, displaying the parsed data field information in a tabular form through a page, so that the user can perform local correction on the data field information.
[0083] According to another embodiment of the present invention, the data table object template is generated in the following manner: respectively obtaining the data table object syntax specification corresponding to each storage engine; for each storage engine, using placeholders to pre-reserve the positions in the data table object syntax specification that need to be filled with content according to actual usage scenarios, to obtain the data table object template corresponding to the storage engine.
[0084] According to another embodiment of the present invention, the data table generation module 304 may also be used to replace the placeholders in the data table object template according to the storage carrier element and the data field information to generate a table creation statement.
[0085] According to another embodiment of the present invention, the placeholder includes a storage carrier element placeholder and a data field placeholder; the data table generation module 304 can also be used to: replace the storage carrier element placeholder in the data table object template according to the storage carrier element, and replace the data field placeholder in the data table object template according to the data field information.
[0086] According to another embodiment of the present invention, the placeholder includes a keyword format placeholder and a content format placeholder; the data table generation module 304 can also be used to: replace the keyword format placeholder by keyword matching according to the storage carrier element and the data field information; generate data corresponding to the content format placeholder according to the storage carrier element and the data field information, and replace the content format placeholder with the data corresponding to the content format placeholder.
[0087] According to the technical solution of the embodiment of the present invention, by responding to a data table generation request, the input information and storage carrier elements corresponding to the data table to be generated are obtained, and the storage carrier elements include the storage engine type; the corresponding data table object template is obtained according to the storage engine type; the input information is parsed to obtain the data field information of the data table to be generated; a table creation statement is generated according to the storage carrier elements, the data table object template and the data field information, and the technical solution of using the table creation statement to generate the data table is realized. The data table of the specified storage engine category is quickly generated according to the custom template. For different storage engines, each field information can be automatically parsed according to the input information, and then the table creation statement of the corresponding storage engine is generated with one click in combination with the preset template information. The template is configured once and reused, and field information is quickly input, which simplifies the development process and improves work efficiency, and reduces the learning cost of the syntax specifications for table creation of different storage engines.
[0088] Figure 4 An exemplary system architecture 400 is shown to which the method for generating a data table or the apparatus for generating a data table according to the embodiment of the present invention can be applied.
[0089] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0090] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Terminal devices 401, 402, 403 can be installed with various communication client applications, such as database applications, data table applications, search applications, data management software, etc. (only examples).
[0091] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0092] The server 405 may be a server that provides various services, such as a background management server that provides support for websites browsed by users using terminal devices 401, 402, and 403 (only as an example). The background management server may respond to the data table generation request and other data received, obtain input information and storage carrier elements corresponding to the data table to be generated, the storage carrier elements including the storage engine type; obtain the corresponding data table object template according to the storage engine type; parse the input information to obtain data field information of the data table to be generated; generate a table creation statement according to the storage carrier elements, the data table object template and the data field information, and use the table creation statement to generate a data table, etc., and feed back the processing result (such as the generated data table - only as an example) to the terminal device.
[0093] It should be noted that the method for generating a data table provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device for generating a data table is generally disposed in the server 405 .
[0094] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0095] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 5The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0096] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0097] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0098] In particular, according to the embodiments disclosed in the present invention, 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 invention 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 the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0099] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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 the present invention, a 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, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0100] 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 invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 box can also occur in a different order from the order marked in the accompanying drawings. For example, two 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 box in the block diagram or flow chart, and the combination of the boxes in the block diagram 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.
[0101] The units or modules involved in the embodiments of the present invention may be implemented in software or hardware. The units or modules described may also be provided in a processor, for example, may be described as: a processor including a data acquisition module, a template acquisition module, a field parsing module, and a data table generation module. The names of these units or modules do not, in certain cases, constitute limitations on the units or modules themselves, for example, a field parsing module may also be described as "a module for parsing the input information to obtain data field information of a data table to be generated".
[0102] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: in response to a data table generation request, obtaining input information and storage carrier elements corresponding to the data table to be generated, the storage carrier elements including a storage engine type; obtaining a corresponding data table object template according to the storage engine type; parsing the input information to obtain data field information of the data table to be generated; generating a table creation statement according to the storage carrier elements, the data table object template and the data field information, and using the table creation statement to generate a data table.
[0103] According to the technical solution of the embodiment of the present invention, by responding to a data table generation request, the input information and storage carrier elements corresponding to the data table to be generated are obtained, and the storage carrier elements include the storage engine type; the corresponding data table object template is obtained according to the storage engine type; the input information is parsed to obtain the data field information of the data table to be generated; a table creation statement is generated according to the storage carrier elements, the data table object template and the data field information, and the technical solution of using the table creation statement to generate the data table is realized. The data table of the specified storage engine category is quickly generated according to the custom template. For different storage engines, each field information can be automatically parsed according to the input information, and then the table creation statement of the corresponding storage engine is generated with one click in combination with the preset template information. The template is configured once and reused, and field information is quickly input, which simplifies the development process and improves work efficiency, and reduces the learning cost of the syntax specifications for table creation of different storage engines.
[0104] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating a data table, characterized in that: include: In response to a data table generation request, obtaining input information and storage carrier elements corresponding to the data table to be generated, wherein the storage carrier elements include a storage engine type; Obtain a corresponding data table object template according to the storage engine type; Parsing the input information to obtain data field information of the data table to be generated; Generate a table creation statement according to the storage carrier element, the data table object template and the data field information, and use the table creation statement to generate a data table.
2. The method according to claim 1, characterized in that Parsing the input information to obtain data field information of the data table to be generated includes: A regular expression is determined according to a data format corresponding to the input information, and the input information is matched line by line using the regular expression to obtain data field information of a data table to be generated.
3. The method according to claim 2, characterized in that The data format corresponding to the input information is determined according to the value of a data format keyword, and the data format keyword includes: a field name keyword, a field type keyword, and a field comment keyword.
4. The method according to claim 1, characterized in that: After parsing the input information to obtain data field information of the data table to be generated, the method further includes: The data field information obtained through the analysis is displayed in a table through the page, so that the user can perform local correction on the data field information.
5. The method according to claim 1, characterized in that The data table object template is generated in the following way: Get the data table object syntax specification corresponding to each storage engine respectively; For each storage engine, a placeholder is used to pre-occupy the position in the data table object syntax specification that needs to be filled with content according to the actual usage scenario, so as to obtain a data table object template corresponding to the storage engine.
6. The method according to claim 1 or 5, characterized in that: Generating a table creation statement according to the storage carrier element, the data table object template and the data field information includes: According to the storage carrier element and the data field information, the placeholders in the data table object template are replaced to generate a table creation statement.
7. The method according to claim 6, characterized in that The placeholders include storage carrier element placeholders and data field placeholders; Replacing the placeholder in the data table object template according to the storage carrier element and the data field information includes: The storage carrier element placeholder in the data table object template is replaced according to the storage carrier element, and the data field placeholder in the data table object template is replaced according to the data field information.
8. The method according to claim 6, characterized in that The placeholders include keyword format placeholders and content format placeholders; Replacing the placeholder in the data table object template according to the storage carrier element and the data field information includes: According to the storage carrier element and the data field information, the keyword format placeholder is replaced by keyword matching; The data corresponding to the content format placeholder is generated according to the storage carrier element and the data field information, and the content format placeholder is replaced with the data corresponding to the content format placeholder.
9. A data table generating device, characterized in that: include: A data acquisition module, configured to acquire input information and storage carrier elements corresponding to the data table to be generated in response to a data table generation request, wherein the storage carrier elements include a storage engine type; A template acquisition module, used to acquire a corresponding data table object template according to the storage engine type; A field parsing module, used for parsing the input information to obtain data field information of the data table to be generated; The data table generation module is used to generate a table creation statement according to the storage carrier element, the data table object template and the data field information, and use the table creation statement to generate a data table.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
