A method and apparatus for merging data using stacked perspectives
The data table cascading perspective model is constructed through the cascading perspective method, which solves the problems of complex operations and difficulty in ensuring accuracy during the data table merging process, and achieves the effect of simplifying operations and improving the accuracy of data processing.
Patent Information
- Application Number
- CN202410759549.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-13
AI Technical Summary
The existing technology is complex and error-prone when merging data tables from different data sources, and the accuracy of data processing is difficult to guarantee.
The cascading perspective method is used to construct a cascading perspective model of data tables, and the data table is analyzed through cascading perspective through the perspective rule matching layer and the data perspective merging layer, and a merging strategy is generated and an SQL statement is generated to merge the data tables.
The operation process is simplified, errors are reduced, and the accuracy and efficiency of data processing are improved.
Smart Images

Figure CN118331994B
Abstract
Description
Technical Field
[0001] The present application relates to data processing related fields, and in particular to a method and device for merging data using stacked perspective. Background Art
[0002] In the field of data processing and analysis, it is often necessary to merge multiple data tables from different data sources with different structures and contents in order to perform unified data analysis and presentation. When merging these data tables, since each data table may contain different fields and different amounts of data, how to determine the merged data table structure, field priority, and merging strategy becomes an important issue. In the existing data processing process, when multiple data tables need to be merged, it is usually completed by writing SQL statements. This method requires a high level of technical skills and experience. For non-professional data processing personnel, it is difficult to write and it is easy to cause errors due to inaccurate understanding of the data structure or negligence in writing.
[0003] At present, relevant technologies have technical problems such as complex operations, prone to errors, and difficulty in ensuring the accuracy of data processing. Summary of the invention
[0004] The present application provides a method and device for merging data using stacked perspectives, adopts technical means such as building a data table stacked perspective model, performing stacked perspective analysis on stacked data tables, outputting data table perspective merging strategies, generating SQL statements to merge data tables, etc., to achieve the technical effect of simplifying operations, reducing errors, and improving the accuracy of data processing.
[0005] The present application provides a method for merging data using stacked perspectives, comprising:
[0006] Obtain N data tables, where N is a positive integer greater than 1, and each data table contains M data table fields; set a data table stacking order, stack the N data tables according to the data table stacking order, and obtain N stacked data tables; construct a data table stacking perspective model, the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer; perform stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, and output a data table perspective merging strategy; interpret and generate a data table sql statement according to the data table perspective merging strategy; execute the data table sql statement to obtain a data table merging result.
[0007] In a possible implementation, the obtaining of N stacked data tables involves performing the following processing:
[0008] According to the data table stacking order, the first data table among the N data tables is obtained; a data table coordinate axis is constructed, and the coordinates of the M data table fields in the first data table are marked based on the data table coordinate axis to obtain M field indicator coordinate information; the field indicators of the remaining data tables in the N data tables are arranged according to the M field indicator coordinate information to obtain the remaining data table field arrangement information; according to the first data table and the remaining data table field arrangement information, the N stacked data tables are obtained.
[0009] In a possible implementation, the data table stacking perspective model is constructed by performing the following processing:
[0010] Obtain data indicator pivot rules, the data indicator pivot rules including non-null value rules, specified table rules, specified table non-null value rules, maximum / minimum field value rules, date screening rules, and priority sorting rules; perform attribute matching training on the M data table fields based on the data indicator pivot rules to generate the pivot rule matching layer; perform pivot merge program configuration on the M data table fields based on the pivot rule matching layer to obtain the data pivot merge layer; connect the pivot rule matching layer and the data pivot merge layer by functional layer to construct the data table stacking perspective model.
[0011] In a possible implementation, the generating of the perspective rule matching layer includes performing the following processing:
[0012] Perform indicator attribute analysis on the M data table fields to determine indicator attribute information of the M data table fields; perform attribute matching on the data indicator perspective rules according to the indicator attribute information of the M data table fields to obtain M field indicator perspective rules; perform matching training on the M data table fields based on the M field indicator perspective rules to generate the perspective rule matching layer.
[0013] In a possible implementation, the maximum / minimum field value rule performs the following processing:
[0014] When executing the maximum field value rule, determine whether the field value of the target order of the first data table is greater than the field value of the target order of the remaining data tables, and obtain a field determination result; if the field determination result is yes, take the field value of the target order of the first data table; if the field determination result is no, iterate and execute the field value determination program until the maximum field value is obtained by comparison, and configure the perspective merge program for the maximum field value; when the field value determination program is no, the perspective merge program takes a null value.
[0015] In a possible implementation, the priority sorting rule performs the following processing:
[0016] When executing the priority sorting rule, according to the priority sorting rule, a priority judgment indicator set is obtained, and the priority judgment indicator set includes table type, table source, data credibility, and data accuracy; based on the priority judgment indicator set, a multi-dimensional evaluation is performed on the target order fields of the N data tables to obtain priority coefficient information of the N data table fields; the target order fields of the N data tables are sorted and screened according to the priority coefficient information of the N data table fields to obtain the target priority field value, and the perspective merge program is configured for the target priority field value.
[0017] In a possible implementation, the priority coefficient information of N data table fields is obtained, and the following processing is performed:
[0018] Based on the priority evaluation indicator set, a multi-dimensional evaluation is performed on the target order fields of the N data tables to obtain multi-dimensional evaluation information of the priorities of the N fields; a weight is assigned to each evaluation indicator in the priority evaluation indicator set to determine the priority evaluation indicator weight factor information; based on the priority evaluation indicator weight factor information, a weighted calculation is performed on the multi-dimensional evaluation information of the priorities of the N fields to obtain the priority coefficient information of the N data table fields.
[0019] The present application also provides a device for merging data using stacked perspective, comprising:
[0020] A data table acquisition module, the data table acquisition module is used to acquire N data tables, wherein N is a positive integer greater than 1, and each data table contains M data table fields; a data table stacking module, the data table stacking module is used to set a data table stacking order, and the N data tables are stacked according to the data table stacking order to obtain N stacked data tables; a data table stacking perspective model construction module, the data table stacking perspective model construction module is used to construct a data table stacking perspective model, and the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer; a stacking perspective analysis module, the stacking perspective analysis module is used to perform a stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, and output a data table perspective merging strategy; a data table sql statement generation module, the data table sql statement generation module is used to interpret and generate a data table sql statement according to the data table perspective merging strategy; an execution module, the execution module is used to execute the data table sql statement to obtain a data table merging result.
[0021] A method and device for merging data using stacked perspectives proposed in the present application first obtain N data tables, where N is a positive integer greater than 1, and each data table contains M data table fields, then set the data table stacking order, stack the N data tables according to the data table stacking order, obtain N stacked data tables, and then build a data table stacking perspective model, the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer, and then perform stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, output a data table perspective merging strategy, and then interpret and generate a data table sql statement based on the data table perspective merging strategy, and finally execute the data table sql statement to obtain the data table merging result, thereby achieving the technical effect of simplifying operations, reducing errors, and improving the accuracy of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the accompanying drawings of the embodiment of the present invention will be briefly introduced below. A flow chart is used in the present application to illustrate the operations performed by the device according to the embodiment of the present application. It should be understood that the previous or following operations are not necessarily performed accurately in order. On the contrary, various steps can be processed in reverse order or simultaneously as needed. At the same time, other operations can also be added to these processes, or one or more operations can be removed from these processes.
[0023] Figure 1 A flowchart of a method for merging data using stacked perspectives provided in an embodiment of the present application.
[0024] Figure 2 A schematic diagram of a first data indicator perspective rule in a method for merging data using stacked perspectives provided in an embodiment of the present application.
[0025] Figure 3 A schematic diagram of a second data indicator perspective rule in a method for merging data using stacked perspectives provided in an embodiment of the present application.
[0026] Figure 4 A schematic diagram of a third data indicator perspective rule in a method for merging data using stacked perspectives provided in an embodiment of the present application.
[0027] Figure 5 A flowchart of executing a maximum field value rule in a method for merging data using cascading perspectives provided in an embodiment of the present application.
[0028] Figure 6 A schematic diagram of the structure of a device for merging data using stacked perspectives provided in an embodiment of the present application.
[0029] Description of the reference numerals: data table acquisition module 10 , data table stacking module 20 , data table stacking perspective model building module 30 , stacking perspective analysis module 40 , data table SQL statement generation module 50 , execution module 60 . DETAILED DESCRIPTION
[0030] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below.
[0031] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0032] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict, and the terms "first\second" involved are merely to distinguish similar objects and do not represent a specific ordering of objects. The terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products, or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by technicians in the technical field of this application. The terms used herein are for the purpose of describing the embodiments of the present application only.
[0033] The present application embodiment provides a method for merging data using stacked perspectives, such as Figure 1 As shown, the method includes:
[0034] Step S100, obtain N data tables, where N is a positive integer greater than 1, and each data table contains M data table fields. Specifically, according to business needs or analysis objectives, determine the number of data tables N that need to be included in the merge scope, where a data table is a two-dimensional table for storing data, consisting of rows (records) and columns (fields), and the data table structure includes field names, field types, etc. Each data table has a unique name for identifying it in the database, and N is a positive integer greater than 1. Through the query function of the database management system (such as MySQL, Oracle, SQL Server, etc.), retrieve and obtain these N data tables from the database. If the data tables are stored in other formats (such as CSV, Excel, etc.), use the corresponding file reading tool or library (such as Python's pandas library) to load these data tables. After obtaining the data tables, verify whether the structure of each data table meets the requirements for merging, so that each data table contains M fields. In the data table, a field is a column that makes up the table and is used to store a certain type of data. Each field has a unique name and data type. The specific value of M depends on business needs and analysis objectives. If there are differences in the data table structure (such as inconsistent field names, mismatched field types, etc.), preprocessing is performed to unify the structure.
[0035] Step S200, set the data table stacking order, stack the N data tables according to the data table stacking order, and obtain N stacked data tables. Specifically, the stacking order of the N data tables is determined according to business needs or the logical relationship between the data tables. The stacking order refers to the order in which multiple data tables are logically organized or processed. The stacking order determines the order in which the data tables are processed, which will affect the final merge result of the data tables (including the structure and content of the data tables). The stacking order can be based on time order (such as the latest data table is on the top), importance (such as data tables with higher priority are in front) or other business rules. Stack the N data tables according to the set stacking order to form a continuous data table sequence. During the stacking process, the structure of the data table (i.e., field order and type) is kept consistent.
[0036] In a possible implementation, the step S200 of obtaining N stacked data tables further includes a step S210 of obtaining the first data table in the N data tables according to the data table stacking order. Specifically, according to the predefined data table stacking order (which may be specified by the user or the system default), the first data table is selected from the N data tables as the reference data table, that is, the first data table (the data table at the front in the stacking order). Step S220, constructing a data table coordinate axis, and marking the coordinates of the M data table fields in the first data table based on the data table coordinate axis to obtain M field indicator coordinate information. Specifically, a virtual data table coordinate axis is created to identify the field position in the data table, and the M data table fields of the first data table are traversed, and a unique coordinate is assigned to each field on the coordinate axis, and the coordinate information of each field is recorded to form M field indicator coordinate information. Step S230, the field indicators of the remaining data tables in the N data tables are arranged according to the M field indicator coordinate information to obtain the remaining data table field arrangement information. Specifically, for the remaining data tables (except the first data table) in the N data tables, according to the correspondence between their fields and the fields of the first data table, their fields are arranged according to the field indicator coordinate information, and the arrangement information of each data table field is recorded to form the field arrangement information of the remaining data tables. Step S240, according to the first data table and the field arrangement information of the remaining data tables, the N stacked data tables are obtained. Specifically, according to the field arrangement information of the first data table and the field arrangement information of the remaining data tables, the N data tables are stacked in a stacking order. During the stacking process, the fields of each data table are arranged in the correct order and correspondence, and finally an ordered set of stacked data tables is obtained, in which each data table is arranged in the same field order. This implementation method clearly identifies and matches the fields in different data tables by constructing the data table coordinate axis and the field indicator coordinate information, thereby achieving the technical effect of realizing accurate field arrangement and stacking.
[0037] Step S300, constructing a data table stacking perspective model, the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer. Specifically, the data table stacking perspective model is a model for guiding the merging and analysis of data tables, including two main parts: a perspective rule matching layer and a data perspective merging layer, which can automatically apply preset rules and logic to perform stacking perspective analysis on the data table, thereby merging and sorting data. Among them, the perspective rule matching layer is used to automatically identify and match fields in the data table according to preset perspective rules, and by defining perspective rules according to business requirements and data characteristics, such as field matching rules, data type conversion rules, data screening rules, etc., the data table is analyzed in detail, the type of each field, the value range and other attributes are understood, and which fields are related to the preset perspective rules are determined. A mapping relationship with the perspective rule is created for each field through programming. In the perspective rule matching layer, an automatic matching mechanism is implemented, and when the data table is input, the field can be automatically scanned and matched according to the mapping relationship. The perspective rule matching layer is tested with actual data, and adjusted and optimized according to the test results to ensure the accuracy of rule matching. The pivot merge layer is used for data merging and integration. By defining merge rules, it determines how to merge data from different data sources and how to handle conflicting or inconsistent data. Based on the results of the pivot rule matching layer, it identifies the data source, determines the data table to be merged, and performs data merging according to the defined merge rules. The pivot rule matching layer and the pivot merge layer are integrated into a complete data table stacking pivot model, so that the model can perform stacking pivot analysis on the data table according to the set rules and logic.
[0038] In a possible implementation, the data table stacking perspective model is constructed, and step S300 further includes step S310, obtaining data indicator perspective rules, and the data indicator perspective rules include non-empty value rules, specified table rules, specified table non-empty value rules, maximum / minimum field value rules, date filtering rules, and priority sorting rules. Specifically, the data indicator perspective rules are determined, and the data indicator perspective rules define how to perform perspective merging based on the values of the data table fields. The data indicator perspective rules include: non-empty value rules (select non-empty values as perspective results), specified table rules (only take values from the specified data table), specified table non-empty value rules (select the first non-empty value from the specified data table), maximum / minimum field value rules (sort according to the value of another field, and select the largest or smallest corresponding field value), date filtering rules (filter according to the date, for example, select the latest date data to overwrite the old data), and priority sorting rules (set priorities for different rules to determine how to choose when multiple rules conflict). For example, Figure 2As shown in the figure, there are three stacked data tables, A, B and C. Each data table contains three data table fields. The non-null value rule is executed for field 1, field 2 and field 3, that is, pivoting from top to bottom, and taking the first non-null value as the result of the data table merge. Furthermore, if multiple fields have different orders, you can set a sequence number for each column, such as Figure 3 As shown, the order of field 1 is specified, that is, the table rule is specified, and the order in field 1 is set to BCA, then the merge result of field 1 is the value in table B. Furthermore, if Figure 4 As shown, there are three stacked data tables, Table A, Table B and Table C. Each data table contains two data table fields. Field 1 can be sorted and valued according to the field value of Field 2 (maximum / minimum field value rule). Assume that the rule is: set the sorting field of Field 1 to Field 2, and the sorting order is descending, that is, first arrange Field 2 in descending order according to the time sequence, and the maximum value is 2023-9-1 corresponding to Table B. Then the merged result of Field 1 is the field value B1 of Field 1 in Table B. Step S320, attribute matching training is performed on the M data table fields based on the data indicator pivot rule to generate the pivot rule matching layer. Specifically, the attributes and data types of the M data table fields are analyzed, and these field attributes are matched and trained with the data indicator pivot rule. According to the matching results, one or more pivot rule labels are generated for each field, and these labels are combined into a pivot rule matching layer. Step S330, the pivot merge program is configured for the M data table fields based on the pivot rule matching layer to obtain the data pivot merge layer. Specifically, traverse each data table field, and find its corresponding pivot rule label, according to the pivot rule label, assign a table sequence number (indicating the priority or order when merging) to each field, configure the pivot merge program, the pivot merge program uses the table sequence number and the pivot rule to merge the data table fields, generate the data pivot merge layer, and the data pivot merge layer contains the configuration and logic of the merge program. Step S340, connect the pivot rule matching layer and the data pivot merge layer by functional layer, and build the data table stacking perspective model. Specifically, connect the pivot rule matching layer and the data pivot merge layer so that they can work together, test the connected model, verify whether it merges the data table according to the expected pivot rule, adjust and optimize according to the test results, until the model meets the requirements, and finally build the data table stacking perspective model, which can effectively merge multiple data tables according to the defined pivot rule. This implementation method ensures the consistency and accuracy of data table merging by defining clear data indicator pivot rules, and achieves the technical effect of improving the efficiency and accuracy of data processing.
[0039] In a possible implementation, the step S320 of generating the perspective rule matching layer further includes step S321, performing an indicator attribute analysis on the M data table fields to determine the indicator attribute information of the M data table fields. Specifically, all the M data table fields are traversed, and for each field, the attributes such as the data type, format, and possible value range of the field are analyzed, and the indicator attribute information of the field is determined based on the analysis result of the field. For example, if the field contains date data, its indicator attribute information may be "date type". Step S322, attribute matching is performed on the data indicator perspective rule according to the indicator attribute information of the M data table fields to obtain M field indicator perspective rules. Specifically, attribute matching is performed on the data indicator perspective rule in step S310 according to the field indicator attribute information determined in step S321. For example, if a field is of date type, it will match the date filtering rule. Through attribute matching, a corresponding field indicator perspective rule is generated for each field to guide the behavior of the field during the perspective merge process. Step S323, matching training is performed on the M data table fields based on the M field indicator perspective rules to generate the perspective rule matching layer. Specifically, some training data is prepared, including instances of M data table fields, and these training data and M field indicator perspective rules are used for matching training. Through matching training, a perspective rule matching layer is generated, and the perspective rule matching layer includes the mapping relationship between each field and its corresponding field indicator perspective rule, as well as the matching logic obtained through training. This implementation method first analyzes the indicator attributes of the data table fields, and then matches the data indicator perspective rules based on these indicator attribute information, thereby ensuring that each field can be processed most appropriately according to its specific attributes, thereby achieving the technical effect of improving the pertinence and accuracy of data processing.
[0040] like Figure 5As shown, in a possible implementation, step S330 further includes step S331, when executing the maximum field value rule, judging whether the field value of the target order of the first data table is greater than the field value of the target order of the remaining data tables, and obtaining a field judgment result. Specifically, according to the data indicator pivot rule, determine the field (target order field) to which the maximum field value rule is to be applied, obtain the field values of the target order of the first data table and the remaining data tables respectively, and compare the field value of the target order of the first data table with the maximum value of the corresponding field in the remaining data tables. The comparison here is based on the numerical value of the target field (if it is a date, it is early or late; if it is a version number, it is high or low). According to the comparison result, a field judgment result is obtained, that is, whether the target field value of the first data table is greater than the target field value of the other data tables. Step S332, if the field judgment result is yes, take the field value of the target order of the first data table, if the field judgment result is no, iteratively execute the field value judgment program until the maximum field value is obtained by comparison, and configure the pivot merge program for the maximum field value. Specifically, it is determined whether the field judgment result is "yes". If it is "yes", it means that the field value of the target order in the first data table is the maximum value, and this value is directly taken as the basis for the perspective merge; if the field judgment result is "no", the field value judgment program is iteratively executed, that is, the field value of the target field in the next data table is compared in turn to see whether it is greater than the maximum value of the target field in the remaining data tables. This process continues until the maximum value is found. Once the maximum value is found, the perspective merge program is configured based on this maximum value so that the data is merged in the correct order and logic. Step S333, when the field value judgment program is no, the perspective merge program takes a null value. Specifically, in some cases, the field values of the target order in all data tables may be empty (such as NULL or missing values), or because of some logical problems (such as circular references, inconsistencies between data tables, etc.), the field value judgment program cannot find a clear maximum value. In this case, the result of the perspective merge program is set to a null value (such as NULL). This implementation ensures that when performing a pivot merge, the maximum value of the field in the target order can be accurately found and merged based on this maximum value. By setting the logic of iterative comparison and null value processing, it can handle various complex data situations, achieving the technical effect of ensuring the accuracy and consistency of the merge results.
[0041] In a possible implementation, step S330 further includes step S334, when executing the priority sorting rule, according to the priority sorting rule, a priority judgment indicator set is obtained, and the priority judgment indicator set includes table type, table source, data credibility, and data accuracy. Specifically, the business priority requirements for data table merging are clarified, and based on business requirements, a series of priority judgment indicators (standards or dimensions used to evaluate the importance of data tables in the merging process) are determined, including table type (such as whether it is a core business table), table source (such as internal data source or third-party data source), data credibility (such as whether the data has been verified), data accuracy (such as whether there are a large number of errors or inconsistencies), and the above indicators are organized into a priority judgment indicator set for data table priority evaluation. Step S335, based on the priority judgment indicator set, a multi-dimensional evaluation is performed on the target order fields of the N data tables to obtain priority coefficient information of the N data table fields. Specifically, relevant information of the N data tables to be merged is obtained, including their table types, sources, data credibility and accuracy. For each data table, a score or rating is performed according to the corresponding dimension of its information in the priority judgment indicator set. Based on the above score or rating, a priority coefficient is calculated for the target order field of each data table (a field or attribute used to determine the merge order of the data tables during the data table merge process). This priority coefficient can be a weighted average or a mathematical model output. Step S336, sort and filter the target order fields of the N data tables according to the priority coefficient information of the N data table fields, obtain the target priority field value, and configure the perspective merge program for the target priority field value. Specifically, the target order fields of the N data tables are sorted according to the field priority coefficient, and the target order fields with high priority are placed in front. From the sorted data tables, the target order field of the data table with the highest priority is selected as the target priority field value, and the target priority field value is configured in the perspective merge program so that it is given priority in the merge process. This implementation method introduces priority evaluation indicators and field priority coefficients to ensure that when merging multiple data tables, priority is given to data tables that are more important to the business and have higher quality, thereby achieving the technical effect of improving the quality of data merging.
[0042] In a possible implementation, the priority coefficient information of N data table fields is obtained, and step S335 further includes step S3351, performing a multi-dimensional evaluation on the target order fields of the N data tables based on the priority judgment indicator set to obtain multi-dimensional evaluation information of N field priorities. Specifically, an evaluation information record is created for the target order field of each data table to store the results of the multi-dimensional evaluation, and each target order field of each data table is evaluated one by one according to the priority judgment indicator set. Each judgment indicator will be given an evaluation value or score, and the evaluation value or score of each target order field on each judgment indicator is recorded in the corresponding evaluation information record to form multi-dimensional evaluation information of N field priorities. Step S3352, weights are assigned to each evaluation indicator in the priority judgment indicator set to determine the priority evaluation indicator weight factor information. Specifically, according to business needs, data quality requirements and other factors, analyze the importance of each evaluation indicator in determining the priority of the data table field. Based on the above analysis, assign a weight value to each evaluation indicator. The weight value is a number between 0 and 1, and the sum of the weight values of all evaluation indicators is 1. The weight value of each evaluation indicator is recorded in the priority evaluation indicator weight factor information. Step S3353, based on the priority evaluation indicator weight factor information, weighted calculation is performed on the N field priority multidimensional evaluation information to obtain the N data table field priority coefficient information. Specifically, for each target order field of the data table, its evaluation value or score on each evaluation indicator is multiplied by the weight value of the evaluation indicator, and then all products are added to obtain the priority coefficient of the target order field, and the priority coefficient of each target order field is recorded in the N data table field priority coefficient information. This implementation method can flexibly adjust the importance of different evaluation indicators in the priority determination process according to business needs and data quality requirements through weight allocation. Ultimately, the field priority coefficient obtained through weighted calculation can more accurately reflect the priority of the data table field in the merging process, achieving the technical effect of ensuring the quality of the merging results.
[0043] Step S400, based on the data table stacking perspective model, the N stacked data tables are subjected to stacking perspective analysis, and a data table perspective merge strategy is output. Specifically, N stacked data tables that need to be subjected to stacking perspective analysis are loaded, and the loaded data tables are passed to the perspective rule matching layer. The perspective rule matching layer matches and filters the fields of the data tables according to the preset perspective rules, and the matched data is passed to the data perspective merge layer. The data perspective merge layer performs data integration and merge operations according to the defined merge rules, and based on the results of the stacking perspective analysis, a detailed data table perspective merge strategy is generated, including specific merge steps, field mapping relationships, data cleaning and conversion rules, etc.
[0044] Step S500, interpret and generate data table sql statements according to the data table pivot merge strategy. Specifically, the data table pivot merge strategy describes how to merge multiple data tables according to the pivot rule, determine the main structure and type (such as SELECT, JOIN, INSERT, etc.) of the data table sql statement (a structured query language statement used to perform data operations in the database) according to the data table pivot merge strategy, create the basic framework of the data table sql statement, including the necessary table and field references, set the correct field references in the data table sql statement according to the field mapping relationship in the data table pivot merge strategy, if there are data conversion rules, use sql functions or expressions to implement these conversions, convert the data table pivot merge strategy into a specific data table sql statement, optimize and test the generated data table sql statement so that it can be executed correctly and return the expected results.
[0045] Step S600, execute the data table sql statement to obtain the data table merge result. Specifically, submit the generated data table sql statement to the database for execution, wait for the database to return the execution result, verify and process the returned result by querying the target data table or using other database management tools (modify sql statements, adjust database configuration, optimize database performance, etc.), and output the final data table merge result to a specified location (such as a file, database table, interface display, etc.). The embodiment of the present application adopts technical means such as constructing a data table stacking perspective model, performing stacking perspective analysis on stacked data tables, outputting data table perspective merge strategies, and generating sql statements to merge data tables, so as to achieve the technical effect of simplifying operations, reducing errors, and improving the accuracy of data processing.
[0046] In the above, refer to Figure 1-Figure 5 A method for merging data using stacked perspective according to an embodiment of the present invention is described in detail. Figure 6 A device for merging data using stacked perspectives according to an embodiment of the present invention is described.
[0047] According to an embodiment of the present invention, a device for merging data using stacked perspective is used to solve the technical problems of the prior art that the operation is complex, error-prone, and the accuracy of data processing is difficult to ensure, so as to achieve the technical effect of simplifying the operation, reducing errors, and improving the accuracy of data processing. A device for merging data using stacked perspective includes: a data table acquisition module 10, a data table stacking module 20, a data table stacked perspective model construction module 30, a stacked perspective analysis module 40, a data table SQL statement generation module 50, and an execution module 60.
[0048] The data table acquisition module 10 is used to acquire N data tables, where N is a positive integer greater than 1, and each data table contains M data table fields; the data table stacking module 20 is used to set the data table stacking order, and stack the N data tables according to the data table stacking order to obtain N stacked data tables; the data table stacking perspective model construction module 30 is used to construct a data table stacking perspective model, and the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer; the stacking perspective analysis module 40 is used to perform a stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, and output a data table perspective merging strategy; the data table sql statement generation module 50 is used to interpret and generate a data table sql statement according to the data table perspective merging strategy; the execution module 60 is used to execute the data table sql statement to obtain a data table merging result.
[0049] The specific configuration of the data table stacking module 20 will be described in detail below. As described above, to obtain N stacked data tables, the data table stacking module 20 may further include: a first data table acquisition unit for obtaining the first data table in the N data tables according to the data table stacking order; a coordinate identification unit for constructing a data table coordinate axis, and performing coordinate identification on the M data table fields in the first data table based on the data table coordinate axis to obtain M field indicator coordinate information; a field indicator arrangement unit for arranging the field indicators of the remaining data tables in the N data tables according to the M field indicator coordinate information to obtain the remaining data table field arrangement information; and a stacked data table acquisition unit for obtaining the N stacked data tables according to the first data table and the remaining data table field arrangement information.
[0050] The specific configuration of the data table stacking perspective model building module 30 will be described in detail below. As described above, to build a data table stacking perspective model, the data table stacking perspective model building module 30 may further include: a data indicator perspective rule acquisition unit is used to obtain data indicator perspective rules, and the data indicator perspective rules include non-null value rules, specified table rules, specified table non-null value rules, maximum / minimum field value rules, date screening rules, and priority sorting rules; an attribute matching training unit is used to perform attribute matching training on the M data table fields based on the data indicator perspective rules to generate the perspective rule matching layer; a perspective merge program configuration unit is used to perform perspective merge program configuration on the M data table fields based on the perspective rule matching layer to obtain the data perspective merge layer; a functional layer connection unit is used to connect the perspective rule matching layer and the perspective merge layer at the functional layer to build the data table stacking perspective model.
[0051] Among them, for generating the perspective rule matching layer, the attribute matching training unit may further include: an indicator attribute analysis subunit for performing indicator attribute analysis on the M data table fields to determine the indicator attribute information of the M data table fields; an attribute matching subunit for performing attribute matching on the data indicator perspective rules according to the indicator attribute information of the M data table fields to obtain M field indicator perspective rules; a matching training subunit for performing matching training on the M data table fields based on the M field indicator perspective rules to generate the perspective rule matching layer.
[0052] Among them, the perspective merge program configuration unit may further include: a field judgment subunit is used to judge whether the field value of the target order of the first data table is greater than the field value of the target order of the remaining data tables when executing the maximum field value rule, and obtain a field judgment result; a judgment result processing subunit is used to take the field value of the target order of the first data table if the field judgment result is yes, and iteratively execute the field value judgment program if the field judgment result is no, until the maximum field value is obtained by comparison, and configure the perspective merge program for the maximum field value; when the field value judgment program is no, the perspective merge program takes a null value.
[0053] Among them, the perspective merge program configuration unit may further include: a priority judgment indicator set acquisition subunit is used to obtain a priority judgment indicator set according to the priority sorting rule when executing the priority sorting rule, and the priority judgment indicator set includes table type, table source, data credibility, and data accuracy; a multidimensional evaluation subunit is used to perform multidimensional evaluation on the target order fields of the N data tables based on the priority judgment indicator set to obtain priority coefficient information of the N data table fields; a sorting and filtering subunit is used to sort and filter the target order fields of the N data tables according to the priority coefficient information of the N data table fields, obtain the target priority field value, and configure the perspective merge program for the target priority field value.
[0054] Among them, the obtaining of priority coefficient information of N data table fields, the multidimensional evaluation subunit may further include: a multidimensional evaluation micro-unit for performing multidimensional evaluation on the target order fields of the N data tables based on the priority judgment indicator set, to obtain multidimensional evaluation information of N field priorities; a weight allocation micro-unit for performing weight allocation on each evaluation indicator in the priority judgment indicator set, to determine priority evaluation indicator weight factor information; a weighted calculation micro-unit for performing weighted calculation on the multidimensional evaluation information of the N field priorities based on the priority judgment indicator weight factor information, to obtain priority coefficient information of the N data table fields.
[0055] The device for merging data using stacked perspective provided by the embodiment of the present invention can execute the method for merging data using stacked perspective provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0056] Although the present application makes various references to certain modules in the device according to the embodiments of the present application, any number of different modules may be used and run on the user terminal and / or server, and the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0057] The above specific implementation manner does not constitute a limitation to the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the protection scope of the present application. In some cases, the actions or steps recorded in the present application can be performed in an order different from that in the embodiment and can still achieve the desired results. In addition, the process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A method for merging data using stacked perspectives, characterized in that: The method comprises: Obtain N data tables, where N is a positive integer greater than 1, and each data table contains M data table fields; Setting a data table stacking order, and stacking the N data tables according to the data table stacking order to obtain N stacked data tables; Constructing a data table stacking perspective model, wherein the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer; Performing stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, and outputting a data table perspective merging strategy; According to the data table pivot merge strategy, interpret and generate the data table sql statement; Execute the data table sql statement to obtain the data table merging result; The step of constructing a data table stacking perspective model includes: Obtain data indicator pivot rules, wherein the data indicator pivot rules include non-null value rules, specified table rules, specified table non-null value rules, maximum / minimum field value rules, date screening rules, and priority sorting rules; Performing attribute matching training on the M data table fields based on the data indicator perspective rule to generate the perspective rule matching layer; Performing a perspective merging program configuration on the M data table fields based on the perspective rule matching layer to obtain the data perspective merging layer; The perspective rule matching layer and the data perspective merging layer are connected at a functional level to construct the data table stacking perspective model.
2. A method for merging data using stacked perspectives as claimed in claim 1, characterized in that: The obtaining of N stacked data tables includes: According to the data table stacking order, obtaining the first data table of the N data tables; Constructing a data table coordinate axis, and marking the coordinates of the M data table fields of the first data table based on the data table coordinate axis to obtain coordinate information of M field indicators; Arranging the field indicators of the remaining data tables of the N data tables according to the M field indicator coordinate information to obtain the field arrangement information of the remaining data tables; The N stacked data tables are obtained according to the field arrangement information of the first data table and the remaining data tables.
3. A method for merging data using stacked perspectives as claimed in claim 2, characterized in that: The generating the perspective rule matching layer comprises: Performing an indicator attribute analysis on the M data table fields to determine indicator attribute information of the M data table fields; According to the attribute information of the M data table field indicators, attribute matching is performed on the data indicator perspective rule to obtain M field indicator perspective rules; Matching training is performed on the M data table fields based on the M field indicator perspective rules to generate the perspective rule matching layer.
4. A method for merging data using stacked perspectives as claimed in claim 2, characterized in that: The method comprises: When executing the maximum field value rule, determining whether the field value of the target order of the first data table is greater than the field value of the target order of the remaining data tables, and obtaining a field determination result; If the field judgment result is yes, the field value of the target order of the first data table is obtained; if the field judgment result is no, the field value judgment program is iteratively executed until the maximum field value is obtained by comparison, and the perspective merging program is configured for the maximum field value; When the field value judgment procedure is no, the perspective merge procedure takes a null value.
5. A method for merging data using stacked perspectives as claimed in claim 2, characterized in that: The method comprises: When executing the priority sorting rule, obtaining a priority evaluation indicator set according to the priority sorting rule, the priority evaluation indicator set includes table type, table source, data credibility, and data accuracy; Performing a multi-dimensional evaluation on the target order fields of the N data tables based on the priority evaluation indicator set to obtain priority coefficient information of the N data table fields; The target order fields of the N data tables are sorted and screened according to the priority coefficient information of the N data table fields to obtain the target priority field value, and the perspective merge program is configured for the target priority field value.
6. A method for merging data using stacked perspectives as claimed in claim 5, characterized in that: The obtaining of priority coefficient information of N data table fields includes: Performing a multi-dimensional evaluation on the target order fields of the N data tables based on the priority evaluation indicator set to obtain N field priority multi-dimensional evaluation information; Allocating weights to the evaluation indicators in the priority evaluation indicator set to determine the priority evaluation indicator weight factor information; Based on the priority judgment indicator weight factor information, weighted calculation is performed on the N field priority multi-dimensional evaluation information to obtain the N data table field priority coefficient information.
7. A device for merging data using stacked perspectives, characterized in that: The device is used to implement a method for merging data using stacked perspectives as described in any one of claims 1 to 6, and the device comprises: A data table acquisition module, wherein the data table acquisition module is used to acquire N data tables, wherein N is a positive integer greater than 1, and each data table contains M data table fields; A data table stacking module, the data table stacking module is used to set a data table stacking sequence, and stack the N data tables according to the data table stacking sequence to obtain N stacked data tables; A data table stacking perspective model building module, wherein the data table stacking perspective model building module is used to build a data table stacking perspective model, wherein the data table stacking perspective model includes a perspective rule matching layer and a data perspective merging layer; A stacking perspective analysis module, the stacking perspective analysis module is used to perform a stacking perspective analysis on the N stacked data tables based on the data table stacking perspective model, and output a data table perspective merging strategy; A data table sql statement generation module, the data table sql statement generation module is used to interpret and generate data table sql statements according to the data table pivot merge strategy; An execution module is used to execute the data table SQL statement to obtain the data table merging result.
