Association query method and device based on established model
The method and device facilitate association queries across different databases with varying data structures by using HTTP requests, caching, and visual configuration, addressing the limitations of existing technologies and enhancing query efficiency and intuitiveness.
Patent Information
- Application Number
- CN202411297162.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-09-18
AI Technical Summary
Existing association query technologies are limited to performing queries on data tables within the same database and require complex programming configurations and SQL statements, failing to efficiently handle data tables with different data structures and data structures, and high technical skills.
An association query method and device that uses HTTP requests to retrieve data tables from different databases, caches them, generates a list through a model configuration interface, allows intuitive selection and configuration of target data tables, constructs an initial query model based on virtual objects, and performs queries without writing SQL statements.
Enables efficient and intuitive association queries across different databases with varying data structures, reducing the technical threshold and improving query efficiency by allowing users to visually configure queries and display results.
Smart Images

Figure CN118838944B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an association query method and device based on an established model. Background Art
[0002] The massive amount of information collected from social media, news websites and other platforms is usually stored in databases. At present, the data query method is mainly based on keyword matching, which makes retrieval difficult and is not conducive to retrieving more accurate information. In order to improve the accuracy of information retrieval, association query is a commonly used technology in database query, which allows retrieval based on the association relationship between multiple data tables. However, the existing association query technology can often only perform association queries on data tables in the same database, and cannot perform association queries on data tables in different databases, especially cannot perform association queries on data tables with different data structures. In addition, the traditional data table association query method usually requires a series of relatively complex programming configurations and the writing of SQL statements. Not only is the operation cumbersome, but it also requires high programming skills of the query personnel. This leads to a high technical threshold and low query efficiency for the traditional data table association query method. Summary of the invention
[0003] In view of this, an object of the present invention is to provide an association query method and device based on an established model to alleviate the above-mentioned problems existing in the related art.
[0004] In a first aspect, an embodiment of the present invention provides an association query method based on an established model, the method comprising: sending a corresponding first http request to each database respectively to obtain a data table corresponding to the corresponding first http request from each database; writing each obtained data table into a preset cache area, and generating a data table list based on the first data table cached in the preset cache area, and then displaying the data table list through a model configuration interface; wherein the first data table corresponds to the data table one by one, the data table list includes a second data table corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key; in response to the model configuration A selection operation of a target data table in a list of data tables displayed on the interface, generating a corresponding target virtual object for each target data table based on the selection operation and displaying it through the model configuration interface; wherein, there are at least two target data tables and the target data tables correspond one-to-one to the target virtual objects, and each target virtual object is bound to a corresponding target data table; an initial query model is constructed based on the target virtual objects displayed on the model configuration interface, and query rules and query result display parameters are configured for the initial query model to obtain a query model; wherein, in the initial query model, the edges between the target virtual objects are used to represent the association relationship between the corresponding target data tables; an association query is performed through the query model, and the query result is displayed through the query result display interface.
[0005] In a second aspect, an embodiment of the present invention further provides an association query device based on an established model, the device comprising: an acquisition module, used to send a corresponding first http request to each database respectively, so as to obtain a data table corresponding to the corresponding first http request from each database; a list module, used to write each obtained data table into a preset cache area, and generate a data table list based on the first data table cached in the preset cache area, and then display the data table list through a model configuration interface; wherein the first data table corresponds to the data table one by one, and the data table list includes a second data table corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key; a generation module, used to respond to a query request for the model A selection operation of a target data table in a data table list displayed on a model configuration interface is performed, and a corresponding target virtual object is generated for each target data table based on the selection operation and displayed through the model configuration interface; wherein, there are at least two target data tables and the target data tables correspond to the target virtual objects one by one, and each target virtual object is bound to a corresponding target data table; a configuration module is used to construct an initial query model based on the target virtual objects displayed on the model configuration interface, and configure query rules and query result display parameters for the initial query model to obtain a query model; wherein, in the initial query model, the edges between the target virtual objects are used to represent the association relationship between the corresponding target data tables; a query module is used to perform an association query through the query model, and display the query results through the query result display interface.
[0006] The embodiment of the present invention provides an association query method and device based on an established model, which respectively sends a corresponding first http request to each database to obtain a data table corresponding to the corresponding first http request from each database; writes each obtained data table into a preset cache area, and generates a data table list based on the first data table cached in the preset cache area, and then displays the data table list through a model configuration interface; in response to a selection operation for a target data table in the data table list displayed on the model configuration interface, generates a corresponding target virtual object for each target data table based on the selection operation and displays it through the model configuration interface; constructs an initial query model based on the target virtual object displayed on the model configuration interface, and configures query rules and query result display parameters for the initial query model to obtain a query model; performs an association query through the query model, and displays the query result through the query result display interface. By adopting the above technology, data tables in different databases can be accurately obtained through http requests. After the data tables are written into the preset cache area, a data table list can be generated using the cached data tables, so that the data table list can be intuitively displayed to the user through the model configuration interface later. The user can easily select the target data table on the model configuration interface for intuitive configuration of the query model, which makes it easier to query the model for associated queries and intuitively display the query results to the user through the query result display interface, thereby improving the intuitiveness of model configuration and model associated queries. The user can perform associated queries on data tables in different databases without writing SQL statements, which reduces the technical threshold for associated queries on data tables. At the same time, the method of associated queries based on query models improves the efficiency of associated queries on data tables.
[0007] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0008] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0010] Figure 1A schematic diagram of a flow chart of an association query method based on an established model in an embodiment of the present invention;
[0011] Figure 2 This is an example diagram of a model configuration interface in an embodiment of the present invention;
[0012] Figure 3 An example diagram of an association configuration interface in an embodiment of the present invention;
[0013] Figure 4 This is an example diagram of a rule configuration interface in an embodiment of the present invention;
[0014] Figure 5 This is an example diagram of the SQL search interface in an embodiment of the present invention;
[0015] Figure 6 It is a structural schematic diagram of an association query device based on an established model in an embodiment of the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0017] This solution can be applied to database management systems. At present, the existing association query technology in database management systems can often only perform association queries on data tables in the same database, and cannot perform association queries on data tables in different databases, especially cannot perform association queries on data tables with different data structures. In addition, the traditional data table association query method usually requires a series of relatively complex programming configurations and the writing of SQL statements, which is not only cumbersome to operate, but also requires high programming skills of the query personnel. This leads to a high technical threshold and low query efficiency for the traditional data table association query method.
[0018] Based on this, the present invention provides an association query method and device based on an established model, which can alleviate the above-mentioned problems existing in the related technology.
[0019] To facilitate understanding of this embodiment, firstly, a method for associative query based on an established model disclosed in an embodiment of the present invention is introduced in detail, see Figure 1 As shown, the method may include the following steps:
[0020] Step S102: Send a corresponding first http request to each database respectively, so as to obtain a data table corresponding to the corresponding first http request from each database.
[0021] For example, there are three different databases, denoted as database a, database b and database c respectively. The user's corresponding electronic device can send corresponding http requests to database a, database b and database c respectively. Each http request is used to request a corresponding data table in the corresponding database. After receiving the corresponding http request, database a, database b and database c will return the corresponding data table to the electronic device.
[0022] By adopting the above-mentioned method of obtaining data tables through http requests, complete data tables from different databases can be obtained quickly and accurately, so as to realize associated queries from different data tables, and the database requested by the http request and the data table therein as well as the timing of the http request can be flexibly defined according to actual needs, thereby improving the flexibility of data table acquisition; in addition, the computing resource consumption generated by the http request is relatively small, which is conducive to ensuring the smoothness of the relevant computing process of data table acquisition, and further improving the stability of data table acquisition.
[0023] Step S104, writing each obtained data table into a preset cache area, generating a data table list based on the first data table cached in the preset cache area, and then displaying the data table list through the model configuration interface.
[0024] Among them, the first data tables correspond to each other one by one, and the data table list includes the second data tables corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key.
[0025] Continuing with the previous example, after obtaining the data tables corresponding to database a, database b and database c, the electronic device will write each obtained data table into a preset cache area for caching, thereby obtaining a first data table cached in the preset cache area corresponding to each data table; thereafter, the electronic device uses the first data table cached in the preset cache area to generate a data table list, and further provides a model configuration interface, thereby displaying the data table list to the user through the model configuration interface.
[0026] By adopting the above-mentioned method of caching the data table through the preset cache area, as long as the required data is cached in the preset cache area, the required data can be directly retrieved for use, which can avoid sending an http request to the corresponding database again to obtain the required data, thereby avoiding the computing resource consumption caused by the electronic device repeatedly obtaining the required data, which is beneficial to improving the overall efficiency of data table association queries.
[0027] Step S106 , in response to a selection operation on a target data table in the data table list displayed on the model configuration interface, a corresponding target virtual object is generated for each target data table based on the selection operation and displayed through the model configuration interface.
[0028] There are at least two target data tables, and the target data tables correspond to the target virtual objects one by one, and each target virtual object is bound to a corresponding target data table.
[0029] See also Figure 2 As shown, a model configuration interface is provided through the electronic device corresponding to the user. The model configuration interface displays a data table list including multiple data tables (such as table A, table B, table C, table D, and table E). There is a circular selection box on the left side of each data table. The user can click the circular selection box on the left side of the corresponding data table with the mouse to select the corresponding data table. Figure 2 In the example, after the user selects Table A, Table B and Table C as the target data tables, the electronic device corresponding to the user generates virtual objects corresponding to the Table A, Table B and Table C selected by the user (i.e., target virtual objects, represented by rectangular objects respectively) and displays them in the modeling configuration box of the model configuration interface.
[0030] Step S108, constructing an initial query model based on the target virtual object displayed on the model configuration interface, and configuring query rules and query result display parameters for the initial query model to obtain a query model.
[0031] In the initial query model, the edges between target virtual objects are used to represent the association relationship between corresponding target data tables.
[0032] Continuing from the previous example, see Figure 2 As shown, the user can respectively establish corresponding edges with arrows between the virtual object corresponding to table A and the virtual object corresponding to table B, and between the virtual object corresponding to table B and the virtual object corresponding to table C, to respectively represent that table A is associated with table B, and table B is associated with table C, thereby obtaining an initial query model. In the initial query model, each edge is configured with a corresponding association field and association type, and the direction of the arrow of each edge represents the association type of the corresponding association relationship; thereafter, the user can also click the "Rule Configuration" button in the modeling configuration box with the mouse to trigger the electronic device to provide a rule configuration interface, and then the user can configure query rules and query result display parameters for the initial query model on the rule configuration interface. After configuring the query rules and query result display parameters, the query model can be obtained, and the user can click the "Save Model" button in the modeling configuration box with the mouse to trigger the electronic device to save the query model.
[0033] The main types of joins include inner join, left join, right join, full join, etc. There is no limitation on this.
[0034] Inner join means: only records that match in two tables are returned, that is, records that meet the join conditions at the same time. In other words, inner join compares the records in two tables and only retains the parts that exist in both tables.
[0035] Left join means: based on the left table, all records in the left table are returned, and the records in the right table that match the left table are also returned. If there is no matching record in the right table, it is filled with NULL values (or empty values).
[0036] Right join means: based on the right table, all records in the right table are returned, and the records in the left table that match the right table are also returned. If there is no matching record in the left table, it is filled with NULL values (or empty values).
[0037] Full join means: all records from both the left and right tables are returned, and matching records are also returned. If there is no matching record in a table, it is filled with NULL values (or empty values). Full join combines the results of left join and right join to form a result set containing all records from both tables.
[0038] Step S110, performing an associated query through the query model, and displaying the query result through the query result display interface.
[0039] Continuing from the previous example, see Figure 2 As shown, the user can click the "Run" button in the modeling configuration box with the mouse to trigger the electronic device to run the query model, thereby performing the calculation process of the associated query through the query model; after the calculation of the associated query is completed, the electronic device will generate a query result based on the calculation result of the associated query and provide a query result display interface, thereby displaying the query result to the user through the query result display interface.
[0040] An embodiment of the present invention provides an associative query method based on an established model, which sends a corresponding first http request to each database respectively to obtain a data table corresponding to the corresponding first http request from each database; writes each obtained data table into a preset cache area, generates a data table list based on the first data table cached in the preset cache area, and then displays the data table list through a model configuration interface; in response to a selection operation for a target data table in the data table list displayed on the model configuration interface, generates a corresponding target virtual object for each target data table based on the selection operation and displays it through the model configuration interface; constructs an initial query model based on the target virtual object displayed on the model configuration interface, configures query rules and query result display parameters for the initial query model, and obtains a query model; performs an associative query through the query model, and displays the query result through the query result display interface. By adopting the above technology, data tables in different databases can be accurately obtained through http requests. After the data tables are written into the preset cache area, a data table list can be generated using the cached data tables, so that the data table list can be intuitively displayed to the user through the model configuration interface later. The user can easily select the target data table on the model configuration interface for intuitive configuration of the query model, which makes it easier to query the model for associated queries and intuitively display the query results to the user through the query result display interface, thereby improving the intuitiveness of model configuration and model associated queries. The user can perform associated queries on data tables in different databases without writing SQL statements, which reduces the technical threshold for associated queries on data tables. At the same time, the method of associated queries based on query models improves the efficiency of associated queries on data tables.
[0041] As a possible implementation, generating a data table list based on the first data table cached in the preset cache area in the above step S104 may include:
[0042] Step 1: add a timestamp corresponding to each first data table in a preset cache area, and add an index corresponding to the primary key of each first data table to obtain a second data table corresponding to each first data table.
[0043] The primary key may include an associated field of the corresponding first data table, and the index may be used to uniquely identify the corresponding first data table.
[0044] Step 2: assemble the obtained second data table into a data table list.
[0045] After the above steps 1 to 2, since each second data table cached in the preset cache area has a corresponding timestamp, the preset cache area can perform relevant processing on the cached second data table in the time dimension according to the timestamp, thereby realizing dynamic management of cached data; and each second data table also has a corresponding index, so when performing an associated query, the identification function of the index can be used to quickly and accurately determine the first data table to be associated queried, thereby helping to improve the overall efficiency of data table associated queries.
[0046] As a possible implementation, each edge can be configured with corresponding associated fields and associated types; based on this, constructing the initial query model based on the target virtual objects displayed on the model configuration interface in the above step S108 may include: establishing edges between the target virtual objects corresponding to the target data table to be associated and queried on the model configuration interface, and configuring corresponding associated fields and associated types for each edge; generating an initial query model based on the target virtual objects displayed on the model configuration interface and the edges after the associated fields and associated types are configured between the target virtual objects.
[0047] Continuing from the previous example, see Figure 2 As shown, based on the virtual objects corresponding to Table A, Table B, and Table C that have been displayed in the model configuration interface, the user can connect the right side of the virtual object corresponding to Table A (which can be referred to as A object) with the left side of the virtual object corresponding to Table B (which can be referred to as B object) to establish an edge, and connect the right side of the B object with the left side of the virtual object corresponding to Table C (which can be referred to as C object) to establish another edge. The specific configuration method for configuring the corresponding association fields and association types for each edge can be: the user double-clicks the edge for which the association fields and association types need to be configured with the mouse, and the electronic device corresponding to the user will pop up the association configuration interface in response to the double-click operation of the mouse, see Figure 3 As shown, the association configuration interface includes a selection association method area for configuring the association type and a selection matching field area for user configuration of the association field; the selection association method area displays the graphic buttons of the four association types (i.e., inner association, left association, right association, and full association) for the user, and the user can click one of the graphic buttons with the mouse to select an association type to trigger the electronic device to configure the association type selected by the user to the edge selected by the user; the selection matching field area displays the field add button ( Figure 3In the figure, a circle with a plus sign inside is contained in a square. The user can click the field add button with the mouse to trigger the electronic device to display a field drop-down control in the select matching field area. Then, the user can click the field drop-down control with the mouse to expand the field drop-down control and select one of the multiple fields provided in the expanded field drop-down control as the associated field to be configured. Similarly, the user can perform similar operations by clicking the field add button with the mouse multiple times according to the operation principle to trigger the electronic device to use the field selected by the user as the associated field. After selecting the associated field, the user can click the OK button in the select matching field area with the mouse to trigger the electronic device to configure the associated field to the edge selected by the user and cancel the display of the associated configuration interface, thereby enabling the electronic device to configure the corresponding associated field and associated type for each edge, thereby obtaining the edge after the associated field and associated type are configured. See Figure 2 As shown, the electronic device may use the A object, the B object, the C object displayed in the model configuration interface and the two edges configured with associated fields and associated types as the initial query model.
[0048] As a possible implementation, the index may be a corresponding primary key or a hash value obtained by performing a hash operation on the corresponding primary key; based on this, before performing the association query through the query model in the above step S110, the above association query method based on the established model may also include: establishing a mapping relationship between the indexes corresponding to the target data table. Among them, since the index uniquely identifies the first data table, the mapping relationship between the indexes can represent the association relationship between the first data tables.
[0049] Accordingly, performing an association query through the query model in the above step S110 may include: determining the target data table with an association relationship based on the mapping relationship and the index corresponding to each target data table; performing an association query on the target data table with an association relationship based on the query rule and the association field and association type configured for each edge, and generating a result data table as a query result based on the query result display parameter and the result of the association query. Displaying the query result through the query result display interface in the above step S110 may include: counting the number of records contained in the result data table, and displaying the result data table and the number of records contained therein through the query result display interface.
[0050] By adopting the above-mentioned method of performing associated query based on the mapping relationship between indexes, query rules, and configured associated fields and associated types through the query model, the associated target data table can be quickly and accurately determined by utilizing the mapping relationship between indexes, and then the related calculation process of the associated query can be realized by utilizing the query rules, associated fields, and associated types, thereby improving the overall efficiency of the data table associated query.
[0051] As a possible implementation, after performing the step of generating a result data table as the query result based on the query result display parameter and the result of the associated query, the associated query method based on the established model may further include:
[0052] Step A1, determining whether there is a target field in the result data table based on a preset target keyword database.
[0053] The target field is a field in the result data table that corresponds to and matches the target keyword contained in the preset target field database.
[0054] Step A2: if there is a target field in the result data table, desensitize and encrypt the value corresponding to the target field in the result data table.
[0055] Continuing with the previous example, after the electronic device corresponding to the user determines the target field in the result data table, it can first find all the values corresponding to each target field, and desensitize and encrypt all the values corresponding to each target field, thereby protecting the target data contained in the result data table.
[0056] As a possible implementation, the preset cache area may be configured with a survival time corresponding to the cached data; based on this, the above-mentioned association query method based on the established model may also include:
[0057] Step a1, periodically traverse the second data table in the preset cache area, so as to determine whether there is an expired data table in the preset cache area based on the timestamp and the survival time each time the preset cache area is traversed.
[0058] The overdue data table may be a second data table in which the time interval between the time corresponding to the timestamp and the current time is greater than the survival time.
[0059] Step a2, if there is an overdue data table in the preset cache area, a corresponding second HTTP request is sent to each database corresponding to the overdue data table, so as to obtain the third data table corresponding to the corresponding second HTTP request from the database corresponding to each overdue data table, write each third data table into the preset cache area, and update the data table list based on the third data table.
[0060] For example, the electronic device corresponding to the user periodically traverses the preset cache area, and calculates the time interval between the moment corresponding to the timestamp of each second data table and the current moment each time the preset cache area is traversed. If the time interval corresponding to a second data table is greater than the survival time corresponding to the cached data in the preset cache area, the electronic device can determine that the second data table is an overdue data table, and send an http request for re-obtaining the first data table corresponding to the overdue data table to the database corresponding to the overdue data table. After responding to the http request, the database corresponding to the overdue data table returns the data table corresponding to the overdue data table as a third data table to the electronic device. Thereafter, the electronic device writes the third data table into the preset cache area for caching, so that the preset cache area adds a timestamp and index to the third data table to obtain a fourth data table and replaces the overdue data table in the data table list with the fourth data table, thereby updating the data table list.
[0061] By adopting the above-mentioned method of obtaining the data table corresponding to the overdue data table through http request and using the data table to update the data table list, when there is overdue data in the cached data, it is only necessary to re-request the original data of the overdue data in the corresponding database through http to realize the dynamic update of the data table list, thereby ensuring that the data contained in the data table list is the latest, thereby ensuring the accuracy of the subsequent data table association query performed using the data table list.
[0062] As a possible implementation, the above-mentioned association query method based on the established model may also include:
[0063] Step B1, periodically traverse the second data table in the preset cache area, so as to determine whether there is a new data table in the preset cache area based on the timestamp each time the preset cache area is traversed.
[0064] The newly added data table may be a second data table whose time corresponding to the timestamp is before the time corresponding to the last time the preset cache area is traversed.
[0065] Step B2: if there is a new data table in the preset buffer area, the data table list is updated based on the new data table.
[0066] For example, the electronic device corresponding to the user periodically traverses the preset cache area, and each time it traverses the preset cache area, it compares the time corresponding to the timestamp of each second data table with the time of the previous traversal of the preset cache area. If the time corresponding to the timestamp of a second data table is earlier than the time of the previous traversal of the preset cache area, the electronic device can determine that the second data table is a newly added data table; the electronic device can add the newly added data table determined after a certain traversal of the preset cache area to the data table list, thereby realizing the update of the data table list.
[0067] By adopting the above method of updating the data table list using the newly added data table, when new data is added to the cached data, the data table list can be updated by simply adding the new data to the data table list, thereby ensuring the accuracy of subsequent data table association queries using the data table list.
[0068] As a possible implementation, the above-mentioned associative query method based on the established model may also include: in response to a selection operation on a target record in a result data table, generating result information corresponding to the target record, and displaying the result information through a result information display interface.
[0069] Continuing from the previous example, see Figure 2 As shown, after the electronic device runs the query model to perform an associated query and displays the result data table as the query result to the user through the query result display interface, the user can also click the "Apply for Export" button with the mouse to trigger the electronic device to provide the user with a result export interface. The result export interface displays the selection boxes corresponding to each record in the result data table. The user can click the corresponding selection box with the mouse to select the corresponding record. After responding to the selection operation, the electronic device uses the record selected by the user as the target record and fills the target record into the preset template, and provides the user with a result information display interface, so that the template filled with the target record information is displayed to the user as result information through the result information display interface.
[0070] As a possible implementation, the above-mentioned association query method based on the established model may also include:
[0071] Step b1, generating an intermediate data table based on the query result, and writing the intermediate data table into a preset buffer area.
[0072] Step b2, adding the intermediate table corresponding to the intermediate data table cached in the preset cache area to the data table list, and displaying the data table list after adding the intermediate table through the model configuration interface.
[0073] In the case where multiple rounds of data table association queries are required, since a new round of data table association queries usually needs to be performed based on the results of the previous round of data table association queries, after obtaining the corresponding query results after each round of data table association queries, the result data table obtained as the query result in the current round can be written into the preset cache area as an intermediate data table to obtain an intermediate table corresponding to the intermediate data table in the preset cache area, and the intermediate table is added to the data table list to display the data table list after the intermediate table is added to the user through the model configuration interface, so that in a new round of data table association queries, the user can select the intermediate table to trigger the electronic device to use the intermediate table as the target data table, thereby allowing the intermediate table to participate in the relevant calculation process of the new round of data table association queries, thereby improving the operational convenience of multiple rounds of data table association queries.
[0074] For ease of understanding, the above-mentioned association query method based on the established model is exemplarily described as follows by taking a specific application as an example.
[0075] The above-mentioned association query method based on the established model can be mainly performed in the following operation modes:
[0076] Step 1: Get the required data table.
[0077] The electronic device corresponding to the user sends a corresponding http request to each database respectively, and the database receiving the corresponding http request returns a corresponding data table to the electronic device in response to the corresponding http request.
[0078] Step 2: cache the data table, generate and display the data table list.
[0079] The electronic device corresponding to the user caches the obtained data table to a preset cache area, and adds a timestamp and index to the cached data table through the preset cache area, then organizes the cached data table with timestamp and index into a data table list, and displays the data table list to the user through the model configuration interface.
[0080] In order to improve the security of data, the timestamp and index of each cache data table in the data table list can also be concatenated into a corresponding string, and the string corresponding to each cache data table in the data table list can be encrypted; in this way, only those who have the authority to decrypt the string corresponding to the cache data table can obtain the timestamp and index corresponding to the cache data table, so that the obtained timestamp and index can be used for related calculations later, thereby improving the security of data table association queries.
[0081] Step 3: Select a data table to build a query model.
[0082] Continuing from the previous example, see Figure 2 As shown in the figure, the model configuration interface contains a new model task control and a data table list as well as a modeling configuration area and a running result area. Users can click the new model task control ( Figure 2In the example, the electronic device sends a new task request to the device corresponding to the auditor in response to the operation. After receiving the new task request, the device corresponding to the auditor provides an audit interface to display the submission information of the new task request to the auditor through the audit interface. After the auditor reviews and approves the submission information, the device corresponding to the auditor sends the modeling task corresponding to the new task request to the electronic device. The electronic device adds the received modeling task to the modeling task list for display. In addition, the model configuration interface can also provide users with a viewing control for viewing the modeling tasks under review, so that users can know which modeling tasks are under review through the viewing control.
[0083] See also Figure 2 As shown, the user can drag a specified data table in the data table list to the model configuration interface with the mouse. The electronic device will generate a virtual object corresponding to the specified data table in response to the dragging operation, and make the virtual object move synchronously with the movement of the mouse cursor until the virtual object moves to a suitable position. Among them, each data table in the data table list can only be dragged into the model configuration interface once, and the virtual object generated by the data table dragged into the model configuration interface can be adjusted at will in the modeling configuration. The user can click the delete button ( Figure 2 The button (a round button with a cross inside the top of a virtual object) can trigger the electronic device to delete the virtual object to be deleted.
[0084] See also Figure 2 and Figure 3 As shown, the user can press and hold the left or right node of the virtual object corresponding to a data table with the mouse to trigger the electronic device to generate a line segment with the node pressed by the user as the starting point and the end point that can be freely moved with the mouse cursor. After that, the user can move the mouse cursor to the node of the virtual object corresponding to the other data table to associate the two data tables. At this time, the end point of the line segment is the node moved to by the mouse cursor, and the line segment is the edge between the virtual objects corresponding to the two data tables. The electronic device can have an emphasized reminder display for the edge that is not configured to be associated with the table. The user can also double-click the edge between the virtual objects with the mouse, and the electronic device will pop up in response to the double-click operation of the mouse. Figure 3 The association configuration interface shown allows users to configure association fields and associations, for example, Figure 3 The associated fields configured by the user for an edge are the name field and the birth time field. The user can also click the Add Field button to add other associated fields.
[0085] See also Figure 2 and Figure 4 As shown, the user can click the rule configuration button in the modeling configuration area with the mouse to trigger the electronic device to pop up the following Figure 4The rule configuration interface shown in the figure supports two functions: complex filtering rule configuration and display field selection. The display field is the query result display parameter at this time. When configuring rules, complex rules can be nested in multiple layers through logical relationships such as and, or, and query conditions can be directly added to configure filtering conditions. When selecting display fields, users can use the mouse to check the corresponding selection box of the corresponding field ( Figure 4 The square box selection control located on the left side of the displayed field name) is used to trigger the fields that need to be displayed (i.e., display fields) in the electronic device configuration result data table (i.e., query results).
[0086] See also Figure 2 As shown, the user can click the "Save Model" button in the modeling configuration box with the mouse to trigger the electronic device to save the obtained virtual object and the configured associated fields, associated types, query rules, and display fields as a query model. The next time the user clicks the model task corresponding to the query model in the model task list with the mouse, the display of the query model will be triggered. If the form in the saved query model is deleted in the data management, the display of the query model cannot be triggered, and a prompt message will be displayed to remind the user that the relevant form no longer exists.
[0087] Step 4: Run the query model and display the query results.
[0088] See also Figure 2 As shown, the electronic device runs the query model when the user clicks the "Run" button in the modeling configuration box with the mouse, so as to perform an associated query based on the data tables bound to the virtual objects and the association relationships between the data tables through the query model, and generates and displays a result data table as a query result based on the calculation results obtained after the relevant calculation process of the configured associated query is completed, and provides a query result display interface, so as to display the query result to the user through the query result display interface.
[0089] If the query results contain the target data, the target data will be desensitized and encrypted before displaying the query results containing the encrypted data. At the same time, the total number of query results (that is, the total number of records contained in the result data table) will be displayed. Figure 2On the model configuration interface shown, click the "Apply for Export" button with the mouse to trigger the electronic device to pop up the result export interface. The user can configure the records, export fields and export templates included in the query results on the result export interface to trigger the electronic device to send a result export application message to the device corresponding to the auditor. After the auditor reviews the result export application message on the corresponding device and passes it, it will trigger the device to return the review information of the result export application to the electronic device, and then the electronic device exports the records included in the query results based on the configured export fields and export templates to generate the corresponding result information. When exporting results, the electronic device can also support the two functions of exporting ten results and exporting all results. The export of ten results can refer to: randomly applying for the export and viewing of ten records in the query results, which requires the auditor to review. The export of all results can refer to: the application export of all query results, which requires the auditor to review.
[0090] See also Figure 2 As shown, the electronic device can also support the creation of an intermediate data table for the running results of the created model. A modeling task can support the creation of multiple intermediate data tables. The electronic device can cache the intermediate data table to a preset cache area, and add the intermediate table corresponding to the intermediate data table cached in the preset cache area to the data table list for display. The intermediate table, like other data tables, can also be dragged to the model configuration interface to generate a corresponding virtual object to participate in the query model construction process. The electronic device can also support the deletion of the intermediate table when the user right-clicks the intermediate table. Since the intermediate representation is generated based on the result obtained by a certain data table association query, the intermediate table may be in a running state. For example, the intermediate table will be in a running state when the calculation process of the current association query is not completed, and the intermediate table will not switch from the running state to the completed state until the calculation process of the current association query is completed; in order to further distinguish the different states of the intermediate table, the prompt information of the running state can be displayed when the intermediate table is in the running state, and the prompt information of the completed state will not be displayed when the intermediate table is in the completed state.
[0091] Since the creation of modeling tasks and the viewing of target data both require review by auditors, electronic devices can also support an audit record query function, which mainly refers to: querying the audit records that record the creation of modeling tasks, and viewing the approval records of the target data contained in the query results.
[0092] In addition, in order to facilitate users with certain programming skills to perform customized queries on data tables by writing SQL statements, the electronic device corresponding to the user can also provide the user with an SQL search interface, see Figure 5As shown, the SQL search interface displays a data table list and an SQL statement writing area. After the user selects the corresponding data table in the data table list, the SQL search interface displays the field information (such as field comments, field names, data types, etc.) of the fields contained in the selected data table to the user, so that the user can refer to the displayed field information to write SQL statements in the SQL statement writing area, and then the user can click the "Run" button with the mouse to trigger the electronic device to run the SQL statement written by the user to perform a custom query on the selected field in the data table, thereby obtaining the query results. The method of exporting the query results corresponding to the custom query of the data table is similar to the method of exporting the query results obtained by calculating the query model, which will not be repeated here. For example, you can export to Excel according to the displayed results, and support the default display of only 5,000 data items.
[0093] By adopting the above-mentioned associative query method based on the established model, an intuitive operation entry can be provided for users to perform modeling configuration, and then associative query of data tables can be performed based on the established model. The query results can also be displayed and it is convenient for users to export query results to view related data, thereby improving the intuitiveness, efficiency and accuracy of associative query of data tables. Users can perform associative query of data tables without writing SQL statements, which reduces the technical threshold for associative query of data tables.
[0094] Based on the above-mentioned associated query method based on the established model, the embodiment of the present invention also provides an associated query device based on the established model, see Figure 6 As shown, the device may include the following modules:
[0095] The acquisition module 602 is used to send a corresponding first http request to each database respectively, so as to acquire a data table corresponding to the corresponding first http request from each database.
[0096] List module 604 is used to write each obtained data table into a preset cache area, and generate a data table list based on the first data table cached in the preset cache area, and then display the data table list through the model configuration interface; wherein, the first data table corresponds to the data table one by one, and the data table list includes the second data table corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key.
[0097] A generation module 606 is used to respond to a selection operation on a target data table in a list of data tables displayed on the model configuration interface, generate a corresponding target virtual object for each target data table based on the selection operation and display it through the model configuration interface; wherein, there are at least two target data tables and the target data tables correspond one-to-one to the target virtual objects, and each target virtual object is bound to a corresponding target data table.
[0098] Configuration module 608 is used to build an initial query model based on the target virtual objects displayed in the model configuration interface, and configure query rules and query result display parameters for the initial query model to obtain a query model; wherein, in the initial query model, the edges between the target virtual objects are used to represent the association relationship between the corresponding target data tables.
[0099] The query module 610 is used to perform an associated query through the query model and display the query result through the query result display interface.
[0100] An association query device based on an established model provided by an embodiment of the present invention can accurately obtain data tables in different databases through http requests, and can also generate a data table list using the cached data table after writing the data table into a preset cache area, so that the data table list can be intuitively displayed to the user through the model configuration interface later. The user can easily select the target data table on the model configuration interface to intuitively configure the query model, thereby facilitating the query model to perform association queries and intuitively display the query results to the user through the query result display interface, thereby improving the intuitiveness of the model configuration and the model association query, and the user can perform association queries on data tables in different databases without writing SQL statements, which reduces the technical threshold for data table association queries, and at the same time improves the efficiency of data table association queries based on the method of performing association queries based on the query model.
[0101] The above-mentioned list module 604 can also be used to: add a timestamp corresponding to each first data table in the preset cache area, and add an index corresponding to the primary key of each first data table to obtain the second data table corresponding to each first data table; wherein the primary key includes the associated field of the corresponding first data table, and the index is used to uniquely identify the corresponding first data table; and the obtained second data tables are composed into the data table list.
[0102] The above-mentioned preset cache area can be configured with the corresponding survival time of the cached data; based on this, see Figure 6 As shown, the device may also include:
[0103] The first determination module 612 is used to periodically traverse the second data table in the preset cache area to determine whether there is an overdue data table in the preset cache area based on the timestamp and the survival time each time the preset cache area is traversed; wherein the overdue data table is a second data table in which the time interval between the moment corresponding to the timestamp and the current moment is greater than the survival time.
[0104] The above-mentioned acquisition module 602 can also be used for: if there is an overdue data table in the preset cache area, then a corresponding second http request is sent to each database corresponding to the overdue data table, so as to obtain the third data table corresponding to the corresponding second http request from the database corresponding to each overdue data table, write each third data table into the preset cache area, and update the data table list based on the third data table.
[0105] See also Figure 6 As shown, the device may also include:
[0106] The second determination module 614 is used to periodically traverse the second data table in the preset cache area to determine whether there is a new data table in the preset cache area based on the timestamp each time the preset cache area is traversed; wherein the new data table is the second data table before the time corresponding to the time corresponding to the timestamp when the preset cache area was last traversed.
[0107] The list module 604 may also be used to update the data table list based on the newly added data table if there is a newly added data table in the preset cache area.
[0108] Each edge can be configured with corresponding associated fields and associated types; based on this, the above-mentioned configuration module 608 can also be used to: establish edges between target virtual objects corresponding to the target data table to be associated and queried on the model configuration interface, and configure corresponding associated fields and associated types for each edge; generate the initial query model based on the target virtual objects displayed on the model configuration interface and the edges after the associated fields and associated types are configured between the target virtual objects.
[0109] The above index can be the corresponding primary key or the hash value obtained by performing a hash operation on the corresponding primary key; based on this, see Figure 6 As shown, the device may also include:
[0110] The establishing module 616 is used to establish the mapping relationship between the indexes corresponding to the target data table.
[0111] The above-mentioned query module 610 can also be used to: determine the target data table with an associated relationship based on the mapping relationship and the index corresponding to each target data table; perform an associated query on the target data table with an associated relationship based on the query rules and the associated fields and associated types configured for each edge, and generate a result data table as the query result based on the query result display parameters and the results of the associated query.
[0112] The query module 610 may also be used to count the number of records included in the result data table, and display the result data table and the number of records included therein through the query result display interface.
[0113] The above-mentioned query module 610 can also be used to: determine whether there is a target field in the result data table based on a preset target keyword database; wherein the target field is a field in the result data table that corresponds to the target keyword contained in the preset target field database; if there is a target field in the result data table, then the value corresponding to the target field in the result data table is desensitized and encrypted.
[0114] The query module 610 may also be used to: in response to a selection operation on a target record in the result data table, generate result information corresponding to the target record, and display the result information through a result information display interface.
[0115] See also Figure 6 As shown, the device may also include:
[0116] The cache module 618 is used to generate an intermediate data table based on the query result and write the intermediate data table into the preset cache area.
[0117] The above-mentioned list module 604 can also be used to: add the intermediate table corresponding to the intermediate data table cached in the preset cache area to the data table list, and display the data table list after adding the intermediate table through the model configuration interface.
[0118] The associated query device based on the established model provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned associated query method embodiment based on the established model. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0119] Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present invention.
[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0121] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0122] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for associative query based on the established model, It is characterized in that The method comprises: Sending a corresponding first http request to each database respectively, so as to obtain a data table corresponding to the corresponding first http request from each database; Write each obtained data table into a preset cache area, and generate a data table list based on the first data table cached in the preset cache area, and then display the data table list through the model configuration interface; wherein the first data table corresponds to the data table one by one, and the data table list includes the second data table corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key; In response to a selection operation on a target data table in the data table list displayed on the model configuration interface, a corresponding target virtual object is generated for each target data table based on the selection operation and displayed through the model configuration interface; wherein there are at least two target data tables and the target data tables correspond to the target virtual objects one by one, and each target virtual object is bound to a corresponding target data table; An initial query model is constructed based on the target virtual objects displayed on the model configuration interface, and query rules and query result display parameters are configured for the initial query model to obtain a query model; wherein, in the initial query model, the edges between the target virtual objects are used to represent the association relationship between the corresponding target data tables; each edge is configured with a corresponding association field and an association type, and the arrow direction of each edge represents the association type of the corresponding association relationship; An associated query is performed through the query model, and the query result is displayed through the query result display interface.
2. The method according to claim 1, It is characterized in that Generating a data table list based on the first data table cached in the preset cache area includes: Adding a timestamp corresponding to each first data table in the preset cache area, and adding an index corresponding to the primary key of each first data table, to obtain a second data table corresponding to each first data table; wherein the primary key includes an associated field of the corresponding first data table, and the index is used to uniquely identify the corresponding first data table; The obtained second data table constitutes the data table list.
3. The method according to claim 1, It is characterized in that The preset cache area is configured with a survival time corresponding to the cached data; the method further includes: Periodically traverse the second data table in the preset cache area to determine whether there is an overdue data table in the preset cache area based on the timestamp and the survival time each time the preset cache area is traversed; wherein the overdue data table is a second data table whose time interval between the time corresponding to the timestamp and the current time is greater than the survival time; If there is an overdue data table in the preset cache area, a corresponding second http request is sent to each database corresponding to the overdue data table to obtain a third data table corresponding to the corresponding second http request from the database corresponding to each overdue data table, write each third data table into the preset cache area, and update the data table list based on the third data table.
4. The method according to claim 1, It is characterized in that The method further comprises: Periodically traverse the second data table in the preset cache area, so as to determine whether there is a newly added data table in the preset cache area based on the timestamp each time the preset cache area is traversed; wherein the newly added data table is a second data table whose time corresponding to the timestamp is before the time corresponding to the last traversal of the preset cache area; If there is a new data table in the preset buffer area, the data table list is updated based on the new data table.
5. The method according to claim 2, It is characterized in that Each edge is configured with corresponding association fields and association types; Constructing an initial query model based on the target virtual object displayed on the model configuration interface includes: Establishing edges between target virtual objects corresponding to the target data table to be associated and queried on the model configuration interface, and configuring corresponding associated fields and associated types for each edge; The initial query model is generated based on the target virtual objects displayed on the model configuration interface and the edges after the associated fields and associated types are configured between the target virtual objects.
6. The method according to claim 5, It is characterized in that The index is the corresponding primary key or a hash value obtained by performing a hash operation on the corresponding primary key; Before performing the association query through the query model, the method further includes: Establish the mapping relationship between the indexes corresponding to the target data table; Performing an associated query through the query model includes: Based on the mapping relationship and the index corresponding to each target data table, determining the target data table with the associated relationship; Performing an association query on a target data table with an association relationship based on the query rule and the association fields and association types configured for each edge, and generating a result data table as the query result based on the query result display parameter and the result of the association query; The query results are displayed through the query result display interface, including: The number of records included in the result data table is counted, and the result data table and the number of records included therein are displayed through the query result display interface.
7. The method according to claim 6, It is characterized in that After generating a result data table as the query result based on the query result display parameter and the result of the associated query, the method further includes: Determine whether there is a target field in the result data table based on a preset target keyword database; wherein the target field is a field in the result data table that corresponds to and matches the target keyword contained in the preset target field database; If there is a target field in the result data table, the value corresponding to the target field in the result data table is desensitized and encrypted.
8. The method according to claim 6, It is characterized in that The method further comprises: In response to a selection operation on a target record in the result data table, result information corresponding to the target record is generated, and the result information is displayed through a result information display interface.
9. The method according to claim 1, It is characterized in that The method further comprises: Generate an intermediate data table based on the query result, and write the intermediate data table into the preset buffer area; The intermediate table corresponding to the intermediate data table cached in the preset cache area is added to the data table list, and the data table list after the intermediate table is added is displayed through the model configuration interface.
10. An association query device based on the established model, It is characterized in that The device comprises: An acquisition module, used for sending a corresponding first http request to each database respectively, so as to acquire a data table corresponding to the corresponding first http request from each database; A list module, used to write each obtained data table into a preset cache area, and generate a data table list based on the first data table cached in the preset cache area, and then display the data table list through the model configuration interface; wherein the first data table corresponds to the data table one by one, and the data table list includes the second data table corresponding to each first data table, each second data table has its corresponding timestamp in the preset cache area, and each second data table has an index corresponding to its primary key; A generating module, for responding to a selection operation of a target data table in the data table list displayed on the model configuration interface, generating a corresponding target virtual object for each target data table based on the selection operation and displaying the object through the model configuration interface; wherein the target data tables have at least two and the target data tables correspond to the target virtual objects one by one, and each target virtual object is bound to a corresponding target data table; A configuration module, used to construct an initial query model based on the target virtual objects displayed on the model configuration interface, and configure query rules and query result display parameters for the initial query model to obtain a query model; wherein, in the initial query model, the edges between the target virtual objects are used to represent the association relationship between the corresponding target data tables; each edge is configured with a corresponding association field and association type, and the arrow direction of each edge represents the association type of the corresponding association relationship; The query module is used to perform associated query through the query model and display the query results through the query result display interface.
