Disclosure of Invention
In view of this, the embodiments of the present disclosure provide a data early warning method, an apparatus, a storage medium, and an electronic device, so as to solve the following problems in the prior art: the scheduling time of the statistical report is delayed relative to the task execution completion time, and the business side knows that the problem is late, so that the time for analyzing the cause of the problem is later.
On one hand, the embodiment of the disclosure provides a data early warning method, which includes: determining the production relation between an upstream data warehouse table and a corresponding downstream data warehouse table in the task in a breadth-first traversal mode; acquiring current production data in the upstream database table; and when the current production data does not meet the preset production data requirement, sending out early warning information to a downstream database table corresponding to the upstream database according to the production relation.
In some embodiments, in a case that the production data is a data volume, the sending an early warning message to the downstream database table corresponding to the upstream database according to the production relationship when the current production data does not meet a predetermined production data requirement includes: judging whether the data volume is within a preset data volume range or not; and when the data volume is not in the preset data volume range, sending an early warning message that the data volume is abnormal to a downstream database table corresponding to the upstream database according to the production relation.
In some embodiments, in a case that the production data is data output time, when the current production data does not meet a predetermined production data requirement, sending an early warning message to a downstream database table corresponding to the upstream database according to the production relationship includes: judging whether the data output time exceeds a preset output time or not; and when the data output time exceeds the preset output time, sending an early warning message that the data output time is delayed to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation.
In some embodiments, after the determining, in a breadth-first traversal manner, a production relationship between an upstream data warehouse table and a corresponding downstream data warehouse table in a task, the method further includes: establishing marks respectively corresponding to the data warehouse tables; and constructing a production relation graph according to the production relation between the database tables and the marks.
On the other hand, the embodiment of the present disclosure provides a data early warning device, including: the determining module is configured to determine the production relation between an upstream data warehouse table and a corresponding downstream data warehouse table in the task in a breadth-first traversal mode; the acquisition module is configured to acquire current production data in the upstream database table; and the early warning module is configured to send out early warning information to the downstream database table corresponding to the upstream database according to the production relation when the current production data does not accord with the preset production data requirement.
In some embodiments, the early warning module is specifically configured to: under the condition that the production data is the data volume, judging whether the data volume is in a preset data volume range; and when the data volume is not in the preset data volume range, sending an early warning message that the data volume is abnormal to a downstream database table corresponding to the upstream database according to the production relation.
In some embodiments, the early warning module is specifically configured to: under the condition that the production data is data output time, judging whether the data output time exceeds preset output time; and when the data output time exceeds the preset output time, sending an early warning message that the data output time is delayed to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation.
In some embodiments, further comprising: the building module is configured to build marks corresponding to the data warehouse tables respectively; and constructing a production relation graph according to the production relation between the database tables and the marks.
In another aspect, an embodiment of the present disclosure provides a storage medium storing a computer program, where the computer program is executed by a processor to implement the method provided in any embodiment of the present disclosure.
In another aspect, an embodiment of the present disclosure provides an electronic device, which at least includes a memory and a processor, where the memory stores a computer program thereon, and the processor implements the method provided in any embodiment of the present disclosure when executing the computer program on the memory.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described below clearly and completely with reference to the accompanying drawings of the embodiments of the present disclosure. It is to be understood that the described embodiments are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the disclosure without any inventive step, are within the scope of protection of the disclosure.
Unless otherwise defined, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this disclosure belongs. The use of "first," "second," and similar terms in this disclosure is not intended to indicate any order, quantity, or importance, but rather is used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
To maintain the following description of the embodiments of the present disclosure clear and concise, a detailed description of known functions and known components have been omitted from the present disclosure.
A first embodiment of the present disclosure provides a data early warning method, where a flow of the method is shown in fig. 1, and the method includes steps S101 to S103:
and S101, determining the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal mode.
The breadth-first traversal method is to search all nodes on a next level of a certain level after searching all nodes on the certain level.
Each task is composed of a plurality of database tables, that is, data corresponding to the database table at the bottom end of one task is finally obtained through the plurality of database tables, for example, the database table 11 is an upstream database table of the database table 21, the database table 21 and the database table 31 are upstream database tables of the database table 41, and the database table 41 is a database table at the bottom end of the task.
The method and the device for acquiring the production relation in the task acquire the production relation in the task in a breadth-first traversal mode, and during specific implementation, the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of executing the task, namely the codes of the task are acquired, and the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of analyzing the codes through a preset analysis program.
And S102, acquiring current production data in the upstream database table.
The production data may be the obtained data amount or the obtained data output time.
And S103, when the current production data does not meet the preset production data requirement, sending an early warning message to a downstream database table corresponding to the upstream database according to the production relation.
Because the production relation of the upstream data warehouse table and the corresponding downstream data warehouse table in the task is known, the downstream data warehouse table corresponding to the upstream data warehouse table can be determined according to the production relation, and then early warning is given to the produced data which is not produced by the downstream data warehouse table so as to remind a user that the downstream data warehouse table may have problems.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
A second embodiment of the present disclosure provides a data early warning method, where a flow of the method is shown in fig. 2, and the method includes steps S201 to S205:
s201, determining the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal mode.
Each task is composed of a plurality of database tables, that is, data corresponding to the database table at the bottom end of one task is finally obtained through the plurality of database tables, for example, the database table 11 is an upstream database table of the database table 21, the database table 21 and the database table 31 are upstream database tables of the database table 41, and the database table 41 is a database table at the bottom end of the task.
The method and the device for acquiring the production relation in the task acquire the production relation in the task in a breadth-first traversal mode, and during specific implementation, the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of executing the task, namely the codes of the task are acquired, and the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of analyzing the codes through a preset analysis program.
S202, establishing marks corresponding to the database tables respectively.
For example, the corresponding label of the data warehouse table is a circular pattern, and the blank in the middle of the circular pattern can fill out the table name of the data warehouse table.
And S203, constructing a production relation graph according to the production relation and the marks among the database tables.
For example, if the database table 11 is an upstream database table of the database table 21, and the database table 21, the database table 31, and the database table 41 are upstream database tables of the database table 51, the production relationship graph thereof may be as shown in fig. 3. Through the production relational graph, the relation among the database tables can be seen clearly more intuitively, and even if the task content is complex, the relation among the database tables can be known clearly. The production relation graph can be directly displayed to a user in a visual mode.
And S204, acquiring the current production data in the upstream database table.
The production data may be the obtained data amount or the obtained data output time.
And S205, when the current production data does not meet the preset production data requirement, sending out an early warning message to a downstream database table corresponding to the upstream database according to the production relation diagram.
Because the production relation of the upstream data warehouse table and the corresponding downstream data warehouse table in the task is known, the downstream data warehouse table corresponding to the upstream data warehouse table can be determined according to the production relation, and then early warning is given to the produced data which is not produced by the downstream data warehouse table so as to remind a user that the downstream data warehouse table may have problems.
In specific implementation, under the condition that the production data is the data volume, whether the data volume is in a preset data volume range can be judged; and when the data volume is not in the preset data volume range, sending out an early warning message that the data volume is abnormal to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation. Judging whether the data output time exceeds the preset output time or not under the condition that the production data is the data output time; and when the data output time exceeds the preset output time, sending an early warning message with delay in the data output time of a downstream database table corresponding to the upstream database according to the production relation. Through this process, no matter data volume or output time goes wrong, early warning all can be fine.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
A third embodiment of the present disclosure provides a data early warning device, a structural schematic of the device is shown in fig. 4, and the device includes:
the determining module 10 is configured to determine a production relationship between an upstream data warehouse table and a corresponding downstream data warehouse table in a task in a breadth-first traversal manner; the acquisition module 20 is coupled with the determination module 10 and is used for acquiring current production data in an upstream database table; and the early warning module 30 is coupled to the obtaining module 20 and configured to send an early warning message to a downstream database table corresponding to the upstream database according to the production relationship when the current production data does not meet the predetermined production data requirement.
Each task is composed of a plurality of database tables, that is, data corresponding to the database table at the bottom end of one task is finally obtained through the plurality of database tables, for example, the database table 11 is an upstream database table of the database table 21, the database table 21 and the database table 31 are upstream database tables of the database table 41, and the database table 41 is a database table at the bottom end of the task.
The method and the device for acquiring the production relation in the task acquire the production relation in the task in a breadth-first traversal mode, and during specific implementation, the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of executing the task, namely the codes of the task are acquired, and the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table is determined in the process of analyzing the codes through a preset analysis program.
The production data may be the obtained data amount or the obtained data output time.
Correspondingly, the early warning module may be specifically configured to: judging whether the data volume exceeds a preset data volume range or not under the condition that the production data is the data volume; and when the data volume is not in the preset data volume range, sending out an early warning message that the data volume is abnormal to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation. The early warning module may be further configured to: judging whether the data output time exceeds the preset output time or not under the condition that the production data is the data output time; and when the data output time exceeds the preset output time, sending an early warning message that the data output time is delayed to a downstream database table corresponding to the upstream database according to the production relation.
Because the production relation of the upstream data warehouse table and the corresponding downstream data warehouse table in the task is known, the downstream data warehouse table corresponding to the upstream data warehouse table can be determined according to the production relation, and then early warning is given to the produced data which is not produced by the downstream data warehouse table so as to remind a user that the downstream data warehouse table may have problems.
The above apparatus may further include: the construction module is coupled with the determination module and the acquisition module and is used for establishing marks respectively corresponding to the data warehouse tables; and constructing a production relation graph according to the production relation and the marks.
For example, the corresponding label of the data warehouse table is a square pattern, and the blank in the middle of the square pattern can fill out the table name of the data warehouse table. The database table 11 and the database table 12 are upstream database tables of the database table 21, and the database table 21, the database table 31 and the database table 41 are upstream database tables of the database table 51, so that the production relationship diagram thereof can be as shown in fig. 5, in the production relationship diagram, no arrow indicates the direction of the production relationship, but an up-down relationship is defaulted, and the square length of the downstream database table is at least equal to the lengths of all the upstream database tables. Through the production relational graph, the relation among the database tables can be seen clearly more intuitively, and even if the task content is complex, the relation among the database tables can be known clearly. The production relation graph can be directly displayed to a user in a visual mode.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
A fourth embodiment of the present disclosure provides a storage medium storing a computer program, which when executed by a processor implements the method provided in any of the embodiments of the present disclosure, including the following steps S1 to S3:
s1, determining the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal mode;
s2, acquiring current production data in an upstream database table;
and S3, when the current production data do not meet the preset production data requirement, sending out an early warning message to a downstream database table corresponding to the upstream database according to the production relation.
When the computer program is executed by the processor and the current production data does not meet the preset production data requirement, and the step of sending the early warning message to the downstream data warehouse table corresponding to the upstream data warehouse according to the production relation is executed by the processor, the following steps are specifically executed by the processor: judging whether the data volume is in a preset data volume range or not under the condition that the production data is the data volume; and when the data volume is not in the preset data volume range, sending out an early warning message that the data volume is abnormal to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation.
When the computer program is executed by the processor and the current production data does not meet the preset production data requirement, and the step of sending the early warning message to the downstream data warehouse table corresponding to the upstream data warehouse according to the production relation is executed by the processor, the following steps are specifically executed by the processor: judging whether the data output time exceeds the preset output time or not under the condition that the production data is the data output time; and when the data output time exceeds the preset output time, sending an early warning message that the data output time is delayed to a downstream database table corresponding to the upstream database according to the production relation.
After the computer program is executed by the processor to determine the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal mode, the computer program can also be executed by the processor to execute the following steps: establishing marks respectively corresponding to the data warehouse tables; and constructing a production relation graph according to the production relation and the marks among the database tables.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-only memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes. Optionally, in this embodiment, the processor executes the method steps described in the above embodiments according to the program code stored in the storage medium. Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again. It will be apparent to those skilled in the art that the modules or steps of the present disclosure described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. As such, the present disclosure is not limited to any specific combination of hardware and software.
A fifth embodiment of the present disclosure provides an electronic device, as shown in fig. 6, the electronic device at least includes a memory 901 and a processor 902, the memory 901 stores a computer program thereon, the processor 902 implements the method provided in any embodiment of the present disclosure when executing the computer program on the memory 901, for example, the computer program has the following steps S11 to S13:
s11, determining the production relation between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal mode;
s12, acquiring current production data in an upstream database table;
and S13, when the current production data do not meet the preset production data requirement, sending out an early warning message to a downstream database table corresponding to the upstream database according to the production relation.
When the processor 902 executes the computer program, which is stored in the memory 901 and used for sending an early warning message to the downstream database table corresponding to the upstream database according to the production relationship when the current production data does not meet the predetermined production data requirement, the following computer program may be specifically executed: judging whether the data volume is in a preset data volume range or not under the condition that the production data is the data volume; and when the data volume is not in the preset data volume range, sending out an early warning message that the data volume is abnormal to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation.
When the processor 902 executes the computer program, which is stored in the memory 901 and used for sending an early warning message to the downstream database table corresponding to the upstream database according to the production relationship when the current production data does not meet the predetermined production data requirement, the following computer program may be specifically executed: judging whether the data output time exceeds the preset output time or not under the condition that the production data is the data output time; and when the data output time exceeds the preset output time, sending an early warning message that the data output time is delayed to a downstream data warehouse table corresponding to the upstream data warehouse according to the production relation.
The processor 902, after executing the computer program stored on the memory 901 for determining the production relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in the task in a breadth-first traversal manner, may further execute the following computer program: establishing marks respectively corresponding to the data warehouse tables; and constructing a production relation graph according to the production relation and the marks among the database tables.
The embodiment of the disclosure determines the relationship between the upstream data warehouse table and the corresponding downstream data warehouse table in a task, when the current production data in the upstream data warehouse table is not in accordance with expectations, the determined production relationship is used for sending out an early warning to the downstream data warehouse table corresponding to the upstream data warehouse table, and then when the downstream data warehouse table does not produce production data, the early warning can be achieved in advance.
Moreover, although exemplary embodiments have been described herein, the scope thereof includes any and all embodiments based on the disclosure with equivalent elements, modifications, omissions, combinations (e.g., of various embodiments across), adaptations or alterations. The elements of the claims are to be interpreted broadly based on the language employed in the claims and not limited to examples described in the present specification or during the prosecution of the application, which examples are to be construed as non-exclusive. It is intended, therefore, that the specification and examples be considered as exemplary only, with a true scope and spirit being indicated by the following claims and their full scope of equivalents.
The above description is intended to be illustrative and not restrictive. For example, the above-described examples (or one or more versions thereof) may be used in combination with each other. For example, other embodiments may be used by those of ordinary skill in the art upon reading the above description. In addition, in the foregoing detailed description, various features may be grouped together to streamline the disclosure. This should not be interpreted as an intention that a disclosed feature not claimed is essential to any claim. Rather, the subject matter of the present disclosure may lie in less than all features of a particular disclosed embodiment. Thus, the following claims are hereby incorporated into the detailed description as examples or embodiments, with each claim standing on its own as a separate embodiment, and it is contemplated that these embodiments may be combined with each other in various combinations or permutations. The scope of the disclosure should be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.
While the present disclosure has been described in detail with reference to the embodiments, the present disclosure is not limited to the specific embodiments, and those skilled in the art can make various modifications and alterations based on the concept of the present disclosure, and the modifications and alterations should fall within the scope of the present disclosure as claimed.