A streaming data completion method, system, electronic device and storage medium

By generating SQL through configuration files and processing data using a streaming computing framework, the lack of versatility in streaming data completion methods is solved. This enables data completion that adapts to different scenarios, reduces the workload of developers, and improves the real-time performance and adaptability of data completion.

CN113672601BActive Publication Date: 2024-09-06BEIJING MININGLAMP SOFTWARE SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110830012.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-22
Publication Date
2024-09-06
Estimated Expiration
2041-07-22

AI Technical Summary

Technical Problem

Existing streaming data completion methods lack versatility and cannot adapt to the data completion needs of different application scenarios, resulting in repetitive workload for developers.

Method used

Design a streaming data completion method that generates SQL through a configuration file loading process, processes the data using a streaming computing framework, and outputs the completed data to a Kafka topic. It supports the association and data mapping configuration between the main table and the secondary table, and is suitable for data completion in different scenarios.

Benefits of technology

It implements a general streaming data completion framework, which reduces the workload of developers, avoids repetitive work, and improves the real-time performance and adaptability of data completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113672601B
    Figure CN113672601B
Patent Text Reader

Abstract

The present invention proposes a streaming data completion method, system, electronic device and storage medium, and the method and technical scheme thereof include a configuration file loading step, designing a configuration file for generating SQL for data completion, and starting to load the configuration file, wherein the configuration file includes information of a main table and a secondary table; a streaming data processing step, accessing data from Kafka, and processing the data through a streaming computing framework, wherein the data processing includes executing the SQL generated by the configuration file to obtain the completed data; and a completion result output step, wherein the completed data is output to the topic of the Kafka. The present application solves the problem that the existing streaming data completion method is not universal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of databases, and in particular relates to a streaming data completion method, system, electronic equipment and storage medium. Background Art

[0002] Data completion refers to aligning the data of the main table with the secondary table. The common application scenario is that some field values ​​in the main table are missing or incomplete, and the secondary table needs to be associated to complete the values ​​of those fields. Some fields in the secondary table can also be added to the main table to expand the information of the main table. Streaming data completion refers to improving the real-time performance of data alignment so that users can see the data results after the main table is completed in a relatively short time. The existing technology only completes the data for a specific main table by associating the corresponding secondary table, which is not universal. Summary of the invention

[0003] The embodiments of the present application provide a streaming data completion method, system, electronic device and storage medium to at least solve the problem that the existing streaming data completion method is not universal.

[0004] In the first aspect, an embodiment of the present application provides a streaming data completion method, including: a configuration file loading step, designing a configuration file for generating SQL for data completion, and starting to load the configuration file, the configuration file including main table and sub-table information; a streaming data processing step, accessing data from Kafka, and processing the data through a streaming computing framework, the data processing including executing the SQL generated by the configuration file to obtain the completed data; a completion result output step, outputting the completed data to the topic of Kafka.

[0005] Preferably, the streaming data processing step further comprises: when accessing data from the kafka, filtering out a data set whose key is the main table and the secondary table.

[0006] Preferably, the streaming data processing step further includes: if the data accessed in the kafka is the sub-table data, updating the sub-table data to the memory.

[0007] Preferably, the configuration file further includes: information on the associated fields between the main table and the secondary table, associated conditions, transposition configuration of the associated fields of the main table, mapping configuration between the secondary table and the output table, and a field list and table name of the main table, and a field list and table name of the output table.

[0008] In the second aspect, an embodiment of the present application provides a streaming data completion system, which is applicable to the above-mentioned streaming data completion method, including: a configuration file loading module, which designs a configuration file for generating a SQL for data completion, and starts loading the configuration file, wherein the configuration file includes information of a main table and a sub-table; a streaming data processing module, which accesses data from Kafka, and processes the data through a streaming computing framework, wherein the data processing includes executing the SQL generated by the configuration file to obtain the completed data; a completion result output module, which outputs the completed data to the topic of Kafka.

[0009] In some embodiments, the streaming data processing module further includes: when accessing data from the kafka, filtering out the data set whose key is the main table and the secondary table.

[0010] In some embodiments, the stream data processing module further includes: if the data accessed in the kafka is the sub-table data, updating the sub-table data to the memory.

[0011] In some embodiments, the configuration file further includes: information on the associated fields between the main table and the secondary table, the associated conditions, the associated field transposition configuration of the main table, the mapping configuration between the secondary table and the output table, and the field list and table name of the main table, and the field list and table name of the output table.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a streaming data completion method as described in the first aspect above is implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a streaming data completion method as described in the first aspect above.

[0014] The present application can be applied to the field of data capability technology. Compared with the related art, the streaming data completion method provided in the embodiment of the present application realizes a universal streaming data completion framework, which can realize the data completion requirements of different application scenarios through configuration, without the need to perform repeated coding for different scenarios, thus reducing the workload of developers and avoiding duplication of work. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1 This is a flow chart of the streaming data completion method of the present invention;

[0017] Figure 2 It is a framework diagram of the streaming data completion system of the present invention;

[0018] Figure 3 A framework diagram of an electronic device of the present invention;

[0019] In the above picture:

[0020] 1. Configuration file loading module; 2. Streaming data processing module; 3. Completion result output module; 60. Bus; 61. Processor; 62. Memory; 63. Communication interface. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0022] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0023] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0024] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a kind of", "the" and the like involved in this application do not indicate a quantitative limitation and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices.

[0025] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings:

[0026] Figure 1 For a flow chart of the streaming data completion method of the present invention, please refer to Figure 1 The streaming data completion method of the present invention comprises the following steps:

[0027] S1: Design a configuration file for generating SQL for data completion, and start loading the configuration file, wherein the configuration file includes information of a main table and a secondary table.

[0028] Optionally, the configuration file further includes: information about the associated fields between the main table and the secondary table, the associated conditions, the associated field transposition configuration of the main table, the mapping configuration between the secondary table and the output table, and the field list and table name of the main table, and the field list and table name of the output table.

[0029] The present application provides a specific embodiment to further illustrate the configuration file and SQL. The configuration file is used to generate SQL for data completion. The specific format is as follows.

[0030]

[0031]

[0032] This configuration file configures: information about the fields associated with the primary table and the secondary table, whether the association condition is AND or OR, whether the associated fields of the primary table are transposed, the primary table field separator (needs to be configured when transposed), the mapping configuration between the secondary table and the output table (if the secondary table field exists in the primary table, it means that the secondary table field value is used to overwrite the primary table field value to achieve the completion function; if the secondary table field does not exist in the primary table, it means that the secondary table field is added to the primary table as the output table), as well as the field list and table name of the primary table, and the field list and table name of the output table.

[0033] The primary table name and secondary table name are used to filter messages in Kafka. The message format in Kafka must be limited to the following format: xx = {"key1":"value1","key2":"value2"}, where xx is the table name and the json part is the specific data.

[0034] The specific meanings of the fields are as follows:

[0035]

[0036] Generate data completion SQL according to the above configuration information, and execute the SQL to get the completed data. The data completion SQL generated by the configuration information is as follows:

[0037]

[0038]

[0039] In specific implementations, the configuration file format used in this application may have different transformations.

[0040] Please continue to see Figure 1 :

[0041] S2: Access data from Kafka and process the data through a first-class computing framework. The data processing includes executing the SQL generated by the configuration file to obtain the completed data.

[0042] Optionally, when accessing data from the kafka, filter out data sets whose keys are the primary table and the secondary table.

[0043] Optionally, if the data accessed in the kafka is the secondary table data, the secondary table data is updated to the memory.

[0044] In the specific implementation, this application uses the spark streaming computing framework to implement streaming computing, and other computing frameworks such as flink, structure streaming, etc. can also be used.

[0045] In the specific implementation, data is accessed from Kafka and processed by the first-class computing framework program. During the processing, the first-class computing framework program needs to generate the corresponding data completion SQL according to the configuration file, and then execute the SQL to obtain the completed data. During the data processing, the first-class computing framework also supports updating the cached sub-table in the memory, that is, if the data from Kafka is sub-table data, it can be updated to the memory.

[0046] S3: Output the completed data to the Kafka topic.

[0047] In the specific implementation, SQL is executed to obtain the completed data, and finally the result is output to the Kafka topic.

[0048] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0049] The embodiment of the present application provides a streaming data completion system, which is applicable to the above-mentioned streaming data completion method. As used below, the terms "unit", "module", etc. can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0050] Figure 2 For a framework diagram of the streaming data completion system according to the present invention, see Figure 2 ,include:

[0051] Configuration file loading module 1: Design a configuration file for generating SQL for data completion, and start loading the configuration file, which includes the main table and sub-table information.

[0052] Optionally, the configuration file further includes: information about the associated fields between the main table and the secondary table, the associated conditions, the associated field transposition configuration of the main table, the mapping configuration between the secondary table and the output table, and the field list and table name of the main table, and the field list and table name of the output table.

[0053] The present application provides a specific embodiment to further illustrate the configuration file and SQL. The configuration file is used to generate SQL for data completion. The specific format is as follows.

[0054]

[0055]

[0056]

[0057] This configuration file configures: information about the fields associated with the primary table and the secondary table, whether the association condition is AND or OR, whether the associated fields of the primary table are transposed, the primary table field separator (needs to be configured when transposed), the mapping configuration between the secondary table and the output table (if the secondary table field exists in the primary table, it means that the secondary table field value is used to overwrite the primary table field value to achieve the completion function; if the secondary table field does not exist in the primary table, it means that the secondary table field is added to the primary table as the output table), as well as the field list and table name of the primary table, and the field list and table name of the output table.

[0058] The primary table name and secondary table name are used to filter messages in Kafka. The message format in Kafka must be limited to the following format: xx = {"key1":"value1","key2":"value2"}, where xx is the table name and the json part is the specific data.

[0059] The specific meanings of the fields are as follows:

[0060]

[0061]

[0062] Generate data completion SQL according to the above configuration information, and execute the SQL to get the completed data. The data completion SQL generated by the configuration information is as follows:

[0063]

[0064] In specific implementations, the configuration file format used in this application may have different transformations.

[0065] Please continue to see Figure 2 :

[0066] Streaming data processing module 2: accesses data from Kafka and processes the data through a streaming computing framework. The data processing includes executing the SQL generated by the configuration file to obtain the completed data.

[0067] Optionally, when accessing data from the kafka, filter out data sets whose keys are the primary table and the secondary table.

[0068] Optionally, if the data accessed in the kafka is the secondary table data, the secondary table data is updated to the memory.

[0069] In the specific implementation, this application uses the spark streaming computing framework to implement streaming computing, and other computing frameworks such as flink, structure streaming, etc. can also be used.

[0070] In the specific implementation, data is accessed from Kafka and processed by the first-class computing framework program. During the processing, the first-class computing framework program needs to generate the corresponding data completion SQL according to the configuration file, and then execute the SQL to obtain the completed data. During the data processing, the first-class computing framework also supports updating the cached sub-table in the memory, that is, if the data from Kafka is sub-table data, it can be updated to the memory.

[0071] The completion result output module 3: outputs the completed data to the topic of the kafka.

[0072] In the specific implementation, SQL is executed to obtain the completed data, and finally the result is output to the Kafka topic.

[0073] In addition, combined Figure 1 The described streaming data completion method can be implemented by an electronic device. Figure 3 It is a framework diagram of the electronic device of the present invention.

[0074] The electronic device may include a processor 61 and a memory 62 storing computer program instructions.

[0075] Specifically, the processor 61 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0076] Among them, the memory 62 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 62 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 62 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 62 may be inside or outside the data processing device. In a specific embodiment, the memory 62 is a non-volatile memory. In a specific embodiment, the memory 62 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, PROM for short), an erasable PROM (Erasable ProgrammableRead-Only Memory, EPROM for short), an electrically erasable PROM (Electrically Erasable ProgrammableRead-Only Memory, EEPROM for short), an electrically alterable ROM (Electrically Alterable Read-Only Memory, EAROM for short) or a flash memory (FLASH) or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0077] The memory 62 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 61 .

[0078] The processor 61 implements any one of the streaming data completion methods in the above embodiments by reading and executing computer program instructions stored in the memory 62 .

[0079] In some of the embodiments, the electronic device may further include a communication interface 63 and a bus 60. Figure 3 As shown, the processor 61, the memory 62, and the communication interface 63 are connected via a bus 60 and communicate with each other.

[0080] The communication port 63 can realize data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.

[0081] The bus 60 includes hardware, software or both, and couples the components of the electronic device to each other. The bus 60 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 60 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 60 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0082] The electronic device can execute a streaming data completion method in an embodiment of the present application.

[0083] In addition, in combination with a streaming data padding method in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any streaming data padding method in the above embodiment is implemented.

[0084] The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.

[0085] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0086] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A streaming data completion method, characterized in that: include: A configuration file loading step, designing a configuration file for generating SQL for data completion, and starting to load the configuration file, wherein the configuration file includes information of the association fields between the main table and the secondary table, secondary table configuration information, main table configuration information, and output table configuration information; wherein the association condition of the information of the association fields between the main table and the secondary table includes AND and OR, and AND indicates that all the association conditions need to be met, and OR indicates that only one of the association conditions needs to be met; The secondary table configuration information includes the primary table field name and secondary table field name related to the association condition configuration of the primary table and the secondary table, whether the primary table field can be transposed and the automatic separator that needs to be configured when transposing, the output table field name and secondary table field name related to the mapping configuration of the output table and the secondary table, and the secondary table name related to the secondary table configuration information. The mapping configuration of the output table and the secondary table is: if the secondary table field exists in the primary table, it means that the secondary table field value is used to overwrite the primary table field value to achieve the completion function; if the secondary table field does not exist in the primary table, it means that the secondary table field is added to the primary table as the output table; The main table configuration information includes the main table field list and the main table name; The output table configuration information includes the output table field list and the output table name; A streaming data processing step, accessing data from Kafka, and processing the data through a streaming computing framework, wherein the data processing includes executing the SQL generated by the configuration file to obtain the completed data; The completion result output step outputs the completed data to the Kafka topic.

2. The streaming data completion method according to claim 1, characterized in that: The streaming data processing step further includes: when accessing data from the kafka, filtering out a data set whose key is the main table and the secondary table.

3. The streaming data completion method according to claim 2, characterized in that: The streaming data processing step further includes: if the data accessed in the kafka is the secondary table data, updating the secondary table data to the memory.

4. A streaming data completion system, characterized in that: include: A configuration file loading module is used to design a configuration file for generating SQL for data completion, and start loading the configuration file, wherein the configuration file includes information of the association fields between the main table and the secondary table, secondary table configuration information, main table configuration information, and output table configuration information; wherein the association condition of the information of the association fields between the main table and the secondary table includes AND and OR, and AND indicates that all the association conditions need to be met, and OR indicates that only one of the association conditions needs to be met; The secondary table configuration information includes the primary table field name and secondary table field name related to the association condition configuration of the primary table and the secondary table, whether the primary table field can be transposed and the automatic separator that needs to be configured when transposing, the output table field name and secondary table field name related to the mapping configuration of the output table and the secondary table, and the secondary table name related to the secondary table configuration information. The mapping configuration of the output table and the secondary table is: if the secondary table field exists in the primary table, it means that the secondary table field value is used to overwrite the primary table field value to achieve the completion function; if the secondary table field does not exist in the primary table, it means that the secondary table field is added to the primary table as the output table; The main table configuration information includes the main table field list and the main table name; The output table configuration information includes the output table field list and the output table name; A streaming data processing module receives data from Kafka and processes the data through a streaming computing framework, wherein the data processing includes executing the SQL generated by the configuration file to obtain the completed data; The completion result output module outputs the completed data to the topic of Kafka.

5. The streaming data completion system according to claim 4, characterized in that: The stream data processing module further includes: when accessing data from the kafka, filtering out a data set whose key is the main table and the secondary table.

6. The streaming data completion system according to claim 5, characterized in that: The stream data processing module further includes: if the data accessed in the kafka is the secondary table data, updating the secondary table data to the memory.

7. 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, the streaming data completion method according to any one of claims 1 to 3 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the streaming data completion method according to any one of claims 1 to 3 is implemented.