CN113138996A - Statement generation method and device - Google Patents

Statement generation method and device Download PDF

Info

Publication number
CN113138996A
CN113138996A CN202010048535.1A CN202010048535A CN113138996A CN 113138996 A CN113138996 A CN 113138996A CN 202010048535 A CN202010048535 A CN 202010048535A CN 113138996 A CN113138996 A CN 113138996A
Authority
CN
China
Prior art keywords
graph
function
data table
field
function graph
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010048535.1A
Other languages
Chinese (zh)
Inventor
陆梓瀚
晏鹏
钟权伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010048535.1A priority Critical patent/CN113138996A/en
Publication of CN113138996A publication Critical patent/CN113138996A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/26Visual data mining; Browsing structured data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application discloses a statement generation method and device, and belongs to the technical field of computers. The method comprises the following steps: generating an interface based on the statement, and providing at least one data table identifier and at least one function identifier; responding to the selection operation of the provided at least two identifications, and displaying at least two graphs corresponding to the at least two identifications respectively in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph; determining a directed line between at least two graphs in a target area to obtain a data flow graph, wherein the directed line indicates the data flow direction between the at least two graphs; and mapping the data flow graph to obtain a Structured Query Language (SQL) statement corresponding to the data flow graph, so that the SQL statement generation speed is increased, and the development efficiency is improved.

Description

Statement generation method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a statement generation method and apparatus.
Background
SQL (Structured Query Language) is a programming Language, and SQL statements are used to manage a database system, by which various operations can be performed on the database system, such as querying data in the database system, adding data, modifying data, deleting data, and the like.
The existing SQL statements are written by technicians responsible for development one by one, the technicians need to write a large number of SQL statements to meet the requirements of operations of querying data, adding data, modifying data, deleting data and the like, the consumed labor cost and time cost are high, and the development efficiency is low.
Disclosure of Invention
The embodiment of the application provides a statement generation method, a statement generation device, equipment and a storage medium, and the development efficiency of SQL statements can be improved. The technical scheme is as follows:
in one aspect, a statement generation method is provided, and the method includes:
generating an interface based on the statement, and providing at least one data table identifier and at least one function identifier;
responding to selection operation of at least two provided identifications, and displaying at least two graphs respectively corresponding to the at least two identifications in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph;
determining a directed line between the at least two graphs in the target area to obtain a data flow graph, wherein the directed line indicates the data flow direction between the at least two graphs;
and mapping the data flow graph to obtain a Structured Query Language (SQL) statement corresponding to the data flow graph.
In one possible implementation, after the constructing a connection between the first field graph and the second field graph, and the connection points to the second field graph, the method further includes:
in response to a rename operation on the second field graphic, changing a field identification of the second field graphic.
In one possible implementation, the statement generation interface is provided with a data table addition option, and the method further includes:
responding to the trigger operation of adding options to the data table, acquiring the input data table, and storing the data table, wherein the data table at least comprises a data table identifier.
In another aspect, a sentence generation apparatus is provided, the apparatus including:
the display module is used for generating an interface based on the statement and providing at least one data table identifier and at least one function identifier;
the display module is used for responding to selection operation of the provided at least two identifications, and displaying at least two graphs respectively corresponding to the at least two identifications in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph;
a determining module, configured to determine a directed line between the at least two graphs in the target region to obtain a dataflow graph, where the directed line indicates a data flow direction between the at least two graphs;
and the mapping processing module is used for mapping the data flow graph to obtain a Structured Query Language (SQL) statement corresponding to the data flow graph.
In one possible implementation manner, the determining module is configured to construct a connection line between the first data table graph and the first function graph in response to an operation of dragging the first data table graph to the first function graph, where the connection line points to the first function graph.
In one possible implementation, the determining module is configured to perform at least one of:
responding to an operation of dragging a first field graph in the first data table graph to the first function graph, adding a second field graph in the function graph, and constructing a connecting line between the first field graph and the second field graph, wherein the connecting line points to the second field graph, and the first field graph and the second field graph correspond to the same field in the first data table;
and in response to the operation of dragging the identification graph in the first data table graph to the first function graph, constructing a connecting line between the first data table graph and the first function graph, wherein the connecting line points to the function graph, and the identification graph corresponds to the data table identification of the first data table.
In one possible implementation, the apparatus further includes:
a change module for changing the field identification of the second field graphic in response to a renaming operation for the second field graphic.
In a possible implementation manner, the determining module is configured to construct a connection line between a second function graph and a third function graph in response to an operation of dragging the second function graph to the third function graph, and the connection line points to the second function graph.
In one possible implementation, the determining module is configured to perform at least one of:
in response to an operation of dragging a third field graph in the second function graph to the third function graph, constructing a connecting line between the third field graph and the third function graph, wherein the connecting line points to the third function graph;
responding to an operation of dragging a third field graph in the second function graph to the third function graph, adding a fourth field graph in the third function graph, and constructing a connecting line between the third field graph and the fourth field graph, wherein the connecting line points to the fourth field graph, and the third field graph and the fourth field graph correspond to the same field.
In one possible implementation, the display module includes:
the device comprises an acquisition unit, a selection unit and a display unit, wherein the acquisition unit is used for responding to the selection operation of any data table identifier and acquiring at least one field in a data table corresponding to the data table identifier;
the generating unit is used for generating a data table graph according to the data table identifier and the at least one field, wherein the data table graph comprises an identifier graph corresponding to the data table identifier and a field graph corresponding to the at least one field;
and the display unit is used for displaying the data table graph in the target area.
In one possible implementation, the apparatus further includes:
and the storage module is used for responding to the trigger operation of adding options to the data table, acquiring the input data table, and storing the data table, wherein the data table at least comprises a data table identifier.
In one possible implementation, the mapping processing module includes:
the acquiring unit is used for acquiring the SQL sentences corresponding to each function graph according to the function identifications corresponding to each function graph in the data flow graph and the mapping relation between the function identifications and the SQL sentences;
and the nesting unit is used for nesting the SQL statement corresponding to each function graph according to other graphs connected with each function graph in the data flow graph to obtain the SQL statement corresponding to the data flow graph.
In one possible implementation, the nesting unit is configured to perform at least one of:
if a fourth function graph is connected with a fifth function graph and a connecting line between the fourth function graph and the fifth function graph points to the fifth function graph, embedding the SQL statement corresponding to the fourth function identifier into the SQL statement corresponding to the fifth function graph for nesting;
if a fifth field graph in a second data table graph is connected with a sixth function graph and a connecting line between the fifth field graph and the sixth function graph points to the sixth function graph, adding a field corresponding to the fifth field graph into an SQL statement corresponding to the sixth function graph;
and if the identification graph in the third data table graph is connected with a seventh function graph and the connecting line between the identification graph and the seventh function graph points to the seventh function graph, adding the data table identification corresponding to the identification graph into the SQL sentence corresponding to the seventh function graph.
In one possible implementation, the statement generation interface is provided with a function addition option, and the apparatus further includes:
the acquisition module is used for responding to the triggering operation of the function adding option and acquiring the input function identifier and the code statement corresponding to the function identifier;
and the storage module is used for storing the mapping relation between the function identifier and the code statement.
In one possible implementation, the function includes a component function and an operator function, and the determining module is configured to perform at least one of:
in response to the operation of dragging the component function graph corresponding to the component function identifier to the operator function graph corresponding to the operator function identifier, constructing a connecting line between the component function graph and the operator function graph, wherein the connecting line points to the operator function graph;
and in response to the operation of dragging the operator function graph corresponding to the operator function identifier to the component function graph corresponding to the component function identifier, constructing a connecting line between the operator function graph and the component function graph, wherein the connecting line points to the component function graph.
In a possible implementation manner, the determining module is further configured to, in response to an operation of dragging a sixth field graph in the component function graph to the operator function graph, construct a connection line between the sixth field graph and the operator function graph, where the connection line points to the operator function graph;
the determining module is further configured to add a seventh field graph in the component function graph in response to an operation of dragging the operator function graph to the component function graph, and construct a connection line between the operator function graph and the seventh field graph, where the connection line points to the seventh field graph, and the seventh field graph and an eighth field graph connected to the operator graph correspond to the same field.
In one possible implementation, the apparatus further includes:
the display module is used for responding to the triggering operation of adding options to the conditions in any data table graph and displaying at least one screening condition template;
the acquisition module is used for responding to the selection operation of any screening condition template and acquiring an input numerical value;
and the forming module is used for forming the screening condition of the data table graph according to the screening condition template and the numerical value, wherein the screening condition indicates that the data meeting the screening condition in the data table corresponding to the data table graph flows to the next graph.
In one possible implementation, the apparatus further includes:
the display module is used for responding to the triggering operation of the condition adding option in any function graph and displaying an input box;
and the obtaining module is used for responding to the input operation of the input box and obtaining the screening condition of the function graph, and the screening condition indicates the function corresponding to the function graph to screen the input data according to the screening condition.
In one possible implementation, the apparatus further includes:
a storage module, configured to store the dataflow graph as a tree-like data structure, where the tree-like data structure includes a plurality of nodes, and each node includes at least one item of a data table or a function;
and the mapping processing module is used for traversing the nodes in the tree-shaped data structure, and mapping the nodes according to the mapping relation between the function identifier and the code statement to obtain the SQL statement corresponding to the dataflow graph.
In still another aspect, a computer device is provided, where the computer device includes a processor and a memory, and the memory stores at least one instruction, where the instruction is loaded by the processor and performs the operations performed in the statement generation method of the above aspect.
In still another aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the operation performed in the statement generation method.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the statement generation method provided by the embodiment of the application, at least one data table identifier and at least one function identifier are provided through the statement generation page, a user can select the provided identifiers, at least one data table graph and at least one function graph are displayed in the target area, a directed line between the two graphs is constructed in the target area to obtain a data flow graph, the data flow graph is subjected to mapping processing, and an SQL statement corresponding to the data flow graph is obtained, so that the user only needs to build the data flow graph on the visual page, the computer equipment can automatically generate the SQL statement, the flow for generating the SQL statement is simplified, the speed for generating the SQL statement is increased, and the efficiency for generating the SQL statement and the development efficiency are increased.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a statement generation method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a statement generation interface provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a statement generation interface provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a statement generation interface provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a statement generation interface provided by an embodiment of the application;
FIG. 6 is a schematic diagram of a statement generation interface provided by an embodiment of the present application;
FIG. 7 is a diagram of a spreadsheet graph according to an embodiment of the present application;
FIG. 8 is a schematic flow chart of adding a screening condition provided in an embodiment of the present application;
FIG. 9 is a schematic flow chart of adding a screening condition according to an embodiment of the present disclosure;
FIG. 10 is a diagram of a sentence generation interface for displaying the number of filtering conditions according to an embodiment of the present application;
FIG. 11 is a schematic flow chart illustrating adding a filter condition to a function graph according to an embodiment of the present application;
FIG. 12 is a schematic diagram of a connection line between a build data table graph and a function graph according to an embodiment of the present application;
fig. 13 is a schematic diagram of a connection line between a constructed function graph and a function graph according to an embodiment of the present application;
FIG. 14 is a diagram of another constructed function graph and a connection line between the function graphs according to an embodiment of the present application;
FIG. 15 is a schematic diagram of a connection line between a constructed operator function graph and a component function graph according to an embodiment of the present application;
fig. 16 is a schematic structural diagram of a sentence generation apparatus provided in an embodiment of the present application;
fig. 17 is a schematic structural diagram of another sentence generation apparatus provided in an embodiment of the present application;
fig. 18 is a block diagram of a terminal according to an embodiment of the present disclosure;
fig. 19 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
It will be understood that the terms "first," "second," and the like as used herein may be used herein to describe various concepts, which are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, a first data table graph may be referred to as a second data table graph, and similarly, a second data table graph may be referred to as a first data table graph, without departing from the scope of the present application.
For example, at least one field may be any integer field greater than or equal to one, such as one field, two fields, three fields, and the like. Each refers to each of the at least one, for example, each function graph refers to each of the at least one function graph, and if the at least one function graph is 3 function graphs, each function graph refers to each of the 3 function graphs. The plurality refers to two or more, for example, the plurality of nodes may be 2 nodes, 3 nodes, 4 nodes, and the like.
Fig. 1 is a flowchart of a statement generation method according to an embodiment of the present application. The execution main body of the embodiment of the application is computer equipment, the computer equipment can be any terminal such as a mobile phone, a desktop computer and a tablet computer, and the embodiment of the application does not limit the computer equipment. Referring to fig. 1, the method includes:
101. and generating an interface based on the statement, and providing at least one data table identification and at least one function identification.
The statement generation interface is used for generating the SQL statement, a user can draw a data flow diagram on the statement generation interface, and the computer equipment can generate the corresponding SQL statement according to the data flow diagram on the statement generation interface. Optionally, the statement generation interface may be an interface provided by a target application, where the target application may be an application dedicated to generating an SQL statement, or an application that manages a database, and the target application is not limited in the embodiment of the present application. For example, the statement generation interface may be an interface provided by an SQL statement editor.
The SQL statement is used for managing a database system, various operations can be executed on the database system by using the SQL statement, the database system comprises at least one data table, each data table is configured with a data table identifier for distinguishing the at least one data table, the at least one data table identifier is provided on a statement generation interface, and therefore a user selects according to the at least one data table identifier to determine which data table to execute the operation. The data table identifier is used to determine a corresponding data table, and may be a table name of the data table, a serial number of the data table, or the like.
In addition, the SQL statement includes at least one function, and therefore, at least one function identifier is further provided on the statement generation interface, where the function identifier is used to determine the corresponding function, where the function identifier may be a name of the function, a number of the function, and the like, and the function identifier is not limited in this embodiment of the application.
The statement generation interface provides at least one data table identification and at least one function identification, which may be pre-stored by the computer device.
The statement generation interface may display at least one data table identification and at least one function identification. The statement generation interface may display the at least one data table identifier and the at least one function identifier at the same time, or may display only one type of identifier each time, for example, when displaying the data table identifier, the function identifier is not displayed; when the function identifier is displayed, the data table identifier is not displayed.
Optionally, the statement generation interface may include a first area for displaying the data table identifier and the function identifier. The first area may be at any position of the sentence generation interface, such as the left side, the right side, the upper side, the lower side, and the like of the sentence generation interface.
As shown in fig. 2, the first area 201 is located on the left side of the statement generation interface 200, a database option 2011 and a function library option 2022 are displayed in the first area 201, the click on the database option 2011 may display or hide a data table identifier below the database option 2011, and the click on the function library option 2022 may display or hide a function identifier below the function library option 2022.
As shown in fig. 3, the first area 301 is located on the left side of the statement generation interface 300, a database option 3011 and a function library option 3012 are displayed at the bottom of the first area 301, and after a user clicks the database option 3011, at least one data table identifier is displayed at the upper portion of the first area 301; after the user clicks on the function library 3012 option, at least one function identifier is displayed in the upper portion of the first region 301.
Optionally, the function may include a component function and an operator function, the component function having a corresponding component function identification, and the operator function having a corresponding operator function identification. Alternatively, the component function identifier and the operator function identifier may be displayed separately, as shown in fig. 4, and a database option 4011, a component library option 4012, and an operator library option 4013 are displayed in the lower part of the first region 401. After the user clicks the database option 4011, at least one data table identifier is displayed on the upper portion of the first area 401; after the user clicks the component library option 4012, at least one component function identifier is displayed on the upper part of the first area 401; after the user clicks the operator library option 4013, at least one operator function identifier is displayed on the upper portion of the first region 401.
Optionally, the first area may also be hidden or displayed on the sentence generation interface. For example, when the first area is in a hidden state, the computer device displays the first area on the sentence generation interface in response to a selection operation of the target button; when the first area is in a display state, the computer device hides the first area in the sentence generation interface in response to a selection operation of the target button.
In one possible implementation manner, the statement generation interface is provided with a data table adding option, the computer device responds to a triggering operation of the data table adding option, obtains an input data table, the data table at least comprises a data table identification, and stores the data table. In this way, when a user needs to write an SQL statement for executing an operation on a certain data table, the stored data table identifier of the data table may be acquired, and the data table identifier of the data table may be displayed in the statement generation interface.
Wherein the data sheet adding option is an option for adding a data sheet, and the data sheet adding option can be displayed at any position of the statement generation interface, for example, as shown in fig. 5, the data sheet adding option 501 is displayed together with the data sheet identifier 502, and the data sheet adding option 501 is located at one side of the data sheet identifier 502, and the user can visually determine that the adding option is an option for adding a data sheet. Optionally, the data table addition option may be in a plus sign shape as shown in fig. 5, or may be a rectangular option similar to the data base option, or may be an option in another shape, and the position and the shape of the data table addition option are not limited in this embodiment of the application.
In one possible implementation manner, the statement generation interface is provided with a function addition option, and the computer device responds to a trigger operation on the function addition option to acquire an input function identifier and a code statement corresponding to the function identifier; and storing the mapping relation between the function identification and the code statement.
Wherein the function adding option is an option for adding a function, and when the function includes a component function and an operator function, and the component function and the operator function are displayed separately, the statement generation interface may be further provided with the component function adding option and the operator function adding option. The component function adding option can be displayed together with the component function identification, and the operator function adding option can be displayed together with the operator function identification, so that a user can distinguish the component function adding option from the operator function adding option. As shown in fig. 6, the operator function addition option is displayed together with the operator function identifier, and the user can intuitively determine the addition option for adding the operator function. Optionally, the data table addition option may be a plus sign shape as shown in fig. 6, may also be an option similar to the operator library option, and may also be another shape.
In addition, the operator function can be further divided into a public operator function and a custom operator function, wherein the public operator function can be an operator function carried by the SQL editor, such as a time function, a mathematical function and the like, and the custom operator function is an operator function written by a user. Alternatively, as shown in fig. 6, the common operator function and the custom operator function may be displayed separately, and a common operator function option 602 and a custom operator function option 603 are disposed on the first region 601. Since the operator function added by the user is a custom operator function, the operator function adding option 604 may be set only on the custom operator function 603. In addition, the computer device can also screen out the common operator function according to the frequency of the operator function used by the user, and display or hide the common operator function through the option of the common operator function option 605.
Optionally, the statement generation interface may further be provided with a search box 606, and a user may input a data table identifier or a function identifier in the search box 606 to search for the corresponding data table identifier or function identifier, so as to avoid a problem that when there are many data table identifiers or function identifiers provided by the statement generation interface, the user searches for the data table identifiers or function identifiers one by one, which wastes much time.
102. And in response to the selection operation of the provided at least two identifications, displaying at least two graphs respectively corresponding to the at least two identifications in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph.
The target area is an area used for drawing the dataflow graph in the statement generation interface, the target area may be located at any position of the statement generation interface, for example, any position of an upper side, a lower side, a left side, a right side, and the like of the statement generation interface, the target area may be a rectangle, a circle, or another shape, and the position and the shape of the target area are not limited in the embodiment of the present application.
The selection operation may be a single-click operation, a double-click operation, a drag operation, and the like. For example, the selection operation is a click operation, the user performs the click operation on the function identifier, a function graph corresponding to the function identifier can be displayed at a certain position of the target area, and the user can drag the function graph to change the position of the function graph in the target area; for another example, the selection operation is a dragging operation, the user may drag the function identifier from the first area to the target area, and the target area may automatically display the function graph corresponding to the function identifier, where a position of the displayed function graph may be a target position in the target area, or may be an end position where the user drags the function identifier.
The data table graph is a graph for representing a data table, and the function graph is a graph for representing a function. As shown in fig. 7, a data table graph 701 is shown in the target area, the data table graph including an identification graph 7011 and at least one field graph 7012, wherein the identification graph 7011 corresponds to data table identifications and each field graph 7012 corresponds to a field. The data table graph 701 may determine the data table identification of the data table and the fields included in the data table.
Optionally, when the data table graphic 701 is displayed in the target area, a database identifier and database graphic 7013 may also be displayed in the target area, the database identifier and database graphic 7013 being used to indicate the source of the data table. As shown in fig. 7, the data table Text _ base is from the database Text _ base. That is to say, when drawing the dataflow graph, the user only needs to select the data table identifier, and the target area will automatically display the data table corresponding to the data table identifier and the database to which the data table belongs.
In one possible implementation, the displaying, by the computer device, at least two graphics corresponding to the at least two identifiers in the target area of the sentence generation interface in response to the selection operation on the provided at least two identifiers may include: each mark has a corresponding graph, the computer equipment responds to the selection operation of the first mark, obtains the graph corresponding to the mark according to the corresponding relation between the mark and the graph, and displays the graph corresponding to the first mark in the target area of the statement generation interface. The first identifier may be a data table identifier or a function identifier.
And repeating the steps at least twice, namely displaying at least two graphs corresponding to the at least two identifications in the target area.
In another possible implementation manner, the displaying, by the computer device, at least two graphs corresponding to the at least two identifiers respectively in the target area of the sentence generation interface in response to the selection operation on the provided at least two identifiers may include: the statement generation interface provides at least one type of identification, each type of identification corresponds to a graphic template, the computer equipment responds to the selection operation of the second identification, determines the identification type of the second identification, acquires the graphic template corresponding to the second identification according to the identification type and the corresponding relation between the identification type and the graphic template, generates the graphic corresponding to the second identification according to the second identification and the acquired graphic template, and displays the graphic corresponding to the second identification in the target area.
The computer equipment generates a graph corresponding to the identifier according to the identifier and the graph generation rule; the graphic template can also be a graphic, the graphic is a graphic containing a blank area, and the computer device writes the identifier into the blank area of the graphic to obtain the graphic corresponding to the identifier.
And repeating the steps at least twice, namely displaying at least two graphs corresponding to the at least two identifications in the target area.
Optionally, in response to a selection operation on the provided at least two identifiers, displaying at least two graphs corresponding to the at least two identifiers respectively in a target area of the statement generation interface, including: responding to the selection operation of any data table identification, and acquiring at least one field in the data table corresponding to the data table identification; generating a data table graph according to the data table identification and the at least one field, wherein the data table graph comprises an identification graph corresponding to the data table identification and a field graph corresponding to the at least one field; the spreadsheet graphic is displayed in the target area.
Optionally, in response to a selection operation on the provided at least two identifiers, displaying at least two graphs corresponding to the at least two identifiers respectively in a target area of the statement generation interface, including: and in response to the selection operation of any function identifier, generating a function graph according to the function identifier, wherein the function graph comprises the function identifier, and the function graph is displayed in the target area.
It should be noted that the graph may further include a condition addition option, and the filtering condition may be added according to the condition addition option. In one possible implementation manner, after at least two graphics respectively corresponding to the at least two identifiers are displayed in the target area in response to a selection operation on the provided at least two identifiers, the method further includes: responding to the trigger operation of adding options to the conditions in any data table graph, and displaying at least one screening condition template; responding to the selection operation of any screening condition template, and acquiring an input numerical value; and constructing a screening condition of the data table graph according to the screening condition template and the value, wherein the screening condition indicates that data meeting the screening condition in the data table corresponding to the data table graph flows to the next graph.
For example, as shown in fig. 8, a condition addition option 801 of "grade score" is included in the data table graph, and the computer device displays at least one filtering condition template in response to a trigger operation on the condition addition option 801 in the data table graph, as shown in fig. 8, there are displayed "range", "selection specific value", "exclusion specific value", and "regular expression", and there are 4 filtering condition templates, and the user can select at least one of the filtering condition templates. If the user selects "exclude specific value", the computer device displays an input box in response to a selection operation for the "exclude specific value", as shown in fig. 9, the user inputs a value 0 in the input box 901, the computer device acquires the input value 0, a filtering condition for a data table graph is configured from the filtering condition template and the input value, the filtering condition indicates that data of 0 in the data table is excluded, and data of 0 in the data table is streamed to a next graph.
In one possible implementation, as shown in fig. 8, the data table graph includes an identification graph and at least one field graph, each field graph is provided with a condition addition option, and the computer device responds to a trigger operation of the condition addition option in any field graph to display at least one screening condition template; responding to the selection operation of any screening condition template, and acquiring an input numerical value; and forming a screening condition of the field graph according to the screening condition template and the value, wherein the screening condition indicates that the data meeting the screening condition in the data table corresponding to the field graph flows to the next graph.
Alternatively, after the filter condition is created, the right side of the field graph may display the number of filter conditions, as shown in fig. 10, with the number 1 displayed on the right side of the grade (score) field. In order to clarify that the number displayed in the right side of the field graphic is the number of the added filtering conditions, a funnel graphic 1001 as shown in fig. 10 may be further displayed in the right side of the field graphic, the number on the side of the funnel graphic 1001 indicating the number of the filtering conditions of the field graphic.
Optionally, because the number of the condition filtering templates is limited, there may be a problem that the requirements of the user are not met, as shown in fig. 10, for this reason, a condition adding option 1003 may also be set in the identification graph 1002, and an input box is displayed in response to a triggering operation on the condition adding option in the identification graph 1002; and responding to the input operation of the input box, and acquiring an input screening condition, wherein the screening condition indicates that data meeting the screening condition in the data table corresponding to the data table graph flows to the next graph.
It should be noted that one or more filtering conditions may be set for each graph, and the number of the filtering conditions of each graph is not limited in the embodiment of the present application.
In addition, some functions process the data flowing into the function graph according to the filtering condition, so in a possible implementation mode, after at least two graphs corresponding to at least two identifications respectively are displayed in the target area in response to the selection operation of the at least two identifications provided, the method further comprises the following steps: responding to the trigger operation of adding options to the conditions in any function graph, and displaying an input box; and responding to the input operation of the input box, and acquiring the screening condition of the function graph, wherein the screening condition indicates that the function corresponding to the function graph carries out screening processing on the input data according to the screening condition.
As shown in fig. 11, a function graph 1101 is a graph corresponding to a partition function, and the partition function can split data in a data table into multiple parts, but a user is required to input a splitting condition, so that the function graph corresponding to the partition function includes a condition adding option 1102, and the user can perform a trigger operation on the condition adding option 1102, so that a corresponding input box 1103 is displayed in a target area, and the user inputs the splitting condition in the input box 1103, as shown in fig. 11, and the user inputs P _20191018, that is, the partition function is used for screening data of day 10/18 in 2019 from the data table.
103. And determining a directed line between at least two graphs in the target area to obtain the data flow graph.
The data flow graph indicates the source of data, the processing mode of the data and the return of the data, and therefore indicates the flow direction of the data. The data flow graph comprises at least one data table graph and at least one function graph, and a directed line between any two graphs, wherein the data table graph indicates the source of data, or the data table graph indicates the source of the data and the processing mode of the data, the function graph can indicate the processing mode of the data, or the function graph indicates the processing mode of the data and the attribution of the data, and the directed line indicates the data flow direction between two connected graphs.
In the target area, a user may drag a displayed graph to construct a directed line between two graphs, for example, drag a data table graph to a function graph, indicate data in the data table to flow to the function graph, and process data in the data table by a function corresponding to the function graph. In one possible implementation, determining a directional line between at least two graphs in a target region includes: and in response to the operation of dragging the first data table graph to the first function graph, constructing a connecting line between the first data table graph and the first function graph, wherein the connecting line points to the first function graph.
Because the data table graph comprises the identification graph and at least one field graph, the data table graph comprises two conditions of dragging the identification graph and the field graph when the data table graph is dragged. And dragging the identification graph to a function graph, indicating the data flow in the data table to the function graph, and processing the data in the data table by using the function corresponding to the function graph. Dragging the field graph to a function graph, indicating the data flow corresponding to the field in the data table to the function graph, and processing the data of the field by the function corresponding to the function graph.
Optionally, in response to an operation of dragging the first spreadsheet graphic to the first function graphic, constructing a connection line between the first spreadsheet graphic and the first function graphic, where the connection line points to the first function graphic, and including at least one of:
1. and in response to the operation of dragging the first field graph in the first data table graph to the first function graph, adding a second field graph in the function graph, and constructing a connecting line between the first field graph and the second field graph, wherein the connecting line points to the second field graph, and the first field graph and the second field graph correspond to the same field in the first data table.
2. And in response to the operation of dragging the identification graph in the first data table graph to the first function graph, constructing a connecting line between the first data table graph and the first function graph, wherein the connecting line points to the function graph, and the identification graph corresponds to the data table identification of the first data table.
For example, as shown in fig. 11, the user drags the test _ base identification graphic 1104 to the partition function graphic 1101, and the computer device constructs a connection line between the test _ base identification graphic 1104 and the partition function graphic 1101, and the connection line points to the partition function graphic 1101.
For another example, as shown in fig. 12, a user drags a name field graph 1201 in a data table graph to a select function graph 1202, the computer device adds a name field graph 1203 to the select function graph 1202, and constructs a connection line between the name field graph 1201 in the data table graph and the name field graph 1203 in the select function graph 1202, where the connection line points to the name field graph 1203 in the select function graph 1202, and the user can drag a plurality of field graphs in the data table graph to the select function graph 1202, as shown in fig. 12, a process of dragging each time is similar to the process of dragging the name field graph 1201, and a detailed description thereof is omitted.
Since the first field pattern and the second field pattern correspond to the same field in the first data table, the field identifications in the first field pattern and the second field pattern are also the same. But for a second field graphic added by the computer device, the user may modify the field identification in the second field graphic. In one possible implementation, after constructing a connection between the first field graph and the second field graph, and the connection points to the second field graph, the method further includes: the field identification of the second field graphic is altered in response to a rename operation on the second field graphic.
Wherein, the field identification in the field graph indicates the name of the field graph, and the name of the second field graph is changed by changing the field identification of the second field graph. Wherein, the renaming operation for the second field graph may be: and carrying out selection operation on the second field graph, then inputting a field identification, and taking the input field identification as the field identification of the second field graph.
In addition, instead of constructing directed lines between the data table graph and the function graph, directed lines between the function graph and the function graph may be constructed. In one possible implementation, determining a directional line between at least two figures in the target area may include:
3. and in response to the operation of dragging the second function graph to the third function graph, constructing a connecting line between the second function graph and the third function graph, wherein the connecting line points to the second function graph.
Optionally, in response to an operation of dragging a second function graph to a third function graph, constructing a connection line between the second function graph and the third function graph, where the connection line points to the second function graph, including at least one of:
4. in response to an operation of dragging a third field graph in the second function graph to the third function graph, constructing a connecting line between the third field graph and the third function graph, wherein the connecting line points to the third function graph;
5. and in response to the operation of dragging the third field graph in the second function graph to the third function graph, adding a fourth field graph in the third function graph, and constructing a connecting line between the third field graph and the fourth field graph, wherein the connecting line points to the fourth field graph, and the third field graph and the fourth field graph correspond to the same field.
For example, as shown in FIG. 13, the user drags part function graph 1301 to select function graph 1302, the computer device constructs a line between part function graph 1301 and select function graph 1302, and the line points to select function graph 1302.
As another example, as shown in FIG. 14, the user selects: the name field graph 1402 in the a-function 1401 is dragged to the join (connection) function graph 1403, and a connection line between the name field graph 1402 and the join function graph 1403 is constructed and points to the join function graph 1403.
It should be noted that, two or more data tables may be used as input data tables in the target region, as shown in fig. 14, a text _ base _1 data table and a text _ base _2 data table may be used as input data tables, data in the text _ base _1 data table is processed by a partition function and a select _ a function, data in the text _ base _2 data table is processed by a select _ b function, and then, data screened by the select _ a function and data screened by the select _ b function are combined by a join function to obtain a new data table, and deduplication processing is performed by the select function.
Optionally, the function may further include a component function and an operator function, where the component function is a key function in the SQL statement, and the operator function is a function for calculating data. In one possible implementation, determining a directional line between at least two graphs in the target region includes at least one of:
6. in response to the operation of dragging the component graph corresponding to the component function identifier to the operator graph corresponding to the operator function identifier, constructing a connecting line between the component graph and the operator graph, wherein the connecting line points to the operator graph;
7. and in response to the operation of dragging the operator graph corresponding to the operator function identifier to the component graph corresponding to the component function identifier, constructing a connecting line between the operator graph and the component graph, wherein the connecting line points to the component graph.
Optionally, in response to an operation of dragging a component graph corresponding to the component function identifier to an operator graph corresponding to the operator function identifier, constructing a connection line between the component graph and the operator graph, where the connection line points to the operator graph, including:
8. and in response to the operation of dragging the sixth field graph in the component function graph to the operator function graph, constructing a connecting line between the sixth field graph and the operator function graph, wherein the connecting line points to the operator function graph.
Optionally, in response to an operation of dragging an operator graph corresponding to the operator function identifier to a component graph corresponding to the component function identifier, constructing a connection line between the operator graph and the component graph, where the connection line points to the component graph, including:
9. and in response to the operation of dragging the operator function graph to the component function graph, adding a seventh field graph in the component function graph, constructing a connecting line between the operator function graph and the seventh field graph, wherein the connecting line points to the seventh field graph, and the seventh field graph and an eighth field graph connected with the operator graph correspond to the same field.
For example, as shown in fig. 15, when a user drags the grade _1 field graph 1501 in the data table graph to the sum operator function graph 1502, the computer device constructs a connection line between the grade _1 field graph 1501 and the sum operator function graph 1502, and the connection line points to the sum operator function graph 1502; then, the user drags sum function graph 1502 to select component function graph 1503, the computer device adds grade _1 field graph 1504 to select component function graph 1503, and constructs a connection line between grade _1 field graph 1504 and sum function graph 1502 in select component function graph 1503, where the connection line points to grade _1 field graph 1504 in select component function graph 1503.
Through the operation, the user can construct graphs and connecting lines among the graphs in the target area, and therefore the data flow graph is obtained.
104. And mapping the data flow graph to obtain an SQL statement corresponding to the data flow graph.
The data flow graph indicates the source of the data, the processing of the data and the return of the data, which is equivalent to determining the processing logic of the data, so that the SQL statement corresponding to the data flow graph can be generated according to the processing logic.
In a possible implementation manner, the computer device stores the corresponding relationship between the function identifier and the SQL statement, so that the computer device can perform nesting processing on the SQL statement corresponding to the function identifier according to the processing logic of the data in the dataflow graph to obtain the SQL statement corresponding to the dataflow graph. Optionally, mapping the data flow graph to obtain an SQL statement corresponding to the data flow graph, where the mapping includes: acquiring an SQL statement corresponding to each function graph according to a function identifier corresponding to each function graph in the data flow graph and a mapping relation between the function identifier and the SQL statement; and according to other graphs connected with each function graph in the data flow graph, nesting the SQL statement corresponding to each function graph to obtain the SQL statement corresponding to the data flow graph.
Optionally, according to other graphs connected to each function graph in the dataflow graph, performing nesting processing on the SQL statement corresponding to each function graph, where the nesting processing includes at least one of the following:
if the fourth function graph is connected with the fifth function graph and the connecting line between the fourth function graph and the fifth function graph points to the fifth function graph, the SQL sentence corresponding to the fourth function identifier is embedded into the SQL sentence corresponding to the fifth function graph;
if a fifth field graph in the second data table graph is connected with a sixth function graph and a connecting line between the fifth field graph and the sixth function graph points to the sixth function graph, adding a field corresponding to the fifth field graph into an SQL statement corresponding to the sixth function graph;
and if the identification graph in the third data table graph is connected with the seventh function graph and the connecting line between the identification graph and the seventh function graph points to the seventh function graph, adding the data table identification corresponding to the identification graph into the SQL sentence corresponding to the seventh function graph.
The SQL statement corresponding to the data flow graph may use "select … … from …" as a skeleton, and be filled in "select … … from …" according to the source of data, the processing mode of data, and the attribution of data in the data flow graph.
In another possible implementation manner, the mapping, by the computer device, the data flow graph is mapped according to a mapping relationship between the graph and the SQL statement, so as to obtain the SQL statement corresponding to the data flow graph, where the mapping process includes: storing the data flow graph as a tree-like data structure, wherein the tree-like data structure comprises a plurality of nodes, and each node comprises at least one item in a data table or a function; and traversing nodes in the tree data structure, and mapping the plurality of nodes according to the mapping relation between the function identifier and the code statement to obtain the SQL statement corresponding to the dataflow graph.
The computer device stores the data flow graph exposed by the target area as a tree data structure representing a select … … from … statement, the tree data structure comprising a plurality of nodes, wherein traversing the tree data structure can determine a parent node of the tree data structure, the parent node can point to one or more child nodes, and if the parent node points to a plurality of child nodes, a combination manner of the child nodes is defined in the parent node, and the combination manner comprises horizontal inter-table combination, vertical inter-table combination and the like.
In the embodiment of the application, a node of a "select … … from …" statement that generates a final data table is used as a root node of a tree-shaped data structure, the node including the data table is used as a leaf node, the tree-shaped data structure is traversed, a parent node of the tree-shaped data structure is determined, the parent node is mapped to obtain an SQL statement corresponding to the parent node, a child node of the parent node is mapped to obtain an SQL statement corresponding to the child node, the SQL statement corresponding to the child node is nested to the SQL statement corresponding to the parent node, and if the parent node corresponds to multiple child nodes, the computer device nests the SQL statements corresponding to the multiple child nodes to the SQL statement corresponding to the parent node in a combination manner defined in the parent node. Taking the child node as an updated parent node, repeatedly executing the steps of mapping the parent node to obtain an SQL statement corresponding to the parent node, then mapping the child node of the parent node to obtain an SQL statement corresponding to the child node, nesting the SQL statement corresponding to the child node to the SQL statement corresponding to the parent node, if the parent node corresponds to a plurality of child nodes, nesting the SQL statements corresponding to the child nodes to the SQL statement corresponding to the parent node by the computer equipment according to a combination mode defined in the parent node until the child nodes are leaf nodes, completing the mapping processing, and obtaining the SQL statement of the data flow graph.
By mapping the dataflow graph shown in fig. 12 in the above manner, the following SQL statement can be obtained:
Figure BDA0002370289490000191
according to the statement generation method provided by the embodiment of the application, at least one data table identifier and at least one function identifier are provided through the statement generation page, a user can select the provided identifiers, at least one data table graph and at least one function graph are displayed in the target area, a directed line between the two graphs is constructed in the target area to obtain a data flow graph, the data flow graph is subjected to mapping processing, and an SQL statement corresponding to the data flow graph is obtained, so that the user only needs to build the data flow graph on the visual page, the computer equipment can automatically generate the SQL statement, the flow for generating the SQL statement is simplified, the speed for generating the SQL statement is increased, and the efficiency for generating the SQL statement and the development efficiency are increased. Particularly, when a complex SQL statement is generated, the efficiency of generating the SQL statement and the development efficiency can be obviously improved, wherein the complex SQL statement refers to the SQL statement with more rows. And other personnel can intuitively understand the intention and the work content of the developer according to the dataflow graph, so that the cooperation among the developers is smoother.
Fig. 16 is a schematic structural diagram of a sentence generation apparatus provided in an embodiment of the present application, and referring to fig. 16, the apparatus includes: a display module 1601, a determination module 1602, and a mapping process module 1603.
A display module 1601, configured to generate an interface based on a statement, and provide at least one data table identifier and at least one function identifier;
the display module 1601 is configured to, in response to a selection operation on the provided at least two identifiers, display at least two graphs corresponding to the at least two identifiers respectively in a target area of the statement generation interface, where the at least two graphs include at least one data table graph and at least one function graph;
a determining module 1602, configured to determine a directional line between the at least two graphs in the target region, to obtain a dataflow graph, where the directional line indicates a data flow direction between the at least two graphs;
a mapping processing module 1603, configured to perform mapping processing on the dataflow graph to obtain a structured query language SQL statement corresponding to the dataflow graph.
As shown in fig. 17, in one possible implementation, the determining module 1602 is configured to construct a connection line between a first data table graph and a first function graph in response to a drag operation of the first data table graph to the first function graph, and the connection line points to the first function graph.
In one possible implementation, the determining module 1602 is configured to perform at least one of the following:
responding to the operation of dragging a first field graph in the first data table graph to the first function graph, adding a second field graph in the function graph, constructing a connecting line between the first field graph and the second field graph, wherein the connecting line points to the second field graph, and the first field graph and the second field graph correspond to the same field in the first data table;
and in response to the operation of dragging the identification graph in the first data table graph to the first function graph, constructing a connecting line between the first data table graph and the first function graph, wherein the connecting line points to the function graph, and the identification graph corresponds to the data table identification of the first data table.
In one possible implementation, the apparatus further includes:
a change module 1604 for changing the field identification of the second field graphic in response to the renaming operation for the second field graphic.
In a possible implementation manner, the determining module 1602 is configured to construct a connection line between a second function graph and a third function graph in response to an operation of dragging the second function graph to the third function graph, where the connection line points to the second function graph.
In one possible implementation, the determining module 1602 is configured to perform at least one of the following:
in response to an operation of dragging a third field graph in the second function graph to the third function graph, constructing a connecting line between the third field graph and the third function graph, wherein the connecting line points to the third function graph;
and in response to the operation of dragging a third field graph in the second function graph to the third function graph, adding a fourth field graph in the third function graph, and constructing a connecting line between the third field graph and the fourth field graph, wherein the connecting line points to the fourth field graph, and the third field graph and the fourth field graph correspond to the same field.
In one possible implementation, the display module 1601 includes:
an obtaining unit 1611, configured to, in response to a selection operation on any data table identifier, obtain at least one field in a data table corresponding to the data table identifier;
a generating unit 1612, configured to generate a data table graph according to the data table identifier and the at least one field, where the data table graph includes an identifier graph corresponding to the data table identifier and a field graph corresponding to the at least one field;
a display unit 16013 for displaying the data table graph in the target area.
In one possible implementation, the apparatus further includes:
the storage module 1605 is configured to, in response to a trigger operation for adding an option to the data table, obtain an input data table, and store the data table, where the data table at least includes a data table identifier.
In one possible implementation, the mapping processing module 1603 includes:
an obtaining unit 1631, configured to obtain, according to the function identifier corresponding to each function graph in the dataflow graph and the mapping relationship between the function identifier and the SQL statement, the SQL statement corresponding to each function graph;
a nesting unit 1632, configured to perform nesting processing on the SQL statement corresponding to each function graph according to another graph connected to each function graph in the dataflow graph, so as to obtain the SQL statement corresponding to the dataflow graph.
In one possible implementation, the nesting unit 1632 is configured to perform at least one of:
if a fourth function graph is connected with a fifth function graph and a connecting line between the fourth function graph and the fifth function graph points to the fifth function graph, embedding the SQL statement corresponding to the fourth function identifier into the SQL statement corresponding to the fifth function graph for nesting;
if a fifth field graph in a second data table graph is connected with a sixth function graph and a connecting line between the fifth field graph and the sixth function graph points to the sixth function graph, adding a field corresponding to the fifth field graph into an SQL statement corresponding to the sixth function graph;
and if the identification graph in the third data table graph is connected with the seventh function graph and the connecting line between the identification graph and the seventh function graph points to the seventh function graph, adding the data table identification corresponding to the identification graph into the SQL sentence corresponding to the seventh function graph.
In one possible implementation, the statement generation interface is provided with a function addition option, and the apparatus further includes:
an obtaining module 1606, configured to obtain, in response to a trigger operation for adding an option to the function, an input function identifier and a code statement corresponding to the function identifier;
a storage module 1605, configured to store the mapping relationship between the function identifier and the code statement.
In one possible implementation, the functions include component functions and operator functions, and the determining module 1602 is configured to perform at least one of:
in response to the operation of dragging the component function graph corresponding to the component function identifier to the operator function graph corresponding to the operator function identifier, constructing a connecting line between the component function graph and the operator function graph, wherein the connecting line points to the operator function graph;
and in response to the operation of dragging the operator function graph corresponding to the operator function identifier to the component function graph corresponding to the component function identifier, constructing a connecting line between the operator function graph and the component function graph, wherein the connecting line points to the component function graph.
In a possible implementation manner, the determining module 1602 is further configured to, in response to an operation of dragging a sixth field graph in the component function graph to the operator function graph, construct a connection line between the sixth field graph and the operator function graph, where the connection line points to the operator function graph;
the determining module 1602 is further configured to, in response to an operation of dragging the operator function graph to the component function graph, add a seventh field graph to the component function graph, and construct a connection line between the operator function graph and the seventh field graph, where the connection line points to the seventh field graph, and the seventh field graph and an eighth field graph connected to the operator graph correspond to the same field.
In one possible implementation, the apparatus further includes:
the display module 1601 is used for responding to a trigger operation of adding an option to a condition in any data table graph and displaying at least one screening condition template;
an obtaining module 1606, configured to obtain an input numerical value in response to a selection operation on any one of the screening condition templates;
a forming module 1607, configured to form a screening condition of the data table graph according to the screening condition template and the value, where the screening condition indicates that data meeting the screening condition in the data table corresponding to the data table graph flows to a next graph.
In one possible implementation, the apparatus further includes:
the display module 1601 is used for responding to a trigger operation of a condition adding option in any function graph and displaying an input box;
an obtaining module 1606, configured to obtain, in response to an input operation on the input box, a filtering condition of the function graph, where the filtering condition indicates that a function corresponding to the function graph performs filtering processing on input data according to the filtering condition.
In one possible implementation, the apparatus further includes:
a storage module 1605, configured to store the dataflow graph as a tree-like data structure, where the tree-like data structure includes a plurality of nodes, and each node includes at least one item of a data table or a function;
the mapping processing module 1603 is configured to traverse nodes in the tree-like data structure, and perform mapping processing on the nodes according to a mapping relationship between a function identifier and a code statement to obtain an SQL statement corresponding to the dataflow graph.
It should be noted that: in the sentence generating apparatus provided in the above embodiment, when generating a sentence, only the division of the functional modules is exemplified, and in practical applications, the functions may be distributed by different functional modules as needed, that is, the internal structure of the computer device may be divided into different functional modules to complete all or part of the functions described above. In addition, the statement generating device and the statement generating method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 18 is a block diagram of a terminal according to an embodiment of the present application. The terminal 1800 is used for executing the steps executed by the terminal in the above embodiments, and may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The terminal 1800 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and the like.
Generally, the terminal 1800 includes: a processor 1801 and a memory 1802.
The processor 1801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 1801 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 1801 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 1801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing content required to be displayed on the display screen. In some embodiments, the processor 1801 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 1802 may include one or more computer-readable storage media, which may be non-transitory. Memory 1802 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 1802 is used to store at least one instruction for execution by processor 1801 to implement the statement generation methods provided by method embodiments herein.
In some embodiments, the terminal 1800 may further optionally include: a peripheral interface 1803 and at least one peripheral. The processor 1801, memory 1802, and peripheral interface 1803 may be connected by a bus or signal line. Each peripheral device may be connected to the peripheral device interface 1803 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 1804, touch screen display 1805, camera assembly 1806, audio circuitry 1807, positioning component 1808, and power supply 1809.
The peripheral interface 1803 may be used to connect at least one peripheral associated with I/O (Input/Output) to the processor 1801 and the memory 1802. In some embodiments, the processor 1801, memory 1802, and peripheral interface 1803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1801, the memory 1802, and the peripheral device interface 1803 may be implemented on separate chips or circuit boards, which are not limited in this application.
The Radio Frequency circuit 1804 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 1804 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 1804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuitry 1804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 1804 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 1804 may also include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 1805 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 1805 is a touch display screen, the display screen 1805 also has the ability to capture touch signals on or over the surface of the display screen 1805. The touch signal may be input to the processor 1801 as a control signal for processing. At this point, the display 1805 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 1805 may be one, providing a front panel of the terminal 1800; in other embodiments, the number of the display screens 1805 may be at least two, and each of the display screens is disposed on a different surface of the terminal 1800 or is in a foldable design; in still other embodiments, the display 1805 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 1800. Even more, the display 1805 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display 1805 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or the like.
The camera assembly 1806 is used to capture images or video. Optionally, the camera assembly 1806 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 1806 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuitry 1807 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 1801 for processing or inputting the electric signals to the radio frequency circuit 1804 to achieve voice communication. The microphones may be provided in a plurality, respectively, at different positions of the terminal 1800 for the purpose of stereo sound collection or noise reduction. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 1801 or the radio frequency circuitry 1804 to sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 1807 may also include a headphone jack.
The positioning component 1808 is utilized to locate a current geographic position of the terminal 1800 for navigation or LBS (Location Based Service). The Positioning component 1808 may be a Positioning component based on a GPS (Global Positioning System) in the united states, a beidou System in china, or a greiner System in russia, or a galileo System in the european union.
The power supply 1809 is used to power various components within the terminal 1800. The power supply 1809 may be ac, dc, disposable or rechargeable. When the power supply 1809 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
Those skilled in the art will appreciate that the configuration shown in fig. 18 is not intended to be limiting of terminal 1800 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Fig. 19 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 1900 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1901 and one or more memories 1902, where the memory 1902 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1901 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
Server 1900 may be used to perform the steps performed by the server in the generate statement method described above.
The embodiment of the present application further provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, and the instruction is loaded by the processor and executes the operation performed in the statement generating method of the foregoing embodiment.
The embodiment of the present application further provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the instruction is loaded and executed by a processor to implement the operations performed in the statement generation method of the foregoing embodiment.
The embodiment of the present application further provides a computer program, where at least one instruction is stored in the computer program, and the at least one instruction is loaded and executed by a processor, so as to implement the operations executed in the statement generation method of the foregoing embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (15)

1. A statement generation method, characterized in that the method comprises:
generating an interface based on the statement, and providing at least one data table identifier and at least one function identifier;
responding to selection operation of at least two provided identifications, and displaying at least two graphs respectively corresponding to the at least two identifications in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph;
determining a directed line between the at least two graphs in the target area to obtain a data flow graph, wherein the directed line indicates the data flow direction between the at least two graphs;
and mapping the data flow graph to obtain a Structured Query Language (SQL) statement corresponding to the data flow graph.
2. The method of claim 1, wherein determining a directional line between the at least two graphs in the target region comprises:
in response to an operation of dragging a first data table graph to a first function graph, a connecting line between the first data table graph and the first function graph is constructed, and the connecting line points to the first function graph.
3. The method of claim 2, wherein said constructing a line between the first spreadsheet graphic and the first function graphic in response to the dragging of the first spreadsheet graphic to the first function graphic, and wherein the line points to the first function graphic comprises at least one of:
responding to an operation of dragging a first field graph in the first data table graph to the first function graph, adding a second field graph in the function graph, and constructing a connecting line between the first field graph and the second field graph, wherein the connecting line points to the second field graph, and the first field graph and the second field graph correspond to the same field in the first data table;
and in response to the operation of dragging the identification graph in the first data table graph to the first function graph, constructing a connecting line between the first data table graph and the first function graph, wherein the connecting line points to the function graph, and the identification graph corresponds to the data table identification of the first data table.
4. The method of claim 1, wherein determining a directional line between the at least two graphs in the target region comprises:
in response to the operation of dragging the second function graph to the third function graph, a connecting line between the second function graph and the third function graph is constructed, and the connecting line points to the second function graph.
5. The method according to claim 4, wherein the operation of dragging a second function graph to a third function graph constructs a connection line between the second function graph and the third function graph, and the connection line points to the second function graph, and comprises at least one of:
in response to an operation of dragging a third field graph in the second function graph to the third function graph, constructing a connecting line between the third field graph and the third function graph, wherein the connecting line points to the third function graph;
responding to an operation of dragging a third field graph in the second function graph to the third function graph, adding a fourth field graph in the third function graph, and constructing a connecting line between the third field graph and the fourth field graph, wherein the connecting line points to the fourth field graph, and the third field graph and the fourth field graph correspond to the same field.
6. The method of claim 1, wherein in response to a selection operation on the provided at least two identifiers, displaying at least two graphs respectively corresponding to the at least two identifiers in a target area of the sentence generation interface comprises:
responding to the selection operation of any data table identification, and acquiring at least one field in the data table corresponding to the data table identification;
generating a data table graph according to the data table identification and the at least one field, wherein the data table graph comprises an identification graph corresponding to the data table identification and a field graph corresponding to the at least one field;
displaying the spreadsheet graphic in the target area.
7. The method of claim 1, wherein the mapping the dataflow graph to obtain a Structured Query Language (SQL) statement corresponding to the dataflow graph includes:
acquiring an SQL statement corresponding to each function graph according to the function identifier corresponding to each function graph in the data flow graph and the mapping relation between the function identifier and the SQL statement;
and according to other graphs connected with each function graph in the data flow graph, nesting the SQL statement corresponding to each function graph to obtain the SQL statement corresponding to the data flow graph.
8. The method according to claim 7, wherein the nesting processing of the SQL statement corresponding to each function graph according to the other graphs connected to each function graph in the dataflow graph includes at least one of:
if a fourth function graph is connected with a fifth function graph and a connecting line between the fourth function graph and the fifth function graph points to the fifth function graph, embedding an SQL statement corresponding to the fourth function identifier into the SQL statement corresponding to the fifth function graph;
if a field graph in a second data table graph is connected with a sixth function graph and a connecting line between the field graph and the sixth function graph points to the sixth function graph, adding a field corresponding to the field graph into an SQL statement corresponding to the sixth function graph;
and if the identification graph in the third data table graph is connected with a seventh function graph and the connecting line between the identification graph and the seventh function graph points to the seventh function graph, adding the data table identification corresponding to the identification graph into the SQL sentence corresponding to the seventh function graph.
9. The method of claim 1 or 7, wherein the statement generation interface is provided with a function addition option, the method further comprising:
responding to the triggering operation of the function adding option, and acquiring an input function identifier and a code statement corresponding to the function identifier;
and storing the mapping relation between the function identification and the code statement.
10. The method of claim 1, wherein functions comprise component functions and operator functions, and wherein determining a directed line between the at least two graphs in the target region comprises at least one of:
in response to the operation of dragging the component function graph corresponding to the component function identifier to the operator function graph corresponding to the operator function identifier, constructing a connecting line between the component function graph and the operator function graph, wherein the connecting line points to the operator function graph;
and in response to the operation of dragging the operator function graph corresponding to the operator function identifier to the component function graph corresponding to the component function identifier, constructing a connecting line between the operator function graph and the component function graph, wherein the connecting line points to the component function graph.
11. The method of claim 10, wherein said constructing a connection line between a component function graph and an operator function graph in response to a drag operation of the component function graph corresponding to the component function identifier to the operator function graph corresponding to the operator function identifier, and wherein the connection line points to the operator function graph, comprises:
in response to an operation of dragging a sixth field graph in the component function graph to the operator function graph, constructing a connecting line between the sixth field graph and the operator function graph, wherein the connecting line points to the operator function graph;
the constructing a connection line between the operator function graph and the component function graph in response to the operation of dragging the operator function graph corresponding to the operator function identifier to the component function graph corresponding to the component function identifier, wherein the connection line points to the component function graph, comprises:
and in response to the operation of dragging the operator function graph to the component function graph, adding a seventh field graph in the component function graph, and constructing a connecting line between the operator function graph and the seventh field graph, wherein the connecting line points to the seventh field graph, and the seventh field graph and an eighth field graph connected with the operator graph correspond to the same field.
12. The method according to claim 1, wherein after displaying at least two graphics respectively corresponding to the at least two identifiers in the target area in response to the selection operation of the provided at least two identifiers, the method further comprises:
responding to the trigger operation of adding options to the conditions in any data table graph, and displaying at least one screening condition template;
responding to the selection operation of any screening condition template, and acquiring an input numerical value;
and forming a screening condition of the data table graph according to the screening condition template and the numerical value, wherein the screening condition indicates that data meeting the screening condition in the data table corresponding to the data table graph flows to a next graph.
13. The method according to claim 1, wherein after displaying at least two graphics respectively corresponding to the at least two identifiers in the target area in response to the selection operation of the provided at least two identifiers, the method further comprises:
responding to the trigger operation of adding options to the conditions in any function graph, and displaying an input box;
and responding to the input operation of the input box, and acquiring the screening condition of the function graph, wherein the screening condition indicates that the function corresponding to the function graph carries out screening processing on the input data according to the screening condition.
14. The method according to claim 1, wherein the mapping the dataflow graph according to the mapping relationship between the graph and the SQL statement to obtain the SQL statement corresponding to the dataflow graph includes:
storing the dataflow graph as a tree-like data structure, wherein the tree-like data structure comprises a plurality of nodes, and each node comprises at least one item of a data table or a function;
and traversing nodes in the tree data structure, and mapping the nodes according to the mapping relation between the function identifier and the code statement to obtain the SQL statement corresponding to the dataflow graph.
15. A sentence generation apparatus, the apparatus comprising:
the display module is used for generating an interface based on the statement and providing at least one data table identifier and at least one function identifier;
the display module is used for responding to selection operation of the provided at least two identifications, and displaying at least two graphs respectively corresponding to the at least two identifications in a target area of the statement generation interface, wherein the at least two graphs comprise at least one data table graph and at least one function graph;
a determining module, configured to determine a directed line between the at least two graphs in the target region to obtain a dataflow graph, where the directed line indicates a data flow direction between the at least two graphs;
and the mapping processing module is used for mapping the data flow graph to obtain a Structured Query Language (SQL) statement corresponding to the data flow graph.
CN202010048535.1A 2020-01-16 2020-01-16 Statement generation method and device Pending CN113138996A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010048535.1A CN113138996A (en) 2020-01-16 2020-01-16 Statement generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010048535.1A CN113138996A (en) 2020-01-16 2020-01-16 Statement generation method and device

Publications (1)

Publication Number Publication Date
CN113138996A true CN113138996A (en) 2021-07-20

Family

ID=76808497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010048535.1A Pending CN113138996A (en) 2020-01-16 2020-01-16 Statement generation method and device

Country Status (1)

Country Link
CN (1) CN113138996A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113590097A (en) * 2021-07-30 2021-11-02 中电金信软件有限公司 API interface generation method and device, electronic equipment and storage medium
CN115827644A (en) * 2023-02-13 2023-03-21 明度智云(浙江)科技有限公司 Report generation method, system and server based on visual view configuration

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113590097A (en) * 2021-07-30 2021-11-02 中电金信软件有限公司 API interface generation method and device, electronic equipment and storage medium
CN115827644A (en) * 2023-02-13 2023-03-21 明度智云(浙江)科技有限公司 Report generation method, system and server based on visual view configuration

Similar Documents

Publication Publication Date Title
CN110471858B (en) Application program testing method, device and storage medium
CN110262788B (en) Page configuration information determination method and device, computer equipment and storage medium
CN112181576A (en) Form processing method, device, terminal and storage medium
WO2021008334A1 (en) Data binding method, apparatus, and device of mini program, and storage medium
JP7246502B2 (en) Mini-program creation method, device, terminal and program
CN113553039B (en) Method and device for generating executable code of operator
CN112000331A (en) Page rendering method and device, electronic equipment and storage medium
CN112162843A (en) Workflow execution method, device, equipment and storage medium
CN111949680A (en) Data processing method and device, computer equipment and storage medium
WO2021244267A1 (en) Application program transplantation method and apparatus, device, and medium
CN112116690A (en) Video special effect generation method and device and terminal
CN111325220B (en) Image generation method, device, equipment and storage medium
CN113138996A (en) Statement generation method and device
CN109726379B (en) Content item editing method and device, electronic equipment and storage medium
CN111061803A (en) Task processing method, device, equipment and storage medium
CN111737100A (en) Data acquisition method, device, equipment and storage medium
CN112230907A (en) Program generation method, device, terminal and storage medium
CN111475611B (en) Dictionary management method, dictionary management device, computer equipment and storage medium
CN113190307A (en) Control adding method, device, equipment and storage medium
WO2021008287A1 (en) Character recommending method and apparatus, and computer device and storage medium
CN111898353A (en) Table display method, device and medium
CN116954597A (en) Form page generation method and device, electronic equipment, storage medium and product
CN114238859A (en) Data processing system, method, electronic device, and storage medium
CN114329292A (en) Resource information configuration method and device, electronic equipment and storage medium
CN111294320B (en) Data conversion method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40047924

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination