Method, device and equipment for generating multi-transaction fact table and storage medium
By refining the granularity and degrading the dimension, and combining the writing method of the custom component, a multi-transaction fact table is generated, which solves the problem that existing technologies cannot process the join of multiple transaction data streams in real time, and achieves the accuracy and completeness of the fact table.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- RUISHI (SUZHOU) VIDEO TECH CO LTD
- Filing Date
- 2023-09-28
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies cannot join multiple transaction data streams at once in real-time scenarios, and the write connector of the Flink real-time processing framework cannot guarantee the integrity of multiple transactions, resulting in the earlier transaction records being overwritten by subsequent transaction records.
By determining the real-time data stream of the transaction to be written, granularity refinement and dimension degradation processing are performed to establish a mapping of blank multi-transaction fact tables. A custom component is used to determine whether the target field is empty. If not, it is written into the blank multi-transaction fact table to generate a multi-transaction fact table.
It enables real-time generation of multi-transaction fact tables, ensuring the accuracy and completeness of records in the fact tables, avoiding the problem of earlier transaction records being overwritten by later transaction records, and improving the real-time performance and efficiency of data processing.
Smart Images

Figure CN117271518B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data warehouse technology, and in particular to a method, apparatus, device, and storage medium for generating multi-transaction fact tables. Background Technology
[0002] A data warehouse (DW) is a strategic collection of data that supports all types of data in decision-making processes at all levels of an enterprise. It is a single data store created for analytical reporting and decision support purposes, providing guidance for business process improvement, monitoring of time, cost, quality, and control for enterprises that require business intelligence. Fact tables are a crucial component of a data warehouse; each data warehouse contains one or more fact tables, which may contain business data and typically contain a large number of rows.
[0003] In existing technologies, offline scenarios can combine multiple business metrics into a single table using full joins based on business dimensions, but this method cannot meet real-time requirements. In real-time scenarios, existing Flink real-time processing frameworks cannot simultaneously join three or more transactional data streams, requiring step-by-step implementation using Flink dual-stream joins. However, among the three existing Flink dual-stream join methods, the ideal regular join requires significant storage resources. Furthermore, Flink's official write connector for writing transactions to the fact table only offers append and upsert modes. In existing multi-transaction business scenarios, earlier transaction records are completely overwritten by subsequent transaction records, failing to guarantee multi-transaction integrity. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and storage medium for generating multi-transaction fact tables, so as to realize the real-time generation of fact tables containing multiple transactions and accurately reflect multiple business processes through a single fact table.
[0005] According to one aspect of the present invention, a method for generating a multi-transaction fact table is provided, comprising:
[0006] Identify at least one transaction to be written, and establish a blank multi-transaction fact table based on the at least one transaction to be written; wherein each of the at least one transaction to be written corresponds to a business process;
[0007] Obtain the real-time data stream of the at least one transaction to be written, and perform granular refinement and dimension degradation processing on the real-time data stream of the at least one transaction to be written according to the blank multi-transaction fact table, and establish a mapping between each transaction to be written and the blank multi-transaction fact table respectively.
[0008] Extract the target fields of each transaction to be written, and use a custom component to determine whether the data of the target field is empty. If not, write the data into the blank multi-transaction fact table according to the corresponding mapping with the blank multi-transaction fact table to generate the multi-transaction fact table.
[0009] Further, establishing a blank multi-transaction fact table based on the at least one transaction to be written includes:
[0010] The fact table granularity, fact table dimension, and fact table metric field of the blank multi-transaction fact table are determined based on the at least one transaction to be written.
[0011] Determine the primary key of the fact table in the blank multi-transaction fact table;
[0012] The blank multi-transaction fact table is established based on the fact table granularity, the fact table dimension, the fact table metric field, and the fact table primary key.
[0013] Further, the fact table granularity, fact table dimensions, and fact table metric fields of the blank multi-transaction fact table are determined, including:
[0014] Identify the smallest granularity transaction among the at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the granularity of the fact table;
[0015] Extract the transaction dimensions contained in each of the transactions to be written, and take the intersection of the transaction dimensions corresponding to each of the transactions to be written as the fact table dimension;
[0016] Extract the transaction metric fields contained in each of the transactions to be written, and take the non-repeating union of the transaction metric fields corresponding to each of the transactions to be written as the metric field of the fact table.
[0017] Furthermore, the real-time data stream of the at least one transaction to be written is subjected to granular refinement processing, including:
[0018] Identify a target real-time data stream in the real-time data stream of the at least one transaction to be written, whose granularity is larger than that of the blank multi-transaction fact table;
[0019] The target real-time data stream is split so that the granularity of the real-time data stream of each transaction to be written is consistent with the granularity of the fact table of the blank multi-transaction fact table.
[0020] Furthermore, the real-time data stream of the at least one transaction to be written is subjected to dimensional degradation processing, including:
[0021] Identify the real-time data stream to be degraded in the real-time data stream of the at least one transaction to be written;
[0022] Based on the mapping relationship between dimensions, the dimensions of the real-time data stream to be degraded are parsed to make the dimensions of the real-time data stream of each transaction to be written consistent with the dimensions of the fact table of the blank multi-transaction fact table.
[0023] Further, the target fields of each transaction to be written are extracted, and a custom component is used to determine whether the data in the target field is empty. If not, the data is written into the blank multi-transaction fact table according to the corresponding mapping, including:
[0024] Determine the target fields corresponding to each of the transactions to be written;
[0025] The corresponding field of the target field in the blank multi-transaction fact table is determined based on the mapping between each transaction to be written and the blank multi-transaction fact table;
[0026] The data corresponding to the target fields of each transaction to be written is extracted sequentially. If the data corresponding to the target field is not empty, it is written into the corresponding field of the blank multi-transaction fact table by the custom component. The custom component overrides the method of writing data into the blank multi-transaction fact table in the streaming computing framework.
[0027] Furthermore, after generating the multi-transaction fact table, the method further includes:
[0028] Obtain the target dimension, and logically divide the multi-transaction fact table according to the target dimension to obtain the frequently accessed fact table and other fact tables. Store the frequently accessed fact table in a solid-state drive and the other fact tables in a hard disk drive.
[0029] According to another aspect of the present invention, an apparatus for generating a multi-transaction fact table is provided, comprising:
[0030] The blank multi-transaction fact table creation module is used to determine at least one transaction to be written and to create a blank multi-transaction fact table based on the at least one transaction to be written; wherein, each of the at least one transaction to be written corresponds to a business process.
[0031] The mapping establishment module is used to obtain the real-time data stream of the at least one transaction to be written, and to perform granular refinement and dimension degradation processing on the real-time data stream of the at least one transaction to be written according to the blank multi-transaction fact table, and to establish a mapping between each of the transactions to be written and the blank multi-transaction fact table respectively.
[0032] The multi-transaction fact table generation module is used to extract the target fields of each transaction to be written, and to determine whether the data of the target field is empty through a custom component. If not, the data is written into the blank multi-transaction fact table according to the corresponding mapping with the blank multi-transaction fact table, thereby generating the multi-transaction fact table.
[0033] Optionally, the blank multi-transaction fact table creation module is also used for:
[0034] The fact table granularity, fact table dimension, and fact table metric field of the blank multi-transaction fact table are determined based on the at least one transaction to be written.
[0035] Determine the primary key of the fact table in the blank multi-transaction fact table;
[0036] The blank multi-transaction fact table is established based on the fact table granularity, the fact table dimension, the fact table metric field, and the fact table primary key.
[0037] Optionally, the blank multi-transaction fact table creation module is also used for:
[0038] Identify the smallest granularity transaction among the at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the granularity of the fact table;
[0039] Extract the transaction dimensions contained in each of the transactions to be written, and take the intersection of the transaction dimensions corresponding to each of the transactions to be written as the fact table dimension;
[0040] Extract the transaction metric fields contained in each of the transactions to be written, and take the non-repeating union of the transaction metric fields corresponding to each of the transactions to be written as the metric field of the fact table.
[0041] Optionally, the mapping establishment module is also used for:
[0042] Identify a target real-time data stream in the real-time data stream of the at least one transaction to be written, whose granularity is larger than that of the blank multi-transaction fact table;
[0043] The target real-time data stream is split so that the granularity of the real-time data stream of each transaction to be written is consistent with the granularity of the fact table of the blank multi-transaction fact table.
[0044] Optionally, the mapping establishment module is also used for:
[0045] Identify the real-time data stream to be degraded in the real-time data stream of the at least one transaction to be written;
[0046] Based on the mapping relationship between dimensions, the dimensions of the real-time data stream to be degraded are parsed to make the dimensions of the real-time data stream of each transaction to be written consistent with the dimensions of the fact table of the blank multi-transaction fact table.
[0047] Optionally, the multi-transaction fact table generation module is also used for:
[0048] Determine the target fields corresponding to each of the transactions to be written;
[0049] The corresponding field of the target field in the blank multi-transaction fact table is determined based on the mapping between each transaction to be written and the blank multi-transaction fact table;
[0050] The data corresponding to the target fields of each transaction to be written is extracted sequentially. If the data corresponding to the target field is not empty, it is written into the corresponding field of the blank multi-transaction fact table by the custom component. The custom component overrides the method of writing data into the blank multi-transaction fact table in the streaming computing framework.
[0051] Optionally, the device further includes a multi-transaction fact table partitioning module, used to obtain a target dimension, logically partition the multi-transaction fact table according to the target dimension to obtain a frequently accessed fact table and other fact tables, store the frequently accessed fact table in a solid-state drive, and store the other fact tables in a hard disk drive.
[0052] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0053] At least one processor; and
[0054] A memory communicatively connected to the at least one processor; wherein,
[0055] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method for generating a multi-transaction fact table according to any embodiment of the present invention.
[0056] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the method for generating a multi-transaction fact table as described in any embodiment of the present invention.
[0057] This invention discloses a method for generating a multi-transaction fact table. First, at least one transaction to be written is identified, and a blank multi-transaction fact table is established based on this transaction. Each transaction corresponds to a business process. Then, the real-time data stream of the at least one transaction is acquired, and the real-time data stream is refined in granularity and degraded in dimension based on the blank multi-transaction fact table, establishing a mapping between each transaction and the blank multi-transaction fact table. Finally, the target fields of each transaction are extracted, and a custom component is used to determine whether the data in the target field is empty. If not, the data is written into the blank multi-transaction fact table according to the corresponding mapping, thus generating the multi-transaction fact table. This method can process real-time data streams from multiple transactions at once, generating a real-time multi-transaction fact table. Furthermore, when a later-arriving transaction has an empty target field, the data record of that target field in the earlier-arriving transaction will not be overwritten by the empty value of the target field in the later-arriving transaction, ensuring that a single record in the fact table accurately reflects the facts of multiple related business processes.
[0058] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a flowchart of a method for generating a multi-transaction fact table according to Embodiment 1 of the present invention;
[0061] Figure 2 This is a schematic diagram illustrating the interaction between a business system and a fact table according to Embodiment 1 of the present invention;
[0062] Figure 3 This is a flowchart of a method for generating a multi-transaction fact table according to Embodiment 2 of the present invention;
[0063] Figure 4 This is a schematic diagram illustrating the mapping relationship between each transaction to be written and a blank multi-transaction fact table according to Embodiment 2 of the present invention;
[0064] Figure 5This is a schematic diagram of the structure of a multi-transaction fact table generation device according to Embodiment 3 of the present invention;
[0065] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the method for generating a multi-transaction fact table according to Embodiment 4 of the present invention. Detailed Implementation
[0066] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0067] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0068] Figure 1 This is a flowchart illustrating a method for generating a multi-transaction fact table according to an embodiment of the present invention. This embodiment is applicable to situations where data streams from multiple transactions are aggregated in real time to generate a single fact table. This method can be executed by a multi-transaction fact table generation device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0069] S110. Determine at least one transaction to be written, and create a blank multi-transaction fact table based on at least one transaction to be written.
[0070] Each of the at least one write transactions corresponds to a business process.
[0071] In this embodiment, the multi-transaction fact table is a single fact table that reflects the business processes of multiple transactions. Transactions to be written are those that need to be aggregated into the multi-transaction fact table. The blank multi-transaction fact table is the multi-transaction fact table before the data from each transaction to be written is written; in other words, it's a single multi-transaction fact table model.
[0072] Specifically, in existing application scenarios, it may be necessary to analyze and query multiple transactions of a single analytical object. These transactions correspond to different business processes, are generated by different business systems, and can be stored as business data streams in an OLTP database or message queue. Each business system can push the generation and update messages of its business data streams to a Kafka message queue or a transactional database such as MySQL. On the one hand, the time error between transaction data streams from different business systems is uncertain, but the analysis system requires that the error between each transaction and the source system be as small as possible; on the other hand, the analysis system needs to return as much transaction information as possible for the queried object in a single query. Therefore, it is necessary to aggregate multiple transactions into a single fact table for analysis. For example, in a road vehicle and pedestrian capture system, information on captured vehicles and pedestrians can be queried. By aggregating transactions generated by the system for motor vehicles, non-motor vehicles, and human images into a single fact table, if an ID number is entered, the system can return the basic household registration information, facial capture and feature information, motor vehicle travel information, non-motor vehicle travel information, human body capture and feature information, etc., corresponding to that ID number. This allows for a detailed description of the trajectory and characteristics of the queried object, facilitating applications such as real-time tracking and analysis.
[0073] In this embodiment, in order to generate a multi-transaction fact table, it is necessary to first establish a model of the multi-transaction fact table, namely a blank multi-transaction fact table, and then write the data of each transaction to be written into the blank multi-transaction fact table.
[0074] Optionally, a blank multi-transactional fact table needs to be created based on each transaction to be written. Each transaction to be written can be determined according to actual business needs, and the specific transactions to be written are known before the blank multi-transactional fact table is created. Then, by analyzing the granularity, dimensions, and metrics of each transaction to be written, the business processes, fact table granularity, fact table dimensions, and fact table metric fields contained in the blank multi-transactional fact table are determined, and the relationships of the business processes are degraded to the primary key to determine the primary key of the fact table.
[0075] S120. Obtain the real-time data stream of at least one transaction to be written, and perform granular refinement and dimension degradation processing on the real-time data stream of at least one transaction to be written based on the blank multi-transaction fact table, and establish the mapping between each transaction to be written and the blank multi-transaction fact table respectively.
[0076] The granularity of the fact table reflects the level of detail in a row of data; the smaller the granularity, the more detailed the data.
[0077] In this embodiment, in order to establish the mapping between each transaction to be written and the blank multi-transaction fact table, when the granularity of the real-time data stream of the transaction to be written is inconsistent with that of the blank multi-transaction fact table, it is necessary to refine the granularity of the real-time data stream of the transaction to be written so that the granularity of the real-time data stream of each transaction to be written is consistent with that of the blank multi-transaction fact table.
[0078] Preferably, the granularity of the blank multi-transaction fact table can be determined based on the transaction with the smallest granularity among the transactions to be written. The way to refine the granularity of at least one transaction to be written can be to process the granularity of the real-time data stream of each transaction to be written to be consistent with that of the transaction with the smallest granularity.
[0079] Furthermore, after refining the granularity of each transaction to be written, the fields corresponding to each transaction in the blank multi-transaction fact table can be matched with the field content contained in each transaction to be written, thereby establishing a mapping between each transaction to be written and the blank multi-transaction fact table, so that the fields that need to be filled in the blank multi-transaction fact table can find the corresponding field content in each transaction to be written.
[0080] Furthermore, dimension refers to the perspective and conditions from which a problem is viewed. In relation to granularity, the more perspectives and conditions there are when viewing a problem, the finer the granularity becomes.
[0081] In one implementation, the dimension of the fact table to be degraded is performed based on the blank multi-transaction fact table, so that the dimension of the real-time data stream to be written for each transaction is consistent with the dimension of the fact table.
[0082] S130. Extract the target fields of each transaction to be written. Use a custom component to determine whether the data of the target field is empty. If not, write the data into the blank multi-transaction fact table according to the corresponding mapping with the blank multi-transaction fact table to generate the multi-transaction fact table.
[0083] Custom components can be tools used for writing data to the fact table. The target fields for the write transactions include the transaction primary key field, various dimension fields, and various measure fields. The transaction primary key for each write transaction is a subset of the fact table primary key.
[0084] For each transaction, the target fields corresponding to that transaction have already been defined in the blank multi-transaction fact table that has been established.
[0085] In this embodiment, the primary key of the fact table in the multi-transaction fact table is queried based on the transaction primary key of the current transaction to be written, to determine the corresponding fields that the current transaction to be written needs to write in the multi-transaction fact table. The working logic of the custom component can be: dynamically determining whether the dimension fields, measure fields, etc., corresponding to the current transaction to be written are null values, extracting the data corresponding to the fields that are not null values and updating the corresponding fields in the multi-transaction fact table.
[0086] It should be noted that in existing technologies, when writing the data stream of a transaction to be written into a blank multi-transaction fact table, the data stream acquired earlier needs to be placed in a cache. The transaction data stream associated with the previously acquired data stream is then retrieved and written into the fact table, either after the previously acquired data stream has been retrieved or after the cached data stream has been stored for a set time. However, in this embodiment, when writing data for a transaction to be written, it is not necessary to place the previously acquired data stream in a cache; instead, the data is directly retrieved and written into the blank multi-transaction fact table.
[0087] For example, a blank multi-transactional fact table contains measure fields M1, M2, and M3. A transaction A to be written contains measure field M1. If measure field M1 in the blank multi-transactional fact table matches measure field M1 in transaction A, the data from measure field M1 in transaction A can be extracted and written into measure field M1 in the blank multi-transactional fact table, thus obtaining the multi-transactional fact table. Similarly, data from other transactions to be written is written to the multi-transactional fact table already written to transaction A, dynamically updating the multi-transactional fact table in real time.
[0088] It's important to note that a blank multi-transactional fact table refers to a multi-transactional fact table when no data has been written. After data is written and a multi-transactional fact table is generated, new transaction data updates or adds data to the existing multi-transactional fact table. The only difference between the two is whether data has already been written.
[0089] Furthermore, after generating the multi-transaction fact table, you can also: obtain the target dimension and partition the multi-transaction fact table according to the target dimension.
[0090] In this embodiment, after generating the multi-transaction fact table, it can be optimized to further improve the query efficiency of the multi-transaction fact table. The optimization method for the multi-transaction fact table can be to divide it into partitions according to a set target dimension and store them in partitions. The partitioning principle can be to store frequently accessed fact tables in hard drives with fast read / write speeds.
[0091] Optionally, the method for partitioning and storing multi-transaction fact tables according to the target dimension can be as follows: logically divide the multi-transaction fact tables according to the target dimension to obtain frequently accessed fact tables and other fact tables; store the frequently accessed fact tables in solid-state drives and store the other fact tables in hard disk drives.
[0092] Specifically, the target dimension can be the most commonly used dimension. For example, if the time dimension is used as the target dimension, then when processing tasks in real time for each business data stream, the business time field can be parsed to dynamically generate the write target. The write target for today's data can be "Multi-transaction Fact Table_{today}", which will be used as a frequently accessed fact table, while the write target for past data can be "Multi-transaction Fact Table_{past}", which will be used as other fact tables.
[0093] Furthermore, based on the logical partitioning results, the partitioned fact tables can be physically stored on separate disks. Preferably, frequently accessed fact tables can be stored on solid-state drives (SSDs), while other fact tables can be stored on hard disk drives (HDDs). SSDs utilize a non-mechanical storage method, resulting in faster read and write speeds compared to HDDs. This speed advantage is particularly pronounced when reading small files.
[0094] Furthermore, the multi-transactional fact table in this embodiment can provide multiple access and usage modes, enabling business systems to interact with the fact table in different ways to meet the needs of different types of developers and performance requirements. Preferably, the interaction methods between the multi-transactional fact table and the business system can include, but are not limited to: a visual interaction mode, where developers configure the result fields and input parameters and calculation logic on the front-end page as needed, and the back-end converts and constructs the corresponding JSON format query statement and returns the result; an interaction mode based on the Freemarker template engine, providing the Freemarker template engine to assemble input parameters and calculation logic, and construct the corresponding JSON format query statement; and an SQL query mode based on the Trino-ES engine, using MyBatis to assemble input parameters and query conditions, and construct the SQL query statement.
[0095] Figure 2 This is a schematic diagram of the interaction between a business system and a fact table provided by an embodiment of the present invention. As shown in the figure, after each transaction A, B, and C to be written is written to the multi-transaction fact table, a multi-transaction fact table summarizing the data of the three transactions can be obtained. This multi-transaction fact table can interact with multiple business systems and provide multiple interaction interfaces and interaction methods for each business system.
[0096] The method for generating a multi-transaction fact table disclosed in this invention first determines at least one transaction to be written and establishes a blank multi-transaction fact table based on the at least one transaction to be written. Each of the at least one transaction to be written corresponds to a business process. Then, the at least one transaction to be written undergoes granularity refinement and dimension degradation processing to establish a mapping between each transaction and the blank multi-transaction fact table. Finally, the target fields of each transaction to be written are extracted, and a custom component is used to determine whether the data in the target field is empty. If not, the data is written into the blank multi-transaction fact table according to the corresponding mapping, thus generating the multi-transaction fact table. This method can process real-time data streams of multiple transactions at once, generating a real-time multi-transaction fact table. Furthermore, when a later-arriving transaction has an empty target field, the data record of the target field in the earlier-arriving transaction will not be overwritten by the empty value of the target field in the later-arriving transaction, ensuring that a single record in the fact table accurately reflects the facts of multiple related business processes. In addition, when writing transactions into the multi-transaction fact table, intermediate processing results do not need to be stored in a cache, thus preventing data discard due to excessive data latency and ensuring data accuracy.
[0097] Figure 3 This is a flowchart illustrating a method for generating a multi-transaction fact table according to an embodiment of the present invention. This embodiment is a refinement and addition of features from the above embodiments. Figure 3 As shown, the method includes:
[0098] S210. Determine at least one transaction to be written, and determine the fact table granularity, fact table dimension, and fact table metric field of the blank multi-transaction fact table based on the at least one transaction to be written.
[0099] Each of the at least one write transactions corresponds to a business process.
[0100] The granularity of the fact table reflects the level of detail in a row of data; the smaller the granularity, the more detailed the data. The dimensions of the fact table represent the perspective and environment from which the problem is viewed; the more perspectives and conditions are considered, the finer the granularity. For example, these could include the gender, age group, and facial features of the analyzed object, as well as the time, equipment, and administrative division of the snapshot for a specific person. The metrics of the fact table can be categorized into additive, semi-additive, and non-additive metrics. For example, additive metrics could include the number of snapshots or the number of times two people travel together; semi-additive metrics could include the time interval since the last snapshot; and non-additive metrics could include the growth rate of the number of snapshots.
[0101] In this embodiment, when creating a blank multi-transaction fact table, it is necessary to determine the fact table granularity, fact table dimension, and fact table metric field of the blank multi-transaction fact table, and then improve the multi-transaction fact table model based on this information.
[0102] Optionally, the fact table granularity, fact table dimension, and fact table metric field of a blank multi-transaction fact table can be determined as follows: identify the smallest granularity transaction among at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the fact table granularity; extract the transaction dimensions contained in each transaction to be written, and take the intersection of the transaction dimensions corresponding to each transaction to be written as the fact table dimension; extract the transaction metric field contained in each transaction to be written, and take the non-repeating union of the transaction metric fields corresponding to each transaction to be written as the fact table metric field.
[0103] Specifically, taking three transactions to be written (A, B, and C) as examples, let transaction A contain sub-transactions A1 and A2 targeting analysis object P1, transaction B targets analysis objects P1 and P2, and transaction C targets analysis objects P1 and P2. Transaction A is the smallest granularity among the three transactions to be written, and its granularity can be determined as the fact table granularity.
[0104] After determining the granularity of the fact table, the intersection of the transaction dimensions corresponding to each transaction to be written can be used as the fact table dimension, and the unique union of the transaction measure fields corresponding to each transaction to be written can be used as the fact table measure field. Taking three transactions A, B, and C to be written as an example, let transaction A contain dimensions D1, D2, and D3, transaction B contain dimensions D1, D2, D3, and D4, and transaction C contain dimensions D1, D2, and D3. The intersection of their transaction dimensions is dimension D1, D2, and D3, so the fact table dimensions can be determined as D1, D2, and D3. Let transaction A contain measure field M1, transaction B contain measure field M2, and transaction C contain measure field M3, then the fact table measure fields can be determined as M1, M2, and M3.
[0105] S220. Determine the primary key of the fact table for the blank multi-transaction fact table.
[0106] The primary key can be identification information related to each transaction to be written. The transaction primary key of each transaction to be written can be extracted after granular refinement and dimension degradation. The fact table primary key includes the transaction primary keys of all corresponding transactions to be written.
[0107] In this embodiment, in order to generate the subsequent multi-transaction fact table, a fact table primary key (PK) needs to be defined in the blank multi-transaction fact table model. The real-time processing modules of each business process will then perform write and update operations on the fact table based on this fact table primary key. When writing the data of each transaction to be written into the blank multi-transaction fact table, the fact table primary key can be queried through the transaction primary key to identify the multi-transaction fact table to be written and the position of the data to be written in the multi-transaction fact table, and then the data is written.
[0108] Optionally, the method for determining the primary key of the fact table can be to extract the common identifier in each transaction to be written and use the common identifier as the primary key of the fact table; another method is to determine the primary key of the fact table based on the intersection of the transaction dimensions in each transaction to be written. For example, if the transaction dimensions of the three transactions to be written, A, B, and C, all contain dimensions D1, D2, and D3, then the value of the combination of D1, D2, and D3 can be used as the primary key of the fact table.
[0109] S230. Create a blank multi-transaction fact table based on the fact table granularity, fact table dimension, fact table metric field, and fact table primary key.
[0110] In this embodiment, after determining the fact table granularity, fact table dimension, fact table metric field, and fact table primary key, it is possible to determine what content needs to be filled in each row of records, thus determining the structure of the blank multi-transaction fact table. Therefore, a blank multi-transaction fact table can be established.
[0111] The primary key of the fact table can be a common identifier extracted from each transaction to be written, or it can be a combination of transaction dimensions from each transaction to be written.
[0112] S240. Obtain at least one real-time data stream of a transaction to be written. Based on the blank multi-transaction fact table, determine the target real-time data stream in the real-time data stream of at least one transaction to be written, whose granularity is larger than that of the fact table in the blank multi-transaction fact table. Split the target real-time data stream so that the granularity of the real-time data stream of each transaction to be written is consistent with the granularity of the fact table in the blank multi-transaction fact table.
[0113] The target real-time data stream is a real-time data stream with a granularity larger than that of a blank multi-transaction fact table within the real-time data stream of at least one transaction to be written.
[0114] In this embodiment, since the granularity of the fact table is consistent with the granularity of the smallest transaction in each transaction to be written, the real-time data streams of other transactions to be written with larger granularities need to be split into smaller granularities to make their granularity consistent with the granularity of the fact table in the blank multi-transaction fact table, so as to establish a mapping with the blank multi-transaction fact table.
[0115] For example, suppose there are three transactions to be written: A, B, and C. Transaction A is the smallest granularity transaction, containing sub-transactions A1 and A2 targeting object P1 and object P2, respectively. Transaction B and transaction C both target objects P1 and P2. Transactions B and C need to be split. Transaction B is split into two transactions: transaction B1 targeting object P1 and transaction B2 targeting object P2. Similarly, transaction C is also split into two transactions: transaction C1 targeting object P1 and transaction C2 targeting object P2.
[0116] Preferably, since the business processes of each transaction to be written are relatively independent, in order to prevent the processing of each transaction from being interrupted by other interfering factors, the Flink data computing framework can be used to divide the data stream of each transaction into multiple Flink streaming tasks for processing, so that each Flink streaming task corresponds to one transaction to be written. The Flink streaming task can extract the primary key, dimensions, metrics, etc. contained in the transaction to be written.
[0117] Furthermore, the method for performing dimension degradation processing on the real-time data stream of at least one transaction to be written can be as follows: determine the real-time data stream to be degraded in the real-time data stream of at least one transaction to be written; parse the dimensions of the real-time data stream to be degraded according to the mapping relationship between dimensions, so that the dimensions of the real-time data stream of each transaction to be written are consistent with the dimensions of the fact table of the blank multi-transaction fact table.
[0118] Specifically, Flink streaming tasks can also perform dimension degradation on the real-time data stream of the transaction to be written, thereby enriching the transaction dimensions. For example, if a transaction to be written contains an ID number dimension, dimension degradation can yield two new dimensions: gender and date of birth. Correspondingly, when determining the dimensions of the fact table, dimension degradation can be performed on each transaction to be written first, and then the intersection of the degraded dimensions can be taken as the fact table dimensions.
[0119] S250. Establish mappings between each transaction to be written and the blank multi-transaction fact table.
[0120] In this embodiment, after refining the granularity of each transaction to be written, the fields in the blank multi-transaction fact table can be matched with the field content contained in each transaction to be written, thereby establishing a mapping between each transaction to be written and the blank multi-transaction fact table. This allows the fields that need to be filled in the blank multi-transaction fact table to find the corresponding field content in each transaction to be written, so that the data of each transaction to be written can be written into the blank multi-transaction fact table.
[0121] Figure 4This is a schematic diagram illustrating the mapping relationship between each transaction to be written and a blank multi-transaction fact table provided by an embodiment of the present invention. As shown in the figure, A, B, and C are three transactions to be written. The primary key of the fact table in the established blank multi-transaction fact table is consistent with the transaction primary key of each transaction to be written. The transaction primary key of each transaction to be written can be mapped to the primary key of the fact table. The blank multi-transaction fact table contains dimensions D1, D2, and D3. The dimensions D1, D2, and D3 in each transaction to be written are mapped to the dimensions D1, D2, and D3 in the blank multi-transaction fact table, respectively. The blank multi-transaction fact table contains measurement fields M1, M2, and M3. The measurement field M1 in transaction A, the measurement field M2 in transaction B, and the measurement field M3 in transaction C are mapped to the measurement fields M1, M2, and M3 in the blank multi-transaction fact table, respectively.
[0122] S260. Determine the target fields corresponding to each transaction to be written. Based on the mapping between each transaction to be written and the blank multi-transaction fact table, determine the corresponding fields of the target fields in the blank multi-transaction fact table. Extract the data corresponding to the target fields of each transaction to be written in sequence. Through a custom component, if it is determined that the data corresponding to the target field is not empty, write it into the corresponding field of the blank multi-transaction fact table to generate the multi-transaction fact table.
[0123] The custom component rewrites the method in the streaming computing framework used to write data into a blank multi-transactional fact table.
[0124] In the Flink framework, Flink provides an Elasticsearch(es) write connector for writing data from transactions to a fact table. However, when using this connector, due to the defined primary key in the fact table, in multi-transaction scenarios, transactions with the same primary key will have their earlier writes completely overwritten by later writes, leading to missing metrics. For example, if transaction A writes the primary key and metric M1 to an empty multi-transaction fact table, and then transaction B writes real-time business data with the same primary key as transaction A, transaction B will not have a metric field M1, so the system will determine it as empty. This empty value will overwrite the M1 written by transaction A. Similarly, subsequent transactions with the same primary key as transaction B will also overwrite the empty value in B, resulting in the M1 field of the multi-transaction fact table ultimately only containing the last arriving metric.
[0125] In this embodiment, to address the aforementioned write overwrite issue, the Flink write-to-Elasticsearch connector method can be rewritten using a custom component, inheriting the ElasticsearchSinkFunction from the Flink dependency. <t>The class is rewritten, and the `process(RowData element, RuntimeContext ctx, RequestIndexer indexer)` method is overridden. Furthermore, the write overwrite problem can be solved by using a custom function. Specifically, after overriding the write method, only data with non-null values corresponding to the target fields of each transaction can be written to the corresponding fields of the multi-transaction fact table, achieving incremental updates, full overwrite, or dynamic determination of updates and overwrites based on specified fields.
[0126] by Figure 4 For example, if the target field in the data stream processing task of transaction A is metric M1, and the connector detects that fields M2 and M3 have no specified values, then when writing data, only the M1 field of transaction A is written to the blank multi-transaction fact table, while the M2 and M3 fields retain their original state and are not operated on. If the target field in the data stream processing task of transaction B is metric M2, then when writing data, the metric field M1 in the multi-transaction fact table retains the metric value just written by transaction A, and the metric field M2 is updated to the metric value of the M2 field of transaction B. Similarly, if the target field in the data stream processing task of transaction C is metric M3, then when writing data, the metric field M1 in the multi-transaction fact table retains the metric value written by transaction A, the metric field M2 retains the metric value written by transaction B, and the metric field M3 is updated to the metric value of the M3 field of transaction C.
[0127] The method for generating multi-transaction fact tables disclosed in this invention rewrites the existing method of writing data of transactions to be written to the fact table under the Flink framework, realizes real-time writing of multi-transaction data streams, and solves the problem of later-arriving transactions with the same primary key overwriting earlier-arriving transactions.
[0128] Figure 5 This is a schematic diagram of a multi-transaction fact table generation device provided in an embodiment of the present invention. Figure 5 As shown, the device includes: a blank multi-transaction fact table creation module 310, a mapping creation module 320, and a multi-transaction fact table generation module 330.
[0129] Blank multi-transaction fact table creation module 310 is used to determine at least one transaction to be written and to create a blank multi-transaction fact table based on the at least one transaction to be written; wherein, each of the at least one transaction to be written corresponds to a business process.
[0130] The mapping establishment module 320 is used to obtain the real-time data stream of at least one transaction to be written, and to perform granular refinement and dimension degradation processing on the real-time data stream of at least one transaction to be written based on the blank multi-transaction fact table, and to establish mappings between each transaction to be written and the blank multi-transaction fact table respectively.
[0131] The multi-transaction fact table generation module 330 is used to extract the target fields of each transaction to be written, and to determine whether the data of the target field is empty through a custom component. If not, it writes the data into the blank multi-transaction fact table according to the corresponding mapping with the blank multi-transaction fact table, thereby generating the multi-transaction fact table.
[0132] Optionally, the blank multi-transactional fact table creation module 310 is also used for:
[0133] Determine the fact table granularity, fact table dimension, and fact table measure field of the blank multi-transaction fact table based on at least one transaction to be written; determine the fact table primary key of the blank multi-transaction fact table; and build the blank multi-transaction fact table based on the fact table granularity, fact table dimension, fact table measure field, and fact table primary key.
[0134] Optionally, the blank multi-transactional fact table creation module 310 is also used for:
[0135] Identify the smallest granularity transaction among at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the granularity of the fact table; extract the transaction dimensions contained in each transaction to be written, and take the intersection of the transaction dimensions corresponding to each transaction to be written as the fact table dimension; extract the transaction metric fields contained in each transaction to be written, and take the non-repeating union of the transaction metric fields corresponding to each transaction to be written as the fact table metric field.
[0136] Optionally, the mapping establishment module 320 is also used for:
[0137] Identify a target real-time data stream in the real-time data stream of at least one transaction to be written, whose granularity is larger than that of the blank multi-transaction fact table; split the target real-time data stream so that the granularity of the real-time data stream of each transaction to be written is consistent with the granularity of the fact table of the blank multi-transaction fact table.
[0138] Optionally, the mapping establishment module 320 is also used for:
[0139] Identify the degraded real-time data stream in the real-time data stream of at least one transaction to be written; based on the mapping relationship between dimensions, parse the dimensions of the degraded real-time data stream to be written, so that the dimensions of the real-time data stream of each transaction to be written are consistent with the dimensions of the fact table of the blank multi-transaction fact table.
[0140] Optionally, the multi-transaction fact table generation module 330 is also used for:
[0141] Determine the target field corresponding to each transaction to be written; determine the corresponding field of the target field in the blank multi-transaction fact table based on the mapping between each transaction to be written and the blank multi-transaction fact table; extract the data corresponding to the target field of each transaction to be written in sequence; and, through a custom component, if the data corresponding to the target field is determined to be non-empty, write it into the corresponding field of the blank multi-transaction fact table.
[0142] The custom component rewrites the method in the streaming computing framework used to write data into a blank multi-transactional fact table.
[0143] Optionally, the device also includes a multi-transaction fact table partitioning module 340, used to obtain a target dimension and partition the multi-transaction fact table according to the target dimension.
[0144] Optionally, the multi-transactional fact table partitioning module 340 is also used for:
[0145] Obtain the target dimension, and logically divide the multi-transaction fact table according to the target dimension to obtain the frequently accessed fact table and other fact tables; store the frequently accessed fact table in the solid-state drive and store the other fact tables in the hard disk drive.
[0146] The multi-transaction fact table generation apparatus provided in the embodiments of the present invention can execute the multi-transaction fact table generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0147] Figure 6 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0148] like Figure 6 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0149] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0150] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the method for generating multi-transactional fact tables.
[0151] In some embodiments, the method for generating a multi-transaction fact table may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of generating the multi-transaction fact table described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the method for generating a multi-transaction fact table by any other suitable means (e.g., by means of firmware).
[0152] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0153] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0154] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0155] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0156] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0157] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0158] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.
[0159] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.< / t>
Claims
1. A method for generating a multi-transaction fact table, characterized in that, include: Identify at least one transaction to be written, and establish a blank multi-transaction fact table based on the at least one transaction to be written; wherein each of the at least one transaction to be written corresponds to a business process; Obtain the real-time data stream of the at least one transaction to be written, and perform granular refinement and dimension degradation processing on the real-time data stream of the at least one transaction to be written according to the blank multi-transaction fact table, and establish a mapping between each transaction to be written and the blank multi-transaction fact table respectively. Determine the target fields corresponding to each of the transactions to be written; The corresponding field of the target field in the blank multi-transaction fact table is determined based on the mapping between each transaction to be written and the blank multi-transaction fact table; The data corresponding to the target fields of each transaction to be written is extracted sequentially. Using a custom component, if the data corresponding to the target field is determined to be non-empty, it is written into the corresponding field of the blank multi-transaction fact table to generate the multi-transaction fact table. The custom component overrides the method in the streaming computing framework used to write data into the blank multi-transaction fact table. The multi-transaction fact table provides multiple access and usage modes to enable business systems to interact with it in different ways. The process of establishing a blank multi-transaction fact table based on at least one transaction to be written includes: Identify the smallest granularity transaction among the at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the granularity of the fact table; Extract the transaction dimensions contained in each of the transactions to be written, and take the intersection of the transaction dimensions corresponding to each of the transactions to be written as the fact table dimension; Extract the transaction metric fields contained in each of the transactions to be written, and take the non-repeating union of the transaction metric fields corresponding to each of the transactions to be written as the metric field of the fact table. Extract the common identifier from each of the transactions to be written, and use the common identifier as the primary key of the fact table, or determine the primary key of the fact table based on the intersection of the transaction dimensions in each of the transactions to be written; The blank multi-transaction fact table is established based on the fact table granularity, the fact table dimension, the fact table metric field, and the fact table primary key.
2. The method according to claim 1, characterized in that, Granularity refinement processing is performed on the real-time data stream of the at least one transaction to be written, including: Identify a target real-time data stream in the real-time data stream of the at least one transaction to be written, whose granularity is larger than that of the blank multi-transaction fact table; The target real-time data stream is split so that the granularity of the real-time data stream of each transaction to be written is consistent with the granularity of the fact table of the blank multi-transaction fact table.
3. The method according to claim 1, characterized in that, Perform dimensional degradation processing on the real-time data stream of the at least one transaction to be written, including: Identify the real-time data stream to be degraded in the real-time data stream of the at least one transaction to be written; Based on the mapping relationship between dimensions, the dimensions of the real-time data stream to be degraded are parsed to make the dimensions of the real-time data stream of each transaction to be written consistent with the dimensions of the fact table of the blank multi-transaction fact table.
4. The method according to claim 1, characterized in that, After generating the multi-transactional fact table, the method further includes: Obtain the target dimension, and logically divide the multi-transaction fact table according to the target dimension to obtain the frequently accessed fact table and other fact tables. Store the frequently accessed fact table in a solid-state drive and the other fact tables in a hard disk drive.
5. A device for generating a multi-transaction fact table, characterized in that, include: The blank multi-transaction fact table creation module is used to determine at least one transaction to be written and to create a blank multi-transaction fact table based on the at least one transaction to be written; wherein, each of the at least one transaction to be written corresponds to a business process. The mapping establishment module is used to obtain the real-time data stream of the at least one transaction to be written, and to perform granular refinement and dimension degradation processing on the real-time data stream of the at least one transaction to be written according to the blank multi-transaction fact table, and to establish a mapping between each of the transactions to be written and the blank multi-transaction fact table respectively. The multi-transaction fact table generation module is used to extract the target fields of each transaction to be written, and to determine whether the data of the target field is empty through a custom component. If not, the data is written into the blank multi-transaction fact table according to the corresponding mapping with the blank multi-transaction fact table to generate the multi-transaction fact table. The multi-transaction fact table generation module is further used for: Determine the target fields corresponding to each of the transactions to be written; The corresponding field of the target field in the blank multi-transaction fact table is determined based on the mapping between each transaction to be written and the blank multi-transaction fact table; The data corresponding to the target fields of each transaction to be written is extracted sequentially. Using a custom component, if the data corresponding to the target field is determined to be non-empty, it is written into the corresponding field of the blank multi-transaction fact table to generate the multi-transaction fact table. The custom component overrides the method in the streaming computing framework used to write data into the blank multi-transaction fact table. The multi-transaction fact table provides multiple access and usage modes to enable business systems to interact with it in different ways. The blank multi-transaction fact table creation module is also used for: Identify the smallest granularity transaction among the at least one transaction to be written, and determine the granularity corresponding to the smallest granularity transaction as the granularity of the fact table; Extract the transaction dimensions contained in each of the transactions to be written, and take the intersection of the transaction dimensions corresponding to each of the transactions to be written as the fact table dimension; Extract the transaction metric fields contained in each of the transactions to be written, and take the non-repeating union of the transaction metric fields corresponding to each of the transactions to be written as the metric field of the fact table. Extract the common identifier from each of the transactions to be written, and use the common identifier as the primary key of the fact table, or determine the primary key of the fact table based on the intersection of the transaction dimensions in each of the transactions to be written; The blank multi-transaction fact table is established based on the fact table granularity, the fact table dimension, the fact table metric field, and the fact table primary key.
6. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that is executed by the at least one processor to enable the at least one processor to perform the method for generating a multi-transaction fact table as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method for generating a multi-transaction fact table as described in any one of claims 1-4.