Incremental data extraction method, device, equipment and medium based on ETL task
By filtering and parsing the preset fields and data types in the ETL task, and determining the incremental limit value, the problem of low accuracy in incremental data extraction of the ETL task is solved, the anomaly is quickly located, and the accuracy and accuracy of the data extraction are improved. stability.
Patent Information
- Application Number
- CN202010610186.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-06-29
AI Technical Summary
Existing ETL tasks are not very accurate when extracting incremental data, and are difficult to locate and repair under abnormal conditions, which affects the accuracy of data extraction.
By obtaining ETL tasks from the preset task library, filter out the target tasks containing preset fields, parse the data type, and determine the target increment limit value based on the first run or non-first run situation, and perform incremental data extraction to avoid third-party intervention. and quickly locate anomalies.
It improves the accuracy and precision of incremental data extraction, reduces abnormal location time, enhances the accuracy of data identification and boundary values, avoids third-party intervention, and ensures the stability of ETL tasks.
Smart Images

Figure CN111813845B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to an incremental data extraction method, device, equipment and medium based on ETL tasks. Background Art
[0002] It is a common business process for existing ETL tasks to perform incremental data extraction on data. However, due to the different business processing logic of each ETL task, such as database-to-database increments, file-to-database increments, etc., when performing incremental data extraction on data, it is necessary to first perform configuration and data conversion processing according to the business, and third-party intervention query configuration is also required. In the event of an ETL task exception, the exception cannot be located and repaired, which affects the accuracy of incremental data extraction. Summary of the invention
[0003] The embodiments of the present invention provide an incremental data extraction method, device, equipment and medium based on ETL tasks to solve the problem of low accuracy of traditional incremental data extraction for ETL tasks.
[0004] An incremental data extraction method based on ETL tasks, including:
[0005] Obtain an ETL task from a preset task library, wherein the ETL task includes multiple basic fields;
[0006] Filtering out ETL tasks including preset fields from the multiple basic fields as target tasks;
[0007] Analyze the target task to determine the data type corresponding to the target task;
[0008] Determine whether the target task is being run for the first time;
[0009] If the target task is being run for the first time, determining a target increment limit value corresponding to the target task according to the data type;
[0010] If the target task is not the first run, obtaining the target value corresponding to the preset field as the target increment limit value corresponding to the target task;
[0011] Incremental data is extracted for the ETL task according to the target incremental limit value.
[0012] An incremental data extraction device based on ETL tasks, comprising:
[0013] An acquisition module, used to acquire an ETL task from a preset task library, wherein the ETL task includes a plurality of basic fields;
[0014] A matching module, used for selecting an ETL task containing a preset field from the plurality of basic fields as a target task;
[0015] A parsing module, used to parse the target task and determine the data type corresponding to the target task;
[0016] A judgment module, used to judge whether the target task is being run for the first time;
[0017] A first determination module, configured to determine a target increment limit value corresponding to the target task according to the data type if the target task is being run for the first time;
[0018] A second determination module is used to obtain the target value corresponding to the preset field as the target increment limit value corresponding to the target task if the target task does not belong to the first operation;
[0019] The incremental data extraction module is used to extract incremental data for the ETL task according to the target incremental limit value.
[0020] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned incremental data extraction method based on ETL tasks when executing the computer program.
[0021] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned incremental data extraction method based on ETL tasks.
[0022] The above-mentioned incremental data extraction method, device, equipment and medium based on ETL tasks can effectively screen out qualified target tasks by matching basic fields with preset fields, thereby improving the accuracy of subsequent incremental data extraction; when parsing the target tasks, it can improve the recognition of data by the server, thereby effectively identifying the parsing results and ensuring the accuracy of data type acquisition; by judging whether the target task is the first run, and determining the target incremental limit value corresponding to the target task according to the judgment result, and finally extracting incremental data for the ETL task according to the target incremental limit value. The target incremental limit value can be determined in different ways under different circumstances, which can improve the accuracy of the target incremental limit value, and then improve the accuracy of the target incremental limit value acquisition, thereby avoiding the intervention of a third party, and when an abnormality occurs in the ETL task, the abnormal position can be quickly and accurately located according to the target incremental limit value, effectively improving the accuracy of incremental data extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0024] Figure 1 is a flow chart of an incremental data extraction method based on an ETL task provided by an embodiment of the present invention;
[0025] Figure 2 is a flowchart of step S3 in the incremental data extraction method based on ETL tasks provided in an embodiment of the present invention;
[0026] Figure 3 is a flowchart of step S32 in the incremental data extraction method based on ETL tasks provided in an embodiment of the present invention;
[0027] Figure 4 is a flowchart of step S5 in the incremental data extraction method based on ETL tasks provided in an embodiment of the present invention;
[0028] Figure 5 is a flowchart of step S6 in the incremental data extraction method based on ETL tasks provided in an embodiment of the present invention;
[0029] Figure 6 is a flowchart of step S65 in the incremental data extraction method based on ETL tasks provided in an embodiment of the present invention;
[0030] Figure 7 is a schematic diagram of an incremental data extraction device based on an ETL task provided by an embodiment of the present invention;
[0031] Figure 8 It is a basic structural block diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] The incremental data extraction method based on ETL tasks provided in this application is applied to the server side, which can be implemented by an independent server or a server cluster composed of multiple servers. Figure 1As shown, an incremental data extraction method based on ETL tasks is provided, comprising the following steps:
[0034] S1: Obtain an ETL task from a preset task library, where the ETL task contains multiple basic fields.
[0035] In the embodiment of the present invention, the ETL task is obtained from a preset task library, wherein the preset task library refers to a database specifically used to store ETL tasks, and the ETL task includes at least 2 basic fields.
[0036] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned ETL tasks, the above-mentioned ETL tasks can also be stored in a node of a blockchain.
[0037] S2: Filter out ETL tasks containing preset fields from multiple basic fields as target tasks.
[0038] In an embodiment of the present invention, the ETL task includes multiple basic fields. By matching the basic fields included in the ETL task with the preset fields, if there is a basic field that is the same as the preset field, it means that the ETL task is configured with the preset field, and the ETL task is determined as the target task; if there is no basic field that is the same as the preset field, it means that the ETL task is not configured with the preset field and no processing is performed.
[0039] The preset field refers to a field preset by a user, which may specifically refer to an incremental field incrementalField.
[0040] It should be noted that the incremental field refers to the field corresponding to the incremental data, wherein the incremental data refers to the data after the data is changed or updated.
[0041] S3: Analyze the target task and determine the data type corresponding to the target task.
[0042] In the embodiment of the present invention, the target task is imported into a preset parsing port for parsing, and the data type corresponding to the target task is determined according to a preset method and the parsing result after the parsing.
[0043] The preset parsing port refers to a processing port specifically used for parsing the target task.
[0044] The preset method refers to the processing method that is preset by the user to determine the data type based on the analysis results.
[0045] S4: Determine whether the target task is being run for the first time.
[0046] In the embodiment of the present invention, the target task includes a task id, and by matching the task id with the historical task id in a preset history table, it is determined whether the target task is being run for the first time.
[0047] The preset history table refers to a data table specifically used to store historical task IDs.
[0048] S5: If the target task is to be run for the first time, the target increment limit value corresponding to the target task is determined according to the data type.
[0049] In the embodiment of the present invention, the target increment limit value is used to indicate the node corresponding to the last update of the ETL task, and the processing position corresponding to the ETL task can be quickly located according to the node.
[0050] Specifically, according to the matching method of step S4, if the task id is not matched to be the same as the historical id, it means that the target task corresponding to the task id has no running record and is the first running, and the target increment limit value corresponding to the target task is determined according to the data type and the preset requirements. The preset requirements refer to the processing requirements pre-set by the user to determine the target increment limit value corresponding to the target task according to the data type.
[0051] Furthermore, if the target task is being run for the first time, the task id corresponding to the target task is updated as a historical task id into a preset history table.
[0052] S6: If the target task does not belong to the first run, obtain the target value corresponding to the preset field as the target increment limit value corresponding to the target task.
[0053] In an embodiment of the present invention, according to the matching method of step S4, if the matched task id is the same as the historical id, it means that the target task corresponding to the task id already has an operation record and is not the first operation. The target value corresponding to the preset field is queried from the preset record table and used as the target incremental limit value corresponding to the target task.
[0054] The preset record table refers to a data table specifically used to record target values corresponding to preset fields.
[0055] S7: Extract incremental data for the ETL task according to the target incremental limit value.
[0056] Specifically, the target incremental limit value is used to indicate the node corresponding to the last update of the ETL task. By finding the node corresponding to the ETL according to the target incremental limit value and extracting the data after the node, incremental data extraction for the ETL task can be achieved.
[0057] In this embodiment, by matching the basic fields with the preset fields, the target tasks that meet the conditions can be effectively screened out, and the accuracy of subsequent incremental data extraction can be improved; when parsing the target tasks, the server's recognition of the data can be improved, thereby effectively identifying the parsing results and ensuring the accuracy of data type acquisition; by judging whether the target task is the first run, and determining the target incremental limit value corresponding to the target task according to the judgment result, and finally extracting incremental data for the ETL task according to the target incremental limit value. The target incremental limit value can be determined in different ways under different circumstances, which can improve the accuracy of the target incremental limit value, and then improve the accuracy of the target incremental limit value acquisition, thereby avoiding the intervention of a third party, and when an abnormality occurs in the ETL task, the abnormal position can be quickly and accurately located according to the target incremental limit value, effectively improving the accuracy of incremental data extraction.
[0058] In one embodiment, if Figure 2 As shown, in step S3, the target task is parsed and the data type corresponding to the target task is determined, which includes the following steps:
[0059] S31: Analyze the target task and obtain output data corresponding to the target task.
[0060] In the embodiment of the present invention, the target task is imported into the preset parsing port for parsing, and m data streams after parsing and identification information corresponding to the data streams are obtained. By identifying the identification information, if the identification information is identified as preset information, the data stream corresponding to the identification information is used as the output data corresponding to the target task. Wherein, m is a positive integer greater than 1.
[0061] The preset information refers to information preset by the user for representing output data.
[0062] It should be noted that the output data also includes different legal fields, and the output data may also refer to the output steps corresponding to the target task.
[0063] S32: Identify whether the output data contains a preset type, and determine the data type corresponding to the target task according to the identification result.
[0064] Specifically, the output data also includes different legal fields, and the preset type includes the corresponding incremental domain field. By matching the incremental domain field with the legal field, it is identified whether the output data contains the preset type, and the corresponding recognition result is obtained. According to the preset rules and the recognition result, the data type corresponding to the target task is determined.
[0065] The preset rules refer to the rules set by the user according to actual needs to determine the data type corresponding to the target task based on the recognition results.
[0066] In this embodiment, the target task is parsed to obtain the output data corresponding to the target task, and then the output data is identified to determine whether it contains a preset type, and the data type corresponding to the target task is determined according to the identification result. The parsing method can improve the recognition of data by the server, ensure the accurate recognition of data types, and thus improve the accuracy of the subsequent determination of the target increment limit value according to the data type.
[0067] In one embodiment, if Figure 3 As shown, in step S32, that is, identifying whether the output data contains a preset type, and determining the data type corresponding to the target task according to the identification result includes the following steps:
[0068] S321: Identify whether the output data contains a preset type.
[0069] In the embodiment of the present invention, the output data further includes different legal fields; the preset type refers to an incremental type preset by a user, and the preset type includes an incremental field corresponding thereto.
[0070] It should be noted that the incremental type refers to the data type corresponding to the increment, which can specifically be a timestamp, sequence, or string, and each incremental type contains a corresponding incremental field.
[0071] Specifically, by matching the incremental field with the legal field, it is identified whether the output data contains the preset type.
[0072] S322: If a preset type is identified, the preset type is used as the data type corresponding to the target task.
[0073] In an embodiment of the present invention, according to the matching method of step S321, if there is a legal field that is the same as the incremental field, it means that the output data contains a preset type, and the preset type corresponding to the incremental field is obtained, and the preset type is used as the data type corresponding to the target task.
[0074] S323: If the preset type is not identified, a basic type is obtained from the preset type table, and the basic type is used as the data type corresponding to the target task.
[0075] In an embodiment of the present invention, according to the matching method of step S321, if there is no legal field that is the same as the incremental field, it means that the output data does not contain the preset type, and the basic type pre-set by the user is obtained from the preset type table, and the basic type is used as the data type corresponding to the target task.
[0076] The preset type table refers to a data table specifically used to store basic types preset by the user, and the basic type mainly refers to the incremental type.
[0077] In this embodiment, it is identified whether the output data contains a preset type. If the preset type is identified, the preset type is used as the data type corresponding to the target task. Otherwise, the basic type is obtained from the preset type table as the data type corresponding to the target task. By identifying whether the output data contains a preset type, it is possible to effectively determine whether the target task is assigned a preset type and accurately identify the data type corresponding to the target task, thereby improving the accuracy of subsequently determining the target increment limit value according to the data type.
[0078] In one embodiment, if Figure 4 As shown, in step S5, that is, if the target task is the first time to be run, determining the target increment limit value corresponding to the target task according to the data type includes the following steps:
[0079] S51: If the target task is being run for the first time, query whether there is a configuration value for the target task from a preset configuration table.
[0080] In the embodiment of the present invention, if the target task is being run for the first time, a query is made from a preset configuration table to determine whether a configuration value exists, wherein the preset configuration table refers to a data table specifically used to store configuration values.
[0081] It should be noted that when there is no configuration value in the preset configuration table, the preset configuration table is empty.
[0082] S52: When the configuration value is found, the configuration value is used as the target increment limit value.
[0083] Specifically, when a configuration value is queried from a preset configuration table, the configuration value is directly used as the target increment limit value.
[0084] S53: When no configuration value is found, the minimum basic value corresponding to the data type is queried from the preset database, and the minimum basic value is used as the target increment limit value corresponding to the target task.
[0085] Specifically, when the query from the preset configuration table is empty, it means that no configuration value is queried from the preset configuration table, and the data type corresponding to the target task is matched with the basic type in the preset database, and all basic values corresponding to the successfully matched basic type are selected, and all basic values are sorted in order from small to large, and the smallest basic value is selected as the minimum basic value corresponding to the data type, and the minimum basic value is used as the target incremental limit value corresponding to the target task.
[0086] The preset database refers to a database specifically used to store different basic types and basic values corresponding to the basic types, and there must be a basic type that is the same as the data type.
[0087] For example, the preset database contains basic types A and B, and the basic values corresponding to A are 3, 1 and 2 respectively, and the basic values corresponding to B are 2, 4 and 3 respectively. If the data type corresponding to the target task is A, by matching the data type with the basic type, the data type A is found to be the same as the basic type A, then the basic values 3, 1 and 2 corresponding to A are obtained, and the basic values are sorted in ascending order to obtain the minimum basic value of 1, which is the target incremental limit value corresponding to the target task.
[0088] In this embodiment, if the target task is running for the first time, the preset configuration table is queried to see whether there is a configuration value for the target task. When the configuration value is found, the configuration value is used as the target increment limit value. Otherwise, the minimum basic value corresponding to the data type is obtained as the target increment limit value corresponding to the target task. In the case where the target task is running for the first time, by querying whether there is a configuration value for the target task, the target increment limit value can be determined by different values under different conditions, effectively improving the precision of the target increment limit value, and thus improving the accuracy of obtaining the target increment limit value.
[0089] In one embodiment, if Figure 5 As shown, in step S6, if the target task does not belong to the first run, obtaining the target value corresponding to the preset field as the target increment limit value corresponding to the target task includes the following steps:
[0090] S61: If the target task is not the first time to be run, the detection status of the target task is obtained from a preset log table.
[0091] In the embodiment of the present invention, if the target task is not the first time to run, the detection status of the target task is obtained from a preset log table, wherein the preset log table refers to a data table specifically used to record the detection status corresponding to the target task.
[0092] S62: By matching the detection state with the preset state, a target task whose detection state matches the preset state is selected as an initial task.
[0093] Specifically, according to the detection state obtained in step S61, the detection state is matched with the preset state. If the detection state is the same as the preset state, it means that the target task corresponding to the detection state is in the state of incremental limit value detection, and the target task corresponding to the detection state is used as the initial task.
[0094] The preset state refers to a processing state preset by a user for determining whether it is in the incremental limit value detection state.
[0095] It should be noted that the incremental limit value detection refers to a method of using the incremental limit value to detect the tasks preset by the user.
[0096] S63: Determine whether the output data corresponding to the initial task is output to the database.
[0097] Specifically, the target end identifier of the output data corresponding to the initial task is obtained from the preset monitoring table, the target end identifier is identified, and according to the identification result, it is determined whether the output data is output to the database. The preset monitoring table refers to a data table specifically used to store the target end identifier of the output data corresponding to the initial task.
[0098] It should be noted that the target end identifier indicates the output object corresponding to the output data. The output object can specifically refer to a database or a user-preset platform such as a file. If the target end identifier is a database, it means that the output data is output to the database, otherwise it is output to other platforms.
[0099] S64: If the output data is output to a database, query the database for a maximum value corresponding to a preset field and a historical cache value corresponding to the database, wherein the database includes the preset field.
[0100] Specifically, according to the judgment method of step S63, when the target end is identified as a database, it indicates that the output data is output to the database, and n data values corresponding to the preset fields of the database are obtained from the preset value table, and the largest data value is selected from the n data values as the maximum value, and the historical cache value corresponding to the database is obtained from the preset cache table. Where n is a positive integer greater than 1.
[0101] The preset value table refers to a data table specifically used to store preset fields of a database and n data values corresponding to the preset fields.
[0102] The preset cache table is specifically used to record the historical cache values corresponding to the database.
[0103] S65: Compare the maximum value with the historical cache value, and determine the target increment limit value corresponding to the target task according to the comparison result.
[0104] Specifically, the maximum value obtained in step S64 is compared with the historical cache value, and the target increment limit value corresponding to the target task is determined based on the comparison result and a pre-set determination method.
[0105] S66: If the output data is not output to the database, the update cache value corresponding to the output data is obtained as the target increment limit value.
[0106] Specifically, according to the judgment method of step S63, when it is identified that the target end identifier is not a database, it means that the output data is not output to the database, then the update cache value corresponding to the output data is obtained from the preset target table, and the update cache value is used as the target incremental limit value.
[0107] The preset target table refers to a data table specifically used to record the update cache value corresponding to the output data.
[0108] In this embodiment, if the target task does not belong to the first run, the detection state corresponding to the target task is obtained and matched with the preset state, the initial task is screened out, and it is determined whether the output data corresponding to the initial task is output to the database. If the output data is output to the database, the maximum value corresponding to the preset field in the database and the historical cache value corresponding to the database are obtained, and then the maximum value is compared with the historical cache value, and the target incremental limit value is determined according to the comparison result; if the output data is not output to the database, the updated cache value is obtained as the target incremental limit value. In the case that the target task does not belong to the first run, the initial task is further screened, and it is determined whether the output data corresponding to the initial task is output to the database, so as to determine the target incremental limit value. This method can effectively conduct in-depth analysis on the target task, combine the output object, improve the correlation between data, and then improve the accuracy of determining the target incremental limit value, and ensure the accuracy of the subsequent incremental data extraction according to the target incremental limit value.
[0109] In one embodiment, if Figure 6 As shown, in step S65, comparing the maximum value with the historical cache value, and determining the target increment limit value corresponding to the target task according to the comparison result includes the following steps:
[0110] S651: Compare the maximum value with the historical cache value.
[0111] Specifically, the maximum value is compared with the historical cache value.
[0112] S652: If the maximum value is smaller than the historical cache value, the maximum value is used as the target increment limit value.
[0113] Specifically, according to the comparison method of step S651, if the maximum value is smaller than the historical cache value, the maximum value is used as the target increment limit value.
[0114] S653: If the maximum value is greater than or equal to the historical cache value, the historical cache value is used as the target increment limit value.
[0115] Specifically, according to the comparison method of step S651, if the maximum value is greater than or equal to the historical cache value, the historical cache value is used as the target increment limit value.
[0116] In this embodiment, by comparing the maximum value with the historical cache value, different values can be determined as the target incremental limit value in different situations, avoiding the single value determined by the target incremental limit value, effectively improving the accuracy of obtaining the target incremental limit value, and then improving the accuracy of obtaining the target incremental limit value, ensuring the accuracy of the subsequent incremental data extraction based on the target incremental limit value.
[0117] In one embodiment, after step S1, the incremental data extraction method based on the ETL task further includes the following steps:
[0118] Store ETL tasks in the blockchain.
[0119] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0120] In one embodiment, an incremental data extraction device based on an ETL task is provided, and the incremental data extraction device based on an ETL task corresponds one-to-one to the incremental data extraction method based on an ETL task in the above embodiment. Figure 7 As shown, the incremental data extraction device based on the ETL task includes an acquisition module 71, a matching module 72, a parsing module 73, a judgment module 74, a first determination module 75, a second determination module 76 and an incremental data extraction module 77. The functional modules are described in detail as follows:
[0121] The acquisition module 71 is used to acquire the ETL task from the preset task library, wherein the ETL task includes a plurality of basic fields; it should be emphasized that in order to further ensure the privacy and security of the ETL task, the ETL task can also be stored in a node of a blockchain;
[0122] A matching module 72, used to select an ETL task containing a preset field from a plurality of basic fields as a target task;
[0123] The parsing module 73 is used to parse the target task and determine the data type corresponding to the target task;
[0124] A judgment module 74 is used to judge whether the target task is being run for the first time;
[0125] A first determination module 75 is used to determine a target increment limit value corresponding to the target task according to a data type if the target task is being run for the first time;
[0126] A second determination module 76 is used to obtain a target value corresponding to a preset field as a target increment limit value corresponding to the target task if the target task does not belong to the first run;
[0127] The incremental data extraction module 77 is used to extract incremental data for the ETL task according to the target incremental limit value.
[0128] Furthermore, the parsing module 73 includes:
[0129] The output data acquisition submodule is used to parse and process the target task and obtain the output data corresponding to the target task;
[0130] The data type determination submodule is used to identify whether the output data contains a preset type and determine the data type corresponding to the target task based on the identification result.
[0131] Furthermore, the identification submodule includes:
[0132] An identification unit, used for identifying whether the output data contains a preset type;
[0133] A first identification unit is used to use the preset type as a data type corresponding to the target task if a preset type is identified;
[0134] The second identification unit is used to obtain a basic type from a preset type table if the preset type is not identified, and use the basic type as a data type corresponding to the target task.
[0135] Further, the first determining module 75 includes:
[0136] The query submodule is used to query whether the target task has a configuration value from the preset configuration table if the target task is being run for the first time;
[0137] A first query submodule is used to use the configuration value as a target increment limit value when the configuration value is queried;
[0138] The second query submodule is used to query the minimum basic value corresponding to the data type from the preset database when the configuration value is not found, and use the minimum basic value as the target increment limit value corresponding to the target task.
[0139] Further, the second determining module 76 includes:
[0140] The detection status acquisition submodule is used to obtain the detection status of the target task from the preset log table if the target task is not the first run;
[0141] A screening submodule, used for screening out target tasks whose detection states match the preset states as initial tasks by matching the detection states with the preset states;
[0142] The output judgment submodule is used to judge whether the output data corresponding to the initial task is output to the database;
[0143] A first output judgment submodule is used to query the maximum value corresponding to the preset field in the database and the historical cache value corresponding to the database if the output data is output to the database, wherein the database includes the preset field;
[0144] A first comparison submodule is used to compare the maximum value with the historical cache value, and determine the target increment limit value corresponding to the target task according to the comparison result;
[0145] The second output judgment submodule is used to obtain the update cache value corresponding to the output data as the target increment limit value if the output data is not output to the database.
[0146] Furthermore, the first comparison submodule includes:
[0147] A second comparison unit, used for comparing the maximum value with the historical cache value;
[0148] A first comparison result unit, used for taking the maximum value as a target increment limit value if the maximum value is smaller than the historical cache value;
[0149] The second comparison result unit is used to use the historical cache value as the target increment limit value if the maximum value is greater than or equal to the historical cache value.
[0150] Furthermore, the incremental data extraction device based on the ETL task also includes:
[0151] The storage module is used to store ETL tasks in the blockchain.
[0152] Some embodiments of the present application disclose computer devices. Figure 8 , which is a basic structural block diagram of a computer device 90 in one embodiment of the present application.
[0153] like Figure 8 As shown in FIG. 1 , the computer device 90 includes a memory 91, a processor 92, and a network interface 93 that are interconnected and communicated via a system bus. It should be noted that Figure 8Only a computer device 90 having components 91-93 is shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0154] The computer device may be a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0155] The memory 91 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 91 can be an internal storage unit of the computer device 90, such as a hard disk or memory of the computer device 90. In other embodiments, the memory 91 can also be an external storage device of the computer device 90, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 90. Of course, the memory 91 can also include both the internal storage unit of the computer device 90 and its external storage device. In this embodiment, the memory 91 is generally used to store the operating system and various application software installed on the computer device 90, such as the program code of the incremental data extraction method based on the ETL task, etc. In addition, the memory 91 can also be used to temporarily store various types of data that have been output or are to be output.
[0156] The processor 92 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 92 is generally used to control the overall operation of the computer device 90. In this embodiment, the processor 92 is used to run the program code stored in the memory 91 or process data, such as running the program code of the incremental data extraction method based on the ETL task.
[0157] The network interface 93 may include a wireless network interface or a wired network interface. The network interface 93 is generally used to establish a communication connection between the computer device 90 and other electronic devices.
[0158] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores an ETL task information entry program, and the ETL task information entry program can be executed by at least one processor to enable the at least one processor to perform any step of the above-mentioned ETL task-based incremental data extraction method.
[0159] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned ETL tasks, the above-mentioned ETL tasks can also be stored in a node of a blockchain.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a computer device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0161] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0162] Finally, it should be noted that the embodiments described above are obviously only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to replace some of the technical features therein with equivalents. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. An incremental data extraction method based on ETL tasks, characterized in that: The incremental data extraction method based on the ETL task includes: Obtain an ETL task from a preset task library, wherein the ETL task includes multiple basic fields; Filtering out ETL tasks including preset fields from the multiple basic fields as target tasks; Analyze the target task to determine the data type corresponding to the target task; Determine whether the target task is being run for the first time; If the target task is being run for the first time, determining a target increment limit value corresponding to the target task according to the data type; If the target task is not the first run, obtaining the target value corresponding to the preset field as the target increment limit value corresponding to the target task; Extracting incremental data for the ETL task according to the target incremental limit value; The preset field refers to the incremental field, and the incremental field refers to the field corresponding to the incremental data; Wherein, if the target task is being run for the first time, the step of determining the target increment limit value corresponding to the target task according to the data type includes: If the target task is being run for the first time, querying the preset configuration table to see whether there is a configuration value for the target task; When the configuration value is found, the configuration value is used as the target increment limit value; When the configuration value is not found, the minimum basic value corresponding to the data type is queried from the preset database, and the minimum basic value is used as the target increment limit value corresponding to the target task; Among them, the querying of the minimum basic value corresponding to the data type from the preset database, and using the minimum basic value as the target incremental limit value corresponding to the target task, includes: when the query from the preset configuration table is empty, it means that no configuration value is queried from the preset configuration table, the data type corresponding to the target task is matched with the basic type in the preset database, all basic values corresponding to the successfully matched basic type are selected, all basic values are sorted in order from small to large, the smallest basic value is selected as the minimum basic value corresponding to the data type, and the minimum basic value is used as the target incremental limit value corresponding to the target task; wherein, the preset database refers to a database specifically used to store different basic types and basic values corresponding to the basic types, and there must be basic types that are the same as the data types.
2. The incremental data extraction method based on ETL tasks according to claim 1, characterized in that: The step of parsing the target task to determine the data type corresponding to the target task includes: Analyze the target task to obtain output data corresponding to the target task; Identify whether the output data contains a preset type, and determine the data type corresponding to the target task according to the identification result.
3. The incremental data extraction method based on ETL tasks as claimed in claim 2, characterized in that: The step of identifying whether the output data contains a preset type and determining the data type corresponding to the target task according to the identification result includes: Identifying whether the output data includes a preset type; If a preset type is identified, the preset type is used as the data type corresponding to the target task; If the preset type is not identified, a basic type is obtained from the preset type table, and the basic type is used as the data type corresponding to the target task.
4. The incremental data extraction method based on ETL tasks as claimed in claim 2, characterized in that: If the target task is not the first run, the step of obtaining the target value corresponding to the preset field as the target increment limit value corresponding to the target task includes: If the target task is not the first time to be run, the detection status of the target task is obtained from a preset log table; By matching the detection state with the preset state, a target task whose detection state matches the preset state is selected as an initial task; Determine whether the output data corresponding to the initial task is output to the database; If the output data is output to a database, querying the database for a maximum value corresponding to a preset field and a historical cache value corresponding to the database, wherein the database includes a preset field; Compare the maximum value with the historical cache value, and determine the target increment limit value corresponding to the target task according to the comparison result; If the output data is not output to the database, the update cache value corresponding to the output data is obtained as the target incremental limit value.
5. The incremental data extraction method based on ETL tasks as claimed in claim 4, characterized in that: The step of comparing the maximum value with the historical cache value and determining the target increment limit value corresponding to the target task according to the comparison result includes: Comparing the maximum value with the historical cache value; If the maximum value is smaller than the historical cache value, the maximum value is used as the target increment limit value; If the maximum value is greater than or equal to the historical cache value, the historical cache value is used as the target increment limit value.
6. The incremental data extraction method based on ETL tasks as claimed in claim 1, characterized in that: After the step of obtaining the ETL task from the preset task library, the incremental data extraction method based on the ETL task further includes: The ETL task is stored in the blockchain.
7. An incremental data extraction device based on ETL tasks, characterized in that: The incremental data extraction device based on the ETL task includes: An acquisition module, used to acquire an ETL task from a preset task library, wherein the ETL task includes a plurality of basic fields; A matching module, used for selecting an ETL task containing a preset field from the plurality of basic fields as a target task; A parsing module, used to parse the target task and determine the data type corresponding to the target task; A judgment module, used to judge whether the target task is being run for the first time; A first determination module, configured to determine a target increment limit value corresponding to the target task according to the data type if the target task is being run for the first time; A second determination module is used for obtaining the target value corresponding to the preset field as the target increment limit value corresponding to the target task if the target task does not belong to the first operation; An incremental data extraction module, used to extract incremental data for the ETL task according to the target incremental limit value; The preset field refers to the incremental field, and the incremental field refers to the field corresponding to the incremental data; Wherein, the first determination module includes: The query submodule is used to query whether the target task has a configuration value from the preset configuration table if the target task is being run for the first time; A first query submodule is used to use the configuration value as a target increment limit value when the configuration value is queried; The second query submodule is used to query the minimum basic value corresponding to the data type from the preset database when no configuration value is found, and use the minimum basic value as the target increment limit value corresponding to the target task; Among them, the second query submodule is specifically used for matching the data type corresponding to the target task with the basic type in the preset database when the query from the preset configuration table is empty, that is, no configuration value is queried from the preset configuration table, selecting all basic values corresponding to the successfully matched basic type, sorting all basic values in ascending order, selecting the smallest basic value as the minimum basic value corresponding to the data type, and using the minimum basic value as the target incremental limit value corresponding to the target task; wherein the preset database refers to a database specifically used to store different basic types and basic values corresponding to the basic types, and there must be basic types that are the same as the data types.
8. A computer 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, the steps of the incremental data extraction method based on the ETL task as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the incremental data extraction method based on the ETL task as claimed in any one of claims 1 to 6 are implemented.
