Data management method and device, storage medium and electronic device
By creating and updating the data version status in the data table, the problem of low efficiency in managing zipper tables is solved, achieving efficient data management and querying, reducing costs, and making it suitable for various database types.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- EVERBRIGHT TECH CO LTD
- Filing Date
- 2023-01-04
- Publication Date
- 2026-07-24
AI Technical Summary
In existing technologies, data management using zipper tables is inefficient, the methods for querying and comparing changed data are complex, and it requires significant hardware computing resources, resulting in low data management efficiency, high costs, and difficulty in implementation.
By creating a first data table, generating a second data table, and updating it to a third data table in response to changes in business calculation rules, the data tables contain accounts, data values, data occurrence dates, data adjustment dates, and data version status. The data version status is used to record the number of data changes, thereby achieving efficient data management.
It simplifies the data management process, reduces storage and query costs, improves query speed and efficiency, is applicable to most database types, including relational and distributed databases, and is easy to implement.
Smart Images

Figure CN115982168B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data management technology, and more specifically, to a data management method, apparatus, storage medium, and electronic device. Background Technology
[0002] In financial data management systems, databases are often used to store data on various business operations. This data is typically determined through certain calculation rules. With data volumes in the petabyte (PB) or terabyte (TB) range, business and analytical personnel frequently need to modify the calculation parameters and conditions of financial models due to adjustments in financial policies or the economic environment. These changes in parameters and conditions may generate new calculation results, requiring continuous monitoring of the final data. Therefore, it is crucial for the system to store these changed results in the database for tracking and comparison.
[0003] Currently, when tracking and comparing changed data in a database, a zipper table is often used to manage the data. However, this method is inefficient in generating zipper tables, and the methods for querying and monitoring changed data are complex. Especially when the amount of data in the database is large, it requires high hardware computing resources, resulting in low management efficiency, high cost, and difficulty in implementation.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a data management method, apparatus, storage medium, and electronic device to at least solve the technical problems in related technologies where data management is carried out by creating a zipper table. These problems include low efficiency in generating the zipper table, complex methods for querying and comparing changed data, and the need for high hardware computing resources, resulting in low data management efficiency, high cost, and difficulty in implementation.
[0006] According to one embodiment of the present invention, a data management method is provided, comprising: creating a first data table according to a business, wherein the first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status, and the at least one data value includes variable data; generating first data in the first data table to obtain a second data table, wherein the first data value in the first data is determined according to a first account, the first data occurrence date and the first data adjustment date in the first data are the same, and the first data version status in the first data is an initial state; and generating second data in the second data table in response to a change in the calculation rules of the business to obtain a third data table, wherein the second data value in the second data is determined according to the first account, the second data occurrence date in the second data is the same as the first data occurrence date, the second data adjustment date in the second data is the date on which the calculation rules changed, and the second data version status in the second data is accumulated on the first data version status according to the number of times the at least one data value corresponding to the first account changes.
[0007] Optionally, the method further includes: in response to receiving an instruction to query the data corresponding to the first account at a first time, displaying third data in a third data table, wherein the occurrence date of the third data is the same as or earlier than the first time.
[0008] Optionally, displaying the third data in the third data table includes: selecting the fourth data corresponding to the first account in the third data table, wherein the fourth data includes the data corresponding to the initial state of the data version corresponding to the first account, and the data corresponding to the maximum data version state corresponding to the first account; filtering the data corresponding to the maximum data version state for each data occurrence date in the fourth data to obtain the fifth data; determining the sixth data based on the absolute value of the difference between each data occurrence date in the fifth data and the first time, wherein the sixth data is the data corresponding to the data occurrence date corresponding to at least the smallest absolute value among the absolute values; determining the data corresponding to the earliest data occurrence date in the sixth data as the third data, and displaying the third data in the third data table.
[0009] Optionally, the method further includes: in response to receiving an instruction to delete data corresponding to the third data version state, marking the deletion of the seventh data in the third data table, wherein the seventh data is the data whose data version state is the third data version state.
[0010] Optionally, the first data table is a distributed table.
[0011] Optionally, an account can be defined by multiple fields.
[0012] Optionally, at least one data value may include multiple fields.
[0013] According to one embodiment of the present invention, a data management device is also provided, comprising: a creation module, configured to create a first data table according to a business, wherein the first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status, and the at least one data value includes variable data; a generation module, configured to generate first data in the first data table to obtain a second data table, wherein the first data value in the first data is determined according to a first account, the first data occurrence date and the first data adjustment date in the first data are the same, and the first data version status in the first data is an initial state; and an update module, configured to generate second data in the second data table in response to a change in the calculation rules of the business, to obtain a third data table, wherein the second data value in the second data is determined according to the first account, the second data occurrence date in the second data is the same as the first data occurrence date, the second data adjustment date in the second data is the date on which the calculation rules changed, and the second data version status in the second data is accumulated on the first data version status according to the number of times the at least one data value corresponding to the first account changes.
[0014] Optionally, the update module is also configured to, in response to receiving an instruction to query the data corresponding to the first account at the first time, display the third data in the third data table, wherein the occurrence date of the third data is the same as or earlier than the first time.
[0015] Optionally, the update module is further configured to display third data in the third data table, including: selecting fourth data corresponding to the first account in the third data table, wherein the fourth data includes data corresponding to the initial state of the data version corresponding to the first account, and data corresponding to the maximum data version state corresponding to the first account; filtering out the data corresponding to the maximum data version state for each data occurrence date in the fourth data to obtain fifth data; determining sixth data based on the absolute value of the difference between each data occurrence date in the fifth data and the first time, wherein the sixth data is the data corresponding to the data occurrence date corresponding to at least the smallest absolute value among the absolute values; determining the data corresponding to the earliest data occurrence date in the sixth data as the third data, and displaying the third data in the third data table.
[0016] Optionally, the update module is also configured to, in response to receiving an instruction to delete the data corresponding to the third data version state, mark the deletion of the seventh data in the third data table, wherein the seventh data is the data whose data version state is the third data version state.
[0017] Optionally, the first data table is a distributed table.
[0018] Optionally, an account can be defined by multiple fields.
[0019] Optionally, at least one data value may include multiple fields.
[0020] According to one embodiment of the present invention, a computer-readable storage medium is also provided, wherein the storage medium stores a computer program, wherein the computer program is configured to execute the data management method described above when running on a computer or processor.
[0021] According to one embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the data management method described above.
[0022] In this embodiment of the invention, the above method is used to create a first data table based on business requirements. The first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status. The at least one data value includes variable data. First data is generated in the first data table to obtain a second data table. The first data value in the first data is determined based on the first account. The first data occurrence date and the first data adjustment date in the first data are the same. The first data version status in the first data is an initial state. In response to a change in the business calculation rules, second data is generated in the second data table to obtain a third data table. The second data value in the second data is determined based on the first account. The second data occurrence date in the second data is the same as the first data occurrence date. The second data adjustment date in the second data is the date the calculation rules changed. The second data version status in the second data is accumulated based on the number of times the at least one data value corresponding to the first account changes, added to the first data version status. This facilitates the comparison and management of changing data, reduces additional storage and query costs, and features a clear algorithm logic that is not limited by database type. It also achieves the goals of simple method, improved data query speed, and reduced query time, thereby increasing efficiency, reducing costs, and being easy to implement. This solves the technical problems of related technologies that use the method of creating zipper tables to manage data, which has low efficiency in generating zipper tables, complex methods for querying and comparing changing data, and requires high hardware computing resources, resulting in low data management efficiency, high costs, and difficulty in implementation. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0024] Figure 1 This is a flowchart of a data management method according to one embodiment of the present invention;
[0025] Figure 2This is a structural block diagram of a data management device according to one embodiment of the present invention. Detailed Implementation
[0026] 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.
[0027] 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.
[0028] According to one embodiment of the present invention, an embodiment of a data management method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] This method embodiment can be executed in an electronic device, similar control device, or system that includes a memory and a processor. Taking an electronic device as an example, the electronic device may include one or more processors and a memory for storing data. Optionally, the electronic device may also include a communication device for communication functions and a display device. Those skilled in the art will understand that the above structural description is merely illustrative and does not limit the structure of the electronic device. For example, the electronic device may include more or fewer components than described above, or have a different configuration than described above.
[0030] A processor may include one or more processing units. For example, a processor may include a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microcontroller unit (MCU), a field-programmable gate array (FPGA), a neural network processing unit (NPU), a tensor processing unit (TPU), or an artificial intelligence (AI) processor. Different processing units may be independent components or integrated into one or more processors. In some instances, electronic devices may also include one or more processors.
[0031] The memory can be used to store computer programs, such as the computer program corresponding to the data management method in the embodiments of the present invention. The processor implements the above-described data management method by running the computer program stored in the memory. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to electronic devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0032] Communication devices are used to receive or send data via a network. Specific examples of such networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the communication device includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the communication device may be a radio frequency (RF) module used for wireless communication with the Internet.
[0033] The display device can be, for example, a touchscreen liquid crystal display (LCD) and a touch display (also referred to as a "touchscreen" or "touch screen"). This LCD allows the user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), which allows the user to interact with the GUI by touching and / or gesturing on a touch-sensitive surface. Optional human-computer interaction functions include: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, a call interface, playing digital video, playing digital music, and / or web browsing, etc. Executable instructions for performing the above human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0034] This embodiment provides a data management method. Figure 1 This is a flowchart of a data management method according to one embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0035] Step S10: Create the first data table according to the business requirements;
[0036] The first data table includes an account, at least one data value, the date the data occurred, the date the data was adjusted, and the data version status. At least one data value includes variable data.
[0037] The first data table can be understood as a historical version data management table created based on business operations. Optionally, if the business is banking, then a historical version management table for bank financial data is created to store, compare, and manage data from different versions. It is understood that the first data table created based on the business operations can reflect some information about the business, namely, the first data table includes account number, at least one data value, data occurrence date, data adjustment date, and data version status. At least one data value includes variable data.
[0038] For example, the first data table can be a table_his table, as shown in Table 1 below.
[0039] Table 1
[0040] ... ... ... ...
[0041] As shown in Table 1, PID represents the account, VAR1 and VAR2 represent the data values. In addition to the account PID, value VAR1 and value VAR2, the table_his table supplements the data occurrence date DATADATE, data adjustment date MODIFIDATE and data version status DATASTATE. Therefore, it can more comprehensively reflect some specific information of the business.
[0042] Optionally, the account PID can be expanded into multiple fields. For example, when the business is banking, the account PID can be a bank user account. The account PID can be expanded into multiple fields, meaning that one (or combination) PID can define subsequent value fields, such as the data value VAR. For example, VAR1 and VAR2 can represent different types of bank account balances, such as interest. For example, VAR1 = 1 indicates that the balance is 1.
[0043] Optionally, the VAR data value can be adjusted to a limited number of fields, such as VAR1, VAR2, VAR3... or other names, to represent the specific different account information of the account.
[0044] Optionally, the data occurrence date (DATADATE) can be the date on which the transaction actually occurred. For example, when the business is banking, the data occurrence date (DATADATE) can be the specific date on which a bank user makes a transaction such as a transfer.
[0045] Optionally, the data adjustment date MODIFIDATE can be determined by calculation conditions. For example, when the business is banking, the calculation conditions can be market policies or calculation rules. For instance, the date on which the account PID data changes—that is, when the same row of data needs to be modified and adjusted—is assigned the value of the adjustment date MODIFIDATE.
[0046] Optionally, the initial value of the data version status DATASTATE can be set to zero, so that each adjustment of the data version status DATASTATE is based on the previous value plus 1, thereby accurately recording the status version of the account PID data changes.
[0047] Step S11: Generate first data in the first data table to obtain the second data table;
[0048] Among them, the first data value in the first data is determined according to the first account, the occurrence date of the first data in the first data is the same as the adjustment date of the first data, and the version status of the first data in the first data is the initial state.
[0049] The second data table can be understood as a data management table that generates normal data based on business needs. Optionally, when the business is banking, the second data table can be a data management table that generates normal data based on the historical version data management table of banking business. It is understood that at this point, inserting the first account and its corresponding data value has not been adjusted, the data occurrence date and data adjustment date are the same, and the data version management status is set to 0. That is, the first data value in the first data is determined based on the first account, the first data occurrence date and the first data adjustment date are the same, and the first data version status in the first data is the initial state.
[0050] For example, the second data table can be a table_his table, as shown in Table 2 below.
[0051] Table 2
[0052] A 1 PROD1 2022-01-01 2022-01-01 0 A 2 PROD1 2022-06-01 2022-06-01 0 A 5 PROD1 2022-10-01 2022-10-01 0 B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 C 1 PROD1 2022-03-31 2022-03-31 0 C 9 PROD1 2022-04-30 2022-04-30 0 ... ... ... ...
[0053] As shown in Table 2, the account PID and corresponding values VAR1 and VAR2 are inserted into the first data table. At this time, no adjustments are made, the data occurrence date DATADATE is consistent with the data adjustment date, and the data version management status is set to 0.
[0054] In step S12, in response to a change in the business calculation rules, second data is generated in the second data table to obtain the third data table.
[0055] Among them, the second data value in the second data is determined based on the first account, the occurrence date of the second data in the second data is the same as the occurrence date of the first data, the adjustment date of the second data in the second data is the date when the calculation rule changes, and the version status of the second data in the second data is accumulated on the first data version status based on the number of times at least one data value corresponding to the first account changes.
[0056] The third data table can be understood as a data management table generated according to business needs. This means that when the business calculation rules change, the rules for generating the data table may also change. Optionally, when the business is banking, the calculation rules can be market policies or calculation rules. When market policies or calculation rules change, second data needs to be generated in the second data table to obtain the third data table. Specifically, the second data value in the second data table is determined based on the first account number. The occurrence date of the second data in the second data table is the same as the occurrence date of the first data table. The adjustment date of the second data in the second data table is the date the calculation rules changed. The version status of the second data in the second data table is accumulated based on the number of times at least one data value corresponding to the first account number has changed, added to the version status of the first data table.
[0057] For example, when the business is banking business and the calculation rule is market policy or calculation rule, when the calculation rule PROD1 for data value VAR2 changes once, the generated third data table can be as shown in Table 3 below:
[0058] Table 3
[0059] A 1 PROD1 2022-01-01 2022-01-01 0 A 2 PROD1 2022-06-01 2022-06-01 0 A 5 PROD1 2022-10-01 2022-10-01 0 B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 C 1 PROD1 2022-03-31 2022-03-31 0 C 9 PROD1 2022-04-30 2022-04-30 0 A 10 PROD1 2022-01-01 2022-10-15 1 A 20 PROD1 2022-06-01 2022-10-15 1 A 50 PROD1 2022-10-01 2022-10-15 1 C 10 PROD1 2022-03-31 2022-10-15 1 C 90 PROD1 2022-04-30 2022-10-15 1 ... ... ... ...
[0060] As shown in Table 3, new changed data is inserted based on the second data table. The account PID and the corresponding adjusted and calculated values VAR1 and VAR2 are inserted. At this time, the data occurrence date DATADATE is consistent with the original data occurrence date, the data adjustment date is the date of change of market policy or calculation rules, and the data version management status is assigned to the original value +1.
[0061] For example, when the business is banking business and the calculation rule is market policy or calculation rule, and when the calculation rule PROD1 for data value VAR2 changes twice, the generated third data table can be as shown in Table 4 below:
[0062] Table 4
[0063] A 1 PROD1 2022-01-01 2022-01-01 0 A 2 PROD1 2022-06-01 2022-06-01 0 A 5 PROD1 2022-10-01 2022-10-01 0 B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 C 1 PROD1 2022-03-31 2022-03-31 0 C 9 PROD1 2022-04-30 2022-04-30 0 A 10 PROD1 2022-01-01 2022-10-15 1 A 20 PROD1 2022-06-01 2022-10-15 1 A 50 PROD1 2022-10-01 2022-10-15 1 C 10 PROD1 2022-03-31 2022-10-15 1 C 90 PROD1 2022-04-30 2022-10-15 1 A 15 PROD1 2022-01-01 2022-11-01 2 A 25 PROD1 2022-06-01 2022-11-01 2 A 55 PROD1 2022-10-01 2022-11-01 2 C 15 PROD1 2022-03-31 2022-11-01 2 C 95 PROD1 2022-04-30 2022-11-01 2 ... ... ... ...
[0064] As shown in Table 4, new changed data is inserted based on the second data table. The account PID and the corresponding adjusted and calculated values VAR1 and VAR2 are inserted. At this time, the data occurrence date DATADATE is consistent with the original data occurrence date, the data adjustment date is the date of change of market policy or calculation rules, and the data version management status is assigned to the original value + 2.
[0065] Through the above steps, all changed data is reflected in a single data management table based on changes in business needs and calculation rules, eliminating the need to create multiple new data management tables. This allows for the retrieval of required historical change records without multi-table joins, improving database computational efficiency. Furthermore, the algorithm for generating the third data table has clear logic and is not limited by database type, enabling reuse in most relational and distributed databases. Table partitioning or distributed tables can further improve storage and query efficiency, rather than being limited to specific databases.
[0066] Through the above steps, a first data table is created according to the business requirements. The first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status. The at least one data value includes variable data. First data is generated in the first data table to obtain a second data table. The first data value in the first data table is determined based on the first account. The first data occurrence date and the first data adjustment date in the first data table are the same. The first data version status in the first data table is the initial state. In response to a change in the business calculation rules, second data is generated in the second data table to obtain a third data table. The second data value in the second data table is determined based on the first account. The second data occurrence date in the second data table is the same as the first data occurrence date. The second data adjustment date in the second data table is the date the calculation rules changed. The second data version status in the second data table is accumulated based on the number of times the at least one data value corresponding to the first account has changed, incremented by the first data version status. This facilitates the comparison and management of changing data, reduces additional storage and query costs, and features a clear algorithm logic that is not limited by database type. It also achieves the goals of simple method, improved data query speed, and reduced query time, thereby increasing efficiency, reducing costs, and being easy to implement. This solves the technical problems of related technologies that use the method of creating zipper tables to manage data, which has low efficiency in generating zipper tables, complex methods for querying and comparing changing data, and requires high hardware computing resources, resulting in low data management efficiency, high costs, and difficulty in implementation.
[0067] Optionally, step S12 may also include the following execution steps:
[0068] Step S120: In response to receiving the instruction to query the data corresponding to the first account at the first time, the third data is displayed in the third data table.
[0069] Among them, the date of occurrence of the third data is the same as or earlier than the first time.
[0070] When an instruction is received to query the data corresponding to the first account at the first time, it is necessary to query the data corresponding to the first time according to the business. At this time, the third data is displayed in the third data table, so that the latest data value corresponding to the first account at the first time can be retrieved.
[0071] For example, when the business is banking business, the latest values of accounts A and B on 2022-05-31 are queried based on the third data table 3 mentioned above. The condition is that for each A and B, the data with the smaller DATADATE is selected from the subset of the data occurrence date DATASTATE with the largest value and the absolute value of the difference between DATADATE and 2022-05-31. For example, if DATADATE is 2022-05-30 and 2022-06-01, the absolute value of both minus 2022-05-31 is 1. Therefore, the data with the smaller DATADATE is selected between 2022-05-30 and 2022-06-01, i.e., 2022-05-30. This can prevent the situation where the query date is equidistant from the DATADATE before and after it.
[0072] Optionally, when the business is banking business, in response to receiving the instruction to query the data corresponding to the first account at the first time, the third data is displayed in the third data table. That is, according to the banking business needs, the historical data of a certain time can be queried directly according to the banking business needs without having to call multiple historical data tables and go through multiple queries, thereby improving query efficiency and reducing query time.
[0073] Optionally, in step S120, displaying the third data in the third data table may further include the following steps:
[0074] Step S1200: Select the fourth data corresponding to the first account from the third data table;
[0075] The fourth data includes the data corresponding to the initial state of the data version of the first account, and the data corresponding to the maximum data version state of the first account.
[0076] The fourth data can be understood as the data value of the first account that matches the query instruction. Optionally, when the business is banking business, the latest values of accounts A and B on 2022-05-31 can be queried based on the third data table 3 above. Then, the fourth data corresponding to the first account in the third data table can be the data values corresponding to accounts A and B in table 3.
[0077] For example, when the business is banking business, the fourth data corresponding to the first account can be selected from the third data table as shown in Table 5 below.
[0078] Table 5
[0079] A 1 PROD1 2022-01-01 2022-01-01 0 A 2 PROD1 2022-06-01 2022-06-01 0 A 5 PROD1 2022-10-01 2022-10-01 0 B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 A 15 PROD1 2022-01-01 2022-11-01 2 A 25 PROD1 2022-06-01 2022-11-01 2 A 55 PROD1 2022-10-01 2022-11-01 2
[0080] As shown in Table 5 above, when the business is banking business, the fourth data corresponding to the first account is selected from the third data table. That is, based on the above third data table 3, the data corresponding to DATASTATE 0 and DATASTATE maximum value in A and B are selected.
[0081] Step S1201: Filter out the data corresponding to the maximum data version status for each data occurrence date from the fourth data to obtain the fifth data;
[0082] Optionally, when the business is banking business, this step can be understood as selecting the largest value of DATASTATE from the DATADATE data with the same start date based on the fourth data. For example, the specific process can be shown in Table 6 below.
[0083] Table 6
[0084] B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 A 15 PROD1 2022-01-01 2022-11-01 2 A 25 PROD1 2022-06-01 2022-11-01 2 A 55 PROD1 2022-10-01 2022-11-01 2
[0085] As shown in Table 6, when the business is banking business, the data with the largest DATASTATE value in DATADATE corresponding to the data start date is selected based on the data in A and B where DATASTATE is 0 and DATASTATE is the maximum value.
[0086] Step S1202: Determine the sixth data based on the absolute value of the difference between the occurrence date of each data in the fifth data and the first time.
[0087] The sixth data is the data corresponding to the date on which at least one of the smallest absolute values occurred.
[0088] Optionally, when the business is banking business, this step can be understood as selecting the data with the smaller absolute value of the difference between DATADATE and 2022-05-31 from the subset of data with the smaller absolute value of DATADATE, and determining the sixth data based on the absolute value of the difference between the occurrence date of each data in the fifth data and the first time.
[0089] For example, when the business is banking, selecting the record with the smaller absolute value of the difference between DATADATE and 2022-05-31 from the subset can be shown in Table 7 below.
[0090] Table 7
[0091] B 5 PROD2 2022-06-01 2022-06-01 0 A 25 PROD1 2022-06-01 2022-11-01 2
[0092] As shown in Table 7, the data with the smallest absolute value of the difference between DATADATE and 2022-05-31 is selected as the sixth data.
[0093] Step S1203: Determine the data corresponding to the earliest occurrence date in the sixth data as the third data, and display the third data in the third data table.
[0094] The earliest date of occurrence in the sixth data is determined as the third data, and the third data is displayed in the third data table. That is, the latest data value corresponding to the first account at the first time is retrieved according to the query command.
[0095] Optionally, step S12 may also include the following execution steps:
[0096] Step S121: In response to receiving an instruction to delete the data corresponding to the third data version status, mark the deletion of the seventh data in the third data table.
[0097] The seventh data is the data corresponding to the third data version status.
[0098] It is understandable that when the business is banking business, due to the different types of bank users and business scenarios, it is necessary to delete a specific version under certain specific needs, such as data of version x, that is, mark the deletion of the seventh data in the third data table.
[0099] For example, based on Table 3 above, and with the deletion rule being to retain the initial data with version 0, the deletion of data with DATASTATE=X can be shown in Table 8 below. Table 8 below uses the deletion of DATASTATE=1 as an example.
[0100] Table 8
[0101]
[0102] Table 8 after deleting data is shown in Table 9.
[0103] Table 9
[0104] A 1 PROD1 2022-01-01 2022-01-01 0 A 2 PROD1 2022-06-01 2022-06-01 0 A 5 PROD1 2022-10-01 2022-10-01 0 B 3 PROD2 2022-04-30 2022-04-30 0 B 5 PROD2 2022-06-01 2022-06-01 0 B 3 PROD2 2022-10-01 2022-10-01 0 C 1 PROD1 2022-03-31 2022-03-31 0 C 9 PROD1 2022-04-30 2022-04-30 0 A 15 PROD1 2022-01-01 2022-11-01 2 A 25 PROD1 2022-06-01 2022-11-01 2 A 55 PROD1 2022-10-01 2022-11-01 2 C 15 PROD1 2022-03-31 2022-11-01 2 C 95 PROD1 2022-04-30 2022-11-01 2 ... ... ... ...
[0105] As shown in Table 9, based on Table 3 above, the deletion rule is to retain the initial data with version 0 and delete the data with DATASTATE=1. That is, the seventh data in the third data table is marked as the data with the version status of the third data. This allows the data deletion operation to be performed directly in the third data table according to different business needs, without having to create other new data management tables, thereby improving the database calculation efficiency.
[0106] Optionally, the first data table is a distributed table.
[0107] Understandably, most existing distributed databases employ the concept of sharding. When a table is created, it is actually backed by N distributed tables. When a user queries that table, they are actually querying the N underlying tables to increase query efficiency. In other words, the first data table is a distributed table, thereby improving query efficiency.
[0108] Understandably, the first data table needs to be able to comprehensively reflect accurate data information. Optionally, when the business is banking business, the first data table needs to be able to reflect various detailed data information of bank user accounts. For example, the distributed table can be a bank financial data historical version management table of type table_his, used to store, compare and manage data of various versions.
[0109] Optionally, an account can be defined by multiple fields.
[0110] Understandably, when the business is banking, the account is a bank user account. In the first data table, such as the table_his table, the account PID can be expanded into multiple fields. For example, when the business is other financial business, the account PID can be a financial user account, and the account PID can be expanded into multiple fields. That is, one (or combination) PID can define the subsequent value field data value VAR. For example, VAR1 and VAR2 can represent different types of financial account balances, interest, etc. For example, VAR1 = 1 means that the balance is 1.
[0111] For example, the account PID field in the table can be a combined account, that is, multiple fields are used to define the same account. For example, when the business is banking business, a transaction needs to use the initiator and counterparty (receiver) to define its specific amount information, etc., VAR fields.
[0112] Optionally, at least one data value may include multiple fields.
[0113] Understandably, the data value is used to reflect the specific data information of the account under the business. Optionally, in the first data table, such as the table_his table, the VAR data value can be adjusted to a limited number of fields according to the actual business scenario, such as VAR1, VAR2, VAR3... or other names, so as to represent the specific different account information of the account, that is, at least one data value includes multiple fields.
[0114] Optionally, the data occurrence date (DATADATE) and data adjustment date (MODIFIDATE) are not limited to the English names used in this application, and the data version status (DATASTATE) is not limited to data. This application embodiment does not impose any restrictions.
[0115] Through the above steps, all changed data can be stored in the same data table. Furthermore, the loading and query algorithms related to historical version management reduce the creation of additional tables, meaning that the required historical change records can be retrieved without multi-table joins, thereby improving database computational efficiency and facilitating comparison and querying. Simultaneously, when loading related to historical version management, the algorithm can be reused in most relational and distributed databases, further improving storage and query efficiency through table partitioning or distributed tables, rather than being limited to certain databases. This makes the algorithm logic clear and unrestricted by database type. In summary, this data management method can be widely applied to real-life scenarios, facilitating the comparison and management of changed data, reducing additional storage and query costs. The algorithm logic is clear, unrestricted by database type, and achieves the goals of simplicity, increased data query speed, reduced query time, improved efficiency, reduced costs, and ease of implementation.
[0116] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0117] This embodiment also provides a data management device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0118] Figure 2 This is a structural block diagram of a data management device according to one embodiment of the present invention, such as... Figure 2As shown, taking a data management device 200 as an example, the device includes: a creation module 201, which is used to create a first data table according to business needs, wherein the first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status, and the at least one data value includes variable data; a generation module 202, which is used to generate first data in the first data table to obtain a second data table, wherein the first data value in the first data is determined according to the first account, the first data occurrence date and the first data adjustment date in the first data are the same, and the first data version status in the first data is an initial state; and an update module 203, which is used to generate second data in the second data table in response to a change in the business calculation rules to obtain a third data table, wherein the second data value in the second data is determined according to the first account, the second data occurrence date in the second data is the same as the first data occurrence date, the second data adjustment date in the second data is the date on which the calculation rules changed, and the second data version status in the second data is accumulated on the first data version status according to the number of times the at least one data value corresponding to the first account has changed.
[0119] Optionally, the update module 203 is also configured to, in response to receiving an instruction to query the data corresponding to the first account at the first time, display the third data in the third data table, wherein the occurrence date of the third data is the same as or earlier than the first time.
[0120] Optionally, the update module 203 is further configured to display third data in the third data table, including: selecting fourth data corresponding to the first account in the third data table, wherein the fourth data includes data corresponding to the initial state of the data version corresponding to the first account, and data corresponding to the maximum data version state corresponding to the first account; filtering out the data corresponding to the maximum data version state for each data occurrence date in the fourth data to obtain fifth data; determining sixth data based on the absolute value of the difference between each data occurrence date in the fifth data and the first time, wherein the sixth data is the data corresponding to the data occurrence date corresponding to at least the smallest absolute value among the absolute values; determining the data corresponding to the earliest data occurrence date in the sixth data as the third data, and displaying the third data in the third data table.
[0121] Optionally, the update module 203 is further configured to, in response to receiving an instruction to delete the data corresponding to the third data version state, mark the deletion of the seventh data in the third data table, wherein the seventh data is the data whose data version state is the third data version state.
[0122] Optionally, the first data table is a distributed table.
[0123] Optionally, an account can be defined by multiple fields.
[0124] Optionally, at least one data value may include multiple fields.
[0125] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0126] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when run on a computer or processor.
[0127] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0128] Step S1: Create the first data table based on the business requirements;
[0129] Step S2: Generate first data in the first data table to obtain the second data table;
[0130] Step S3: In response to a change in the business calculation rules, second data is generated in the second data table, resulting in a third data table.
[0131] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0132] Embodiments of the present invention also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0133] Optionally, in this embodiment, the processor in the above-described electronic device may be configured to run a computer program to perform the following steps:
[0134] Step S1: Create the first data table based on the business requirements;
[0135] Step S2: Generate first data in the first data table to obtain the second data table;
[0136] Step S3: In response to a change in the business calculation rules, second data is generated in the second data table, resulting in a third data table.
[0137] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0138] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0139] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0140] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0141] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0142] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0143] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0144] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A data management method, characterized in that, The method includes: A first data table is created based on the business requirements. The first data table includes an account, at least one data value, the date the data occurred, the date the data was adjusted, and the data version status. The at least one data value includes variable data. First data is generated in the first data table to obtain a second data table. The first data value in the first data is determined according to the first account. The occurrence date and adjustment date of the first data in the first data are the same. The version status of the first data in the first data is the initial state. In response to a change in the calculation rules of the business, second data is generated in the second data table to obtain a third data table. The second data value in the second data is determined based on the first account. The occurrence date of the second data in the second data is the same as the occurrence date of the first data. The adjustment date of the second data in the second data is the date on which the calculation rules change. The version status of the second data in the second data is accumulated on the first data version status based on the number of times at least one data value corresponding to the first account changes. In response to a change in the calculation rules of the business, second data is generated in the second data table to obtain a third data table. This includes: in response to receiving an instruction to query the data corresponding to the first account at a first time, selecting fourth data corresponding to the first account in the third data table, wherein the fourth data includes data corresponding to the initial state of the data corresponding to the first account, and data corresponding to the maximum data version state of the first account; filtering out the data corresponding to the maximum data version state for each data occurrence date in the fourth data to obtain fifth data; determining sixth data based on the absolute value of the difference between each data occurrence date in the fifth data and the first time, wherein the sixth data is the data corresponding to the data occurrence date corresponding to at least the smallest absolute value among the absolute values; determining the data corresponding to the earliest data occurrence date in the sixth data as the third data, and displaying the third data in the third data table, wherein the occurrence date of the third data is the same as or earlier than the first time.
2. The method according to claim 1, characterized in that, Also includes: In response to receiving an instruction to delete data corresponding to the third data version state, the seventh data is marked for deletion in the third data table, wherein the seventh data is the data corresponding to the third data version state.
3. The method according to any one of claims 1-2, characterized in that, The first data table is a distributed table.
4. The method according to any one of claims 1-2, characterized in that, The account is defined by multiple fields.
5. The method according to any one of claims 1-2, characterized in that, The at least one data value includes multiple fields.
6. A data management device, characterized in that, The device includes: A creation module is used to create a first data table according to business requirements. The first data table includes an account, at least one data value, a data occurrence date, a data adjustment date, and a data version status. The at least one data value includes variable data. A generation module is used to generate first data in the first data table to obtain a second data table. The first data value in the first data is determined according to the first account. The occurrence date and adjustment date of the first data in the first data are the same. The version status of the first data in the first data is the initial state. An update module is used to generate second data in the second data table in response to a change in the calculation rules of the business, thereby obtaining a third data table. The second data value in the second data is determined based on the first account, the occurrence date of the second data in the second data is the same as the occurrence date of the first data, the adjustment date of the second data in the second data is the date on which the calculation rules change, and the version status of the second data in the second data is accumulated on the first data version status based on the number of times at least one data value corresponding to the first account has changed. The update module is further configured to, in response to receiving an instruction to query the data corresponding to the first account at a first time, select the fourth data corresponding to the first account from the third data table, wherein the fourth data includes data corresponding to the initial state of the data corresponding to the first account, and data corresponding to the maximum data version state of the first account; filter the data corresponding to the maximum data version state for each data occurrence date from the fourth data to obtain the fifth data; determine the sixth data based on the absolute value of the difference between each data occurrence date in the fifth data and the first time, wherein the sixth data is the data corresponding to the data occurrence date corresponding to at least the smallest absolute value among the absolute values; determine the data corresponding to the earliest data occurrence date in the sixth data as the third data, and display the third data in the third data table, wherein the occurrence date of the third data is the same as or earlier than the first time.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the data management method described in any one of claims 1 to 5 when run on a computer or processor.
8. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the data management method as described in any one of claims 1 to 5.