Association data generation method and device based on data table
By using a data table-based association method to automatically associate data with sub-tables and preset rules, the high maintenance costs and high error rates caused by business logic dependencies in existing technologies are solved, and more reliable and accurate test data generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- IND BANK CO
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-24
AI Technical Summary
In software testing, existing technologies rely on manually defining and maintaining business logic association rules to generate data associations, which leads to high maintenance costs, significant synchronization lag risks, and frequent human errors, affecting the accuracy of test results.
By obtaining the number of records and field list of the target table and the associated source table, a secondary table is created and data is associated according to preset rules. Data is directly obtained using the associated field list of the data table structure, reducing dependence on business logic and automatically expanding the data source to improve the reliability of associated data generation.
This improves the reliability of associated data generation, thereby increasing the accuracy of test results and reducing maintenance costs and the incidence of human error.
Smart Images

Figure CN121919221A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method and apparatus for generating related data based on data tables. Background Technology
[0002] In the field of software testing, data creation usually refers to constructing test data. The quality of the test data is related to the test results, which in turn affects the quality of the final software product.
[0003] Currently, in the data generation process of R&D testing, the data is usually generated based on pure business logic association rules (not physical association of table structure). Developers generate data associations at the application layer by defining and maintaining business logic association rules between data entities.
[0004] However, in scenarios where business logic changes frequently, business logic association rules require developers to continuously update them manually, resulting in extremely high maintenance costs. Because these rules rely on manual writing and memorization, they are prone to errors or being out of sync with the latest business logic, generating invalid or even erroneous test data, leading to a high error rate and misleading test results.
[0005] This section is intended to provide background or context for the embodiments of the invention set forth in the claims. The description herein is not an admission that it is prior art simply because it is included in this section. Summary of the Invention
[0006] To address at least one problem in the prior art, this application proposes a method and apparatus for generating related data based on data tables, which can improve the reliability of the generated data and thus improve the accuracy of the test results.
[0007] To address the aforementioned technical problems, this application provides the following technical solution:
[0008] Firstly, this application provides a method for generating relational data based on data tables, including:
[0009] Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0010] Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0011] A second sub-table is created from the target table. Data is generated from the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0012] The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the first sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
[0013] In one embodiment, the loop adds records from the associated source table to the first sub-table, and further includes adding a sequence number of each record to the first sub-table in an auto-incrementing pattern;
[0014] Correspondingly, generating multiple records in the second sub-table also includes adding a sequence number to each record in the second sub-table in an auto-incrementing mode.
[0015] In one embodiment, the step of retrieving the data of the non-related fields from the second sub-table, retrieving the data of the related fields from the first sub-table according to the list of related fields, and adding the data of the non-related fields and the data of the related fields to the target table to complete the creation of related data for the target table includes:
[0016] The data from the associated field and the data from the non-associated field corresponding to the same serial number are combined into a record and added to the target table to complete the associated data generation.
[0017] In one embodiment, after determining whether the number of records in the associated source table is less than the preset required number of records, the method further includes:
[0018] If the number of records is greater than or equal to the preset number of required records, then a third sub-table of the associated source table is created, and the records in the associated source table are added to the third sub-table;
[0019] A second sub-table is created from the target table. Data is generated from the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0020] The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the third sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
[0021] In one embodiment, obtaining the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table includes:
[0022] Receive the unique identifier of the associated source table corresponding to the target table selected by the user from the front end, as well as the list of associated fields of the associated source table;
[0023] Based on the unique identifier of the associated source table, obtain the number of records in the associated source table.
[0024] In one embodiment, after adding the data of the non-related field and the data of the related field to the target table, the method further includes:
[0025] Check whether the target table has achieved the target effect. If so, delete the first and second sub-tables.
[0026] Secondly, this application provides a data table-based association data generation device, comprising:
[0027] The acquisition module is used to acquire the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0028] The first creation module is used to determine whether the number of records in the associated source table is less than the preset number of required records. If so, the first sub-table of the associated source table is created, and the records in the associated source table are added to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0029] The second creation module is used to create a second sub-table of the target table, and to generate data for the non-related fields in the target table according to the preset data generation rules, thereby generating multiple records in the second sub-table. Each record includes the data of the non-related fields, and the number of records in the second sub-table is greater than or equal to the preset required number of records.
[0030] The associated data generation module is used to obtain the data of the non-associated fields from the second sub-table, obtain the data of the associated fields from the first sub-table according to the associated field list, and add the data of the non-associated fields and the data of the associated fields to the target table to complete the associated data generation for the target table.
[0031] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described thereon.
[0032] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method.
[0033] Fifthly, this application provides a computer program product, the computer program product comprising a computer program that, when executed by a processor, implements the method described above.
[0034] As can be seen from the above technical solution, obtaining the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table, wherein the list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table; determining whether the number of records in the associated source table is less than the preset required number of records, if so, then establishing a first sub-table of the associated source table, and cyclically adding the records in the associated source table to the first sub-table until the number of records in the first sub-table is greater than or equal to the preset required number of records; establishing a second sub-table of the target table, generating multiple records in the second sub-table by generating numbers for the non-associated fields in the target table according to preset number generation rules, each record including: the data of the non-associated fields, wherein the number of records in the second sub-table is greater than or equal to the preset required number of records; obtaining the data of the non-associated fields from the second sub-table, obtaining the data of the associated fields from the first sub-table according to the list of associated fields, and adding the data of the non-associated fields and the data of the associated fields to the target table, thereby completing the associated number generation for the target table, can improve the reliability of associated number generation and thus improve the accuracy of test results. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0036] Figure 1 This is a first flowchart illustrating the association-based number generation method based on a data table in an embodiment of this application;
[0037] Figure 2This is a second flowchart illustrating the association-based number generation method based on data tables in an embodiment of this application;
[0038] Figure 3 This is a schematic diagram of the third process of the association-based number generation method based on data tables in the embodiments of this application;
[0039] Figure 4 This is a schematic diagram of the structure of the data table-based association data generation device in the embodiments of this application;
[0040] Figure 5 This is a schematic block diagram of the system configuration of an electronic device according to an embodiment of this application. Detailed Implementation
[0041] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0042] Traditional methods rely on developers to manually define and maintain business logic association rules. When business logic changes frequently, these rules need to be updated synchronously, which can easily lead to:
[0043] (1) High maintenance cost: Every business change requires developers to manually modify the association rules.
[0044] (2) Risk of synchronization lag: Rule updates may lag behind changes in business logic, resulting in the generated test data being out of sync with the actual business.
[0045] (3) Human error: When manually writing rules, errors in association may occur due to memory errors or negligence.
[0046] To address the challenges and high error rates in current data generation for R&D testing, which relies on purely business logic association rules (not physical table structure associations), this application provides a table-based association data generation method and apparatus. This method combines native SQL with database features to assist Java programs. It generates corresponding sub-tables for the source and target tables, along with matching sequences. Values from the sub-tables are selected based on the data volume and field data characteristics of different tables and then transferred to the target table, establishing a standard data flow process to achieve the goal of association data generation. Specifically, it can be based on association rules within the table structure: the association field list is obtained directly from the table's metadata (such as field correspondences) rather than relying on business logic rules. For example, the association field list explicitly records the field correspondence between the target table and the source table (e.g., the user ID field in the order table is associated with the user ID field in the user table). Users can directly configure the source table and field list through the front-end interface, reducing coding dependencies. It can automatically expand the data source: when the source table has insufficient records, it expands the record count by copying data from the original table to the sub-table (e.g., the first sub-table), rather than relying on business logic to generate new data. This physical replication method avoids the impact of changes in business logic.
[0047] The following examples illustrate this in detail.
[0048] To improve the reliability of associated data generation, embodiments of this application provide a data table-based associated data generation method, where the execution subject is a data table-based associated data generation device. Figure 1 As shown, this method specifically includes the following:
[0049] Step 100: Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0050] Specifically, the target table can be used to store the final expected test data, including: related fields and non-related fields. The field values (i.e., data) of the related fields can be extracted and imported into the target table through the related fields and the related source table. Data can be generated for the non-related fields according to preset data generation rules and imported into the target table. The related source table can represent the source table associated with the target table, used to provide data to the target table. The number of records in the related source table can be the number of rows in the related source table. For example, the table structure of the target table can be as shown in Table 1. As shown in Table 1, the related source tables corresponding to the target table include: tables A, B, and C; x_address is a related field, and its corresponding associated field is address in table A; x_datetime is a related field, and its corresponding associated field is datetime in table A; x_currency is a related field, and its corresponding associated field is currency in table C; x_name is a related field, and its corresponding associated field is name in table B; x_ssn is a related field, and its corresponding associated field is ssn in table B. The list of associated fields for Table A may include: the correspondence between x_address and address, and the correspondence between x_datetime and datetime.
[0051] Table 1
[0052]
[0053] For example, Table A can be shown as Table 2 below:
[0054] Table 2
[0055]
[0056] Step 200: Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0057] Specifically, the preset number of required records represents the expected number of records to be created in the target table, which can be set according to actual conditions, and this application does not impose any restrictions on this. The first sub-table is a sub-table of the related source table created when the number of records in the related source table is less than the preset number of required records. The table structure of the first sub-table can be based on the related source table with the addition of a sequence number column.
[0058] In the example above, the first sub-table of Table A can be shown as Table 3 below:
[0059] Table 3
[0060]
[0061] Step 300: Create a second sub-table of the target table. Generate data for the non-related fields in the target table according to the preset data generation rules to generate multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0062] Specifically, the correspondence between data generation rules and fields can be pre-set according to actual needs. From the correspondence between data generation rules and fields, the data generation rule corresponding to the non-related field is determined, and the data generation rule is applied to complete the data generation of the non-related field. The preset data generation rule may include: generating random characters, generating random numbers, fixing dates, specifying date ranges, etc. The second sub-table is a sub-table of the target table. The table structure of the second sub-table can be based on the target table with an added column of serial numbers. In the above example, after generating data for the non-related fields in the target table according to the preset data generation rule, the second sub-table can be as shown in Table 4:
[0063] Table 4
[0064]
[0065] Step 400: Obtain the data of the non-related fields from the second sub-table, obtain the data of the related fields from the first sub-table according to the list of related fields, and add the data of the non-related fields and the data of the related fields to the target table to complete the associated data generation corresponding to the target table.
[0066] Specifically, some fields in the target table may require data generation, while others may require joins. Temporary tables are automatically created to store the generated and joined data respectively. The data generation process is the same as for single-table data generation, while the join data generation process reads data from the target table. There is no limit to the number of source tables to be joined. The temporary tables are then merged, and the values are inserted into the target table, thus completing the join data generation.
[0067] In the example above, after completing the association data generation corresponding to the target table, the target table can be as shown in Table 5 below, with n+3 records in the target table.
[0068] Table 5
[0069]
[0070] To ensure data consistency, in one embodiment, step 200, which involves cyclically adding records from the associated source table to the first sub-table, further includes adding a sequence number to each record in the first sub-table in an auto-incrementing pattern. Correspondingly, step 300, which involves generating multiple records in the second sub-table, further includes adding a sequence number to each record in the second sub-table in an auto-incrementing pattern.
[0071] Specifically, records from the associated source table can be added to the first sub-table in a top-to-bottom order. For each new record, the sequence number is increased by a preset amount compared to the sequence number of the previous record. The sequence number of the first record in the first sub-table is the initial sequence number value. Adding sequence numbers to the second sub-table is done in the same way as adding them to the first sub-table. Records can be created in the second sub-table in a top-to-bottom order. For each new record, the sequence number is increased by a preset amount compared to the sequence number of the previous record. The sequence number of the first record in the second sub-table is the initial sequence number value. Both the preset increase amount and the initial sequence number value can be set according to actual conditions, and this application does not impose any restrictions on this.
[0072] Furthermore, a fourth sub-table can be created for the associated source table. Records from the associated source table are added to the fourth sub-table in a loop, and records from the fourth copy are added to the first sub-table. A sequence number for each record is added to the first sub-table in an auto-incrementing pattern. The fourth sub-table can have the same structure as the associated source table.
[0073] In one embodiment, step 400 includes: combining the data of the associated field and the data of the non-associated field corresponding to the same sequence number into a record, adding it to the target table, and completing the associated data creation.
[0074] To improve the reliability of constructing a secondary table from a related source table, such as... Figure 2 As shown, in one embodiment, after determining whether the number of records in the associated source table is less than the preset required number of records in step 200, the method further includes:
[0075] Step 500: If the number of records is greater than or equal to the preset number of required records, then create a third sub-table of the associated source table and add the records from the associated source table to the third sub-table.
[0076] Specifically, the third sub-table can be a sub-table created when the number of records in the associated source table is greater than or equal to the preset required number of records. The table structure of the third sub-table can be based on the associated source table with the addition of a sequence number column.
[0077] Step 600: Create a second sub-table of the target table. Generate data for the non-related fields in the target table according to the preset data generation rules to generate multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0078] Step 700: Obtain the data of the non-related fields from the second sub-table, obtain the data of the related fields from the third sub-table according to the list of related fields, and add the data of the non-related fields and the data of the related fields to the target table to complete the associated data generation corresponding to the target table.
[0079] To improve the ease and flexibility of binding target tables, related source tables, and related source table fields, and to reduce the requirements for user development capabilities, such as... Figure 3 As shown, in one embodiment, step 100 includes:
[0080] Step 101: Receive the unique identifier of the associated source table corresponding to the target table selected by the user from the front end, as well as the list of associated fields of the associated source table.
[0081] Step 102: Obtain the number of records in the associated source table based on the unique identifier of the associated source table.
[0082] Specifically, the unique identifier of the source table can be its name. For example, you can prepare three source tables (A, B, and C) with data in advance (data can be generated beforehand). Prepare the target table (X) to be associated with the data. Select whether to generate data or associate data for the fields of table X. For data association, you need to select the tables and fields to be associated, such as associating field 1 of table X with field 3 of table A, or associating field 2 of table X with field 1 of table B, etc. After making the selection, save and enter the quantity to start generating data. You can view the log. The data generation is complete.
[0083] To save storage pressure, in one embodiment, after step 400, the method further includes:
[0084] Check whether the target table has achieved the target effect. If so, delete the first and second sub-tables.
[0085] Specifically, the target table, the preset number of required records, and the list of associated fields can be input into a preset performance evaluation model. The output of the preset performance evaluation model is determined as the performance score of the target table. If the performance score of the target table reaches the preset target performance score, the target table is determined to have achieved the target performance and meets the testing requirements. The preset performance evaluation model can be obtained by pre-training a logistic regression algorithm based on a batch of historical target tables and their corresponding actual performance scores. The preset target performance score can be set according to the actual situation, and this application does not impose any restrictions on it.
[0086] Furthermore, in order to further improve the reliability of the associated data generation, if the detection determines that the target table has not achieved the target effect, the first sub-table and the second sub-table can be deleted, and steps 100 to 400 can be executed again until the target table achieves the target effect.
[0087] To further illustrate this solution, this application provides an application example of an association-based data generation method. In this application example, the method includes:
[0088] Step 1: Analysis of the Relationship between the Source and Target Tables: Analyze the relationship between the source and target tables, including table relationships, field relationships, and the quantity of data to be generated. The quantity relationship includes the number of rows of data already existing in the source table. This quantity relationship will affect Step 2. Step 1 includes:
[0089] Step 1.1: Analyze and summarize the related source tables and related fields of the target table to obtain a list of related source tables and a list of related fields. The list of related source tables may include: a unique identifier of the related source table corresponding to the target table, such as the table name. There may be multiple related source tables corresponding to the target table. The list of related fields for each related source table includes: the related fields between the target table and that related source table, and there may be multiple related fields.
[0090] Step 1.2: Query the number of rows that already contain data in each associated source table.
[0091] Step 2: Creating and processing the subsidiary tables of the source table: Based on the table relationships, field relationships, and quantity relationships obtained in Step 1, create one or two subsidiary tables for the source table and populate the corresponding data into the subsidiary tables. Step 2 includes:
[0092] Step 2.1: Based on the number of rows in the source table obtained in Step 1, if the number of rows is greater than the number of rows in the target table, then execute Steps 2.2.1-2.2.2. If the amount of data is less than the number of rows in the target table, then execute Steps 2.3.1-2.3.3. The number of rows in the target table can be equivalent to the preset number of required records mentioned above.
[0093] Step 2.2.1: Create a secondary table that relates to the source table. The table structure of the secondary table is basically the same as that of the source table, except that it adds a sequence number field. This secondary table can be considered equivalent to the third secondary table mentioned above.
[0094] Step 2.2.2: Input the data values from the related source table into the secondary table of the related source table, with the serial number field in auto-increment mode.
[0095] Step 2.3.1: Create two sub-tables related to the source table. Sub-table 1: The sub-table's structure is basically the same as the source table. Sub-table 2: The sub-table's structure is basically the same as the source table, but with the addition of a sequence number field.
[0096] Step 2.3.2: Continuously inject data values from the source table into Sub-Table 1 until the amount of data in Sub-Table 1 is greater than or equal to that in the target table.
[0097] Step 2.3.3: Input the data values from the source table, Sub-Table 1, into Sub-Table 2, with the serial number field in auto-increment mode. Here, Sub-Table 1 can be considered equivalent to the first sub-table mentioned above.
[0098] Step 3: Creating a Sub-Table for the Target Table and Generating Data for Unrelated Fields: Create a sub-table for the target table and generate data for the corresponding unrelated fields in the original target table. Step 3 includes:
[0099] Step 3.1: Create a sub-table of the target table, which adds a sequence number field to the target table. This sub-table can be equivalent to the second sub-table mentioned above.
[0100] Step 3.2: For the non-related fields in the sub-table of the target table, generate numbers according to business requirements, and assign an incrementing sequence number to the sequence number field.
[0101] Step 4: Data Acquisition from the Target Table: Transfer the data from the secondary tables in Steps 2 and 3 into the target table. Finally, delete and drop all secondary tables to complete the entire process. Step 4 includes:
[0102] Step 4.1: Insert the data of the corresponding fields of the sub-table in Step 2 (if the data volume of the source table is greater than the data volume of the target table, the sub-table refers to the corresponding sub-table of the source table; if the data volume of the source table is less than the data volume of the target table, the sub-table refers to sub-table 2 in Step 2.3.3) and the sub-table in Step 3 (the sub-table of the target table in Step 3.2) into the target table.
[0103] Step 4.2: Check if the target table has achieved the target effect. If it has, delete all sub-tables and end the process; if it has not achieved the target effect, delete all sub-tables and repeat steps 1-4.
[0104] For example, table D is the target table to be created, and tables A, B, and C are the data retrieval tables, i.e., the related source tables. Related data generation methods include:
[0105] Establish the correspondence between the source and target tables; begin processing the source table A. Since the number of related fields in source table A is greater than the number of target fields, a temporary table A_TMP is planned to be created (i.e., a secondary table); creation of the temporary table A_TMP begins; a sequence number field ZSPT_ID is added to A_TMP; the target field content of A_TMP is retrieved and assigned to ZSPT_ID; A_TMP successfully retrieves the target field content and assigns a value to ZSPT_ID; begin processing the source table B. Since the number of related fields in source table B is less than the number of target fields, two temporary tables B_TMP and B_tmp_1 are planned to be created; creation of the temporary table B_TMP_1 begins; the corresponding field values are retrieved from table B in a loop; creation of the temporary table B_TMP begins; a sequence number field ZSPT_ID is added to B_TMP; the target field content of B_TMP is retrieved from B_TMP_1, inserted into B_TMP, and ZSPT_ID is assigned a value.
[0106] P successfully retrieved the content of the target field B_TMP_1 and assigned a value to ZSPT_ID...
[0107] The process begins: creating a temporary table D_TMP; adding a sequence number field ZSPT_ID to D_TMP; retrieving field names from D_TMP; concatenating the corresponding construction rules for D_TMP; and starting to generate data for ZSPT_ID and non-related fields in the D_TMP table...
[0108] The program begins by retrieving the contents of the corresponding fields from A_TMP, B_TMP, C_TMP, and D_TMP respectively and importing them into the target table D; the import is successful.
[0109] From a software perspective, in order to improve the reliability of associated data generation and thus the accuracy of test results, this application provides an embodiment of an associated data generation device for implementing all or part of the associated data generation method. See [link to embodiment]. Figure 4 The associated data generation device specifically includes the following components:
[0110] The acquisition module 01 is used to acquire the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0111] The first creation module 02 is used to determine whether the number of records in the associated source table is less than the preset number of required records. If so, the first sub-table of the associated source table is created, and the records in the associated source table are added to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0112] The second creation module 03 is used to create a second sub-table of the target table. It generates multiple records in the second sub-table by generating data for the non-related fields in the target table according to a preset data generation rule. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset number of required records.
[0113] The associated data generation module 04 is used to obtain the data of the non-associated field from the second sub-table, obtain the data of the associated field from the first sub-table according to the associated field list, and add the data of the non-associated field and the data of the associated field to the target table to complete the associated data generation corresponding to the target table.
[0114] The embodiments of the associated number generation device provided in this specification can be used to execute the processing flow of the embodiments of the associated number generation method described above. Its functions will not be repeated here, but can be referred to the detailed description of the embodiments of the associated number generation method described above.
[0115] Figure 5 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention, such as... Figure 5 As shown, the electronic device includes: a memory 501, a processor 502, and a computer program stored in the memory 501 and executable on the processor 502. When the processor 502 executes the computer program, it implements the following method:
[0116] Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0117] Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0118] A second sub-table is created from the target table. Data is generated from the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0119] The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the first sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
[0120] This embodiment discloses a computer program product, which includes a computer program that, when executed by a processor, implements the following method:
[0121] Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0122] Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0123] A second sub-table is created from the target table. Data is generated from the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0124] The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the first sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
[0125] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the following method:
[0126] Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table.
[0127] Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records.
[0128] A second sub-table is created from the target table. Data is generated from the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records.
[0129] The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the first sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
[0130] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0131] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0132] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0133] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0134] In the description of this specification, the references to terms such as "an embodiment," "a specific embodiment," "some embodiments," "for example," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0135] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for generating numbers based on associations in a data table, characterized in that, include: Obtain the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table. Determine whether the number of records in the associated source table is less than the preset number of required records. If so, create a first sub-table of the associated source table and add the records in the associated source table to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records. A second sub-table is created from the target table. Data is generated for the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records. The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the first sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
2. The data table-based association-based data generation method according to claim 1, characterized in that, The loop adds records from the associated source table to the first sub-table, and further includes adding a sequence number for each record in the first sub-table in an auto-incrementing mode; Correspondingly, generating multiple records in the second sub-table also includes adding a sequence number to each record in the second sub-table in an auto-incrementing mode.
3. The data table-based association-based data generation method according to claim 2, characterized in that, The steps of retrieving the data of the non-related fields from the second sub-table, retrieving the data of the related fields from the first sub-table according to the list of related fields, and adding the data of the non-related fields and the data of the related fields to the target table to complete the creation of related data for the target table include: The data of the associated field and the data of the non-associated field corresponding to the same serial number are combined into a record and added to the target table to complete the association data generation.
4. The data table-based association-based data generation method according to claim 1, characterized in that, After determining whether the number of records in the associated source table is less than the preset required number of records, the method further includes: If the number of records is greater than or equal to the preset number of required records, then a third sub-table of the associated source table is created, and the records in the associated source table are added to the third sub-table; A second sub-table is created from the target table. Data is generated for the non-related fields in the target table according to a preset data generation rule, resulting in multiple records in the second sub-table. Each record includes the data of the non-related fields. The number of records in the second sub-table is greater than or equal to the preset required number of records. The data of the non-related fields are obtained from the second sub-table, and the data of the related fields are obtained from the third sub-table according to the list of related fields. The data of the non-related fields and the data of the related fields are added to the target table to complete the associated data generation corresponding to the target table.
5. The data table-based association-based data generation method according to claim 1, characterized in that, The step of obtaining the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table includes: Receive the unique identifier of the associated source table corresponding to the target table selected by the user from the front end, as well as the list of associated fields of the associated source table; Based on the unique identifier of the associated source table, obtain the number of records in the associated source table.
6. The data table-based association-based data generation method according to claim 1, characterized in that, After adding the data of the non-related fields and the related fields to the target table, the process further includes: Check whether the target table has achieved the target effect. If so, delete the first and second sub-tables.
7. A data table-based associative data generation device, characterized in that, include: The acquisition module is used to acquire the number of records in the associated source table corresponding to the target table and the list of associated fields in the associated source table. The list of associated fields includes the correspondence between the associated fields in the associated source table and the associated fields in the target table. The first creation module is used to determine whether the number of records in the associated source table is less than the preset number of required records. If so, the first sub-table of the associated source table is created, and the records in the associated source table are added to the first sub-table in a loop until the number of records in the first sub-table is greater than or equal to the preset number of required records. The second creation module is used to create a second sub-table of the target table, and to generate data for the non-related fields in the target table according to the preset data generation rules, thereby generating multiple records in the second sub-table. Each record includes the data of the non-related fields, and the number of records in the second sub-table is greater than or equal to the preset required number of records. The associated data generation module is used to obtain the data of the non-associated fields from the second sub-table, obtain the data of the associated fields from the first sub-table according to the associated field list, and add the data of the non-associated fields and the data of the associated fields to the target table to complete the associated data generation for the target table.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.