Data warehouse table detection method and device, data management system, equipment and storage medium
By automatically generating test SQL query statements from the development scripts and generation models of the data warehouse tables, the problems of low detection efficiency and poor adaptability to structural changes in data warehouse tables are solved, achieving efficient and accurate data quality detection.
Patent Information
- Application Number
- CN202311589302.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-11-24
AI Technical Summary
Existing technologies for data warehouse table detection are inefficient. Users need to input structural information one by one to generate SQL query statements, which is prone to errors and cannot adapt to structural changes, resulting in inaccurate detection.
By obtaining the development scripts for the baseline data warehouse table before the change and the data warehouse table to be tested after the change, and using a pre-trained generative model, test SQL query statements are generated to dynamically adapt to structural changes and ensure the accuracy and comprehensiveness of the detection.
Simplify user operations, improve the accuracy and comprehensiveness of SQL query statements, enhance the efficiency and effectiveness of data warehouse table detection, and dynamically adapt to structural changes.
Smart Images

Figure CN117539856B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to computer technology and data processing technology, and in particular to a data warehouse table detection method and apparatus, a data management system, electronic equipment and storage medium. Background Technology
[0002] With the development of internet technology, providers of various types of services can set up business systems on internet platforms to provide users with various types of business services. In the process of providing business services to users, the business system needs to collect massive amounts of big data, which is managed through data warehouse tables (hereinafter referred to as: data warehouse tables).
[0003] Because the big data involved in business systems is characterized by its scale, high speed, and diversity in data sources and formats, data quality issues, such as data consistency and accuracy, may arise during data collection, production, and processing. This necessitates the inspection of data warehouse tables to identify data with quality problems. However, since the scope of data warehouse table inspection is difficult to define, manual inspection by data developers is not guaranteed in terms of quality and efficiency. Therefore, using technical tools to assist in data inspection is particularly important.
[0004] When performing data warehouse table testing in related technologies, users need to write Structured Query Language (SQL) query statements based on the data table structure and requirements involved, and then concatenate the SQL query statements according to fixed test rules (such as primary key consistency). Then, the underlying query engine (QE) compares the data warehouse table under test with the benchmark data warehouse table based on the concatenated SQL query statements to identify data with quality problems in the data warehouse table under test.
[0005] In the process of realizing this invention, the inventors discovered through research that in related technologies, generating SQL query statements requires users to input the structure information of all relevant data warehouse tables one by one. This operation is cumbersome and inefficient, and may fail to generate accurate SQL query statements due to input errors, thus failing to accurately access the required data. In addition, when the structure of the data warehouse table changes, such as when fields are added, renamed, or deleted in the data warehouse table, the structure information of the data warehouse table entered by the user is inconsistent with the new data warehouse table structure. This may cause the generated SQL query statement to be unable to adapt to the new data warehouse table structure, thus failing to accurately access the required data. In both of these cases, effective data quality problem detection cannot be achieved. Summary of the Invention
[0006] This disclosure provides a data warehouse table detection method and apparatus, a data management system, an electronic device, and a storage medium to effectively detect data quality problems in data warehouse tables.
[0007] One aspect of this disclosure provides a data warehouse table detection method, including:
[0008] Obtain the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change. The second development script includes at least one data source table identifier, and each data source table identifier is used to uniquely identify a data source table.
[0009] Based on the differences between the first development script and the second development script, determine the fields affected by changes to the data warehouse table under test relative to the baseline data warehouse table;
[0010] Using a pre-trained generative model, at least one test Structured Query Language (SQL) query statement is generated based on the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the change impact field.
[0011] Execute at least one test SQL query statement on the baseline data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result;
[0012] Based on the at least one test result, determine whether the data warehouse table to be tested passes the test, and obtain the test result.
[0013] Optionally, in any embodiment of the method disclosed herein, obtaining the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change includes:
[0014] In response to receiving a detection instruction, the system acquires the identifier of the baseline data warehouse table included in the detection instruction, as well as the second development script. The second development script is developed based on data viewing requirements and also includes relevant fields in the data source table, as well as operations on the relevant fields.
[0015] Based on the identifier of the benchmark data warehouse table, obtain the first development script.
[0016] Optionally, in any embodiment of the method disclosed herein, the at least one test SQL query statement includes:
[0017] The first test SQL query statement is used to verify the structural changes of the data warehouse table under test relative to the benchmark data warehouse table;
[0018] The second test SQL query statement is used to verify whether the information changes corresponding to the change-affected fields in the data warehouse table under test meet the preset requirements.
[0019] The third test SQL query statement is used to verify whether the data warehouse table under test has any information changes that are not affected by the changed fields relative to the benchmark data warehouse table or the data source table.
[0020] Optionally, in any embodiment of the method disclosed herein, the at least one test SQL query statement is executed on the baseline data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result, including:
[0021] For each test SQL query statement in the at least one test SQL, query whether there is an SQL query statement template that matches each test SQL query statement;
[0022] For each fourth test SQL query statement that has a matching SQL query statement template, an SQL query statement instance is generated based on the instance information in the fourth test SQL query statement and the SQL query statement template that matches the fourth test SQL query statement. The query engine is invoked to execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement instance, obtaining the execution result. The execution result is then parsed to obtain the parsing result, which includes information on the changes in the data warehouse table to be tested relative to the benchmark data warehouse table and / or the data source table. The test result includes the execution result and the parsing result.
[0023] For each fifth test SQL query statement that has a matching SQL query statement template, the query engine is invoked to execute the fifth test SQL query statement on the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statement, and the execution result is obtained. The test result includes the execution result.
[0024] Optionally, in any embodiment of the method disclosed herein, determining whether the data warehouse table under test passes the test based on the at least one test result includes:
[0025] If at least one test result meets a preset standard, the data warehouse table under test is determined to have passed the test.
[0026] Otherwise, in response to any test result of the at least one test result not meeting the preset standard, it is determined that the data warehouse table to be tested has failed the test.
[0027] Optionally, in any embodiment of the method disclosed herein, the method further includes:
[0028] In response to the detection result that the data warehouse table under test fails the test, the second development script is analyzed and troubleshooted to generate a new second development script. The new second development script is then used as the second development script to iteratively execute the operation that determines the fields affected by changes in the data warehouse table under test relative to the benchmark data warehouse table based on the differences between the first development script and the second development script.
[0029] Optionally, in any embodiment of the method disclosed herein, the second development script is analyzed and troubleshooting is performed to generate a new second development script, including:
[0030] The first development script, the second development script, the target test result that does not meet the preset standard, and the data source table are input into the pre-trained analysis model. The analysis model outputs the target information associated with the target test result in the second development script and the reason why the target test result does not meet the preset standard.
[0031] Based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, a root cause investigation report is generated so that the second development script can be modified based on the root cause investigation report to obtain a new second development script.
[0032] In another aspect of this disclosure, a data warehouse table detection device is provided, comprising:
[0033] The acquisition module is used to acquire the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change. The second development script includes at least one data source table identifier, and each data source table identifier is used to uniquely identify a data source table.
[0034] The first determining module is used to determine the fields affected by changes in the data warehouse table under test relative to the benchmark data warehouse table based on the differences between the first development script and the second development script.
[0035] A model is generated to produce at least one test Structured Query Language (SQL) query statement based on the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the change impact field.
[0036] The execution module is used to execute at least one test SQL query statement on the benchmark data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result;
[0037] The second determining module is used to determine whether the data warehouse table to be tested passes the test based on the at least one test result, and to obtain the test result.
[0038] Optionally, in any embodiment of the method disclosed herein, the acquisition module is specifically used for:
[0039] In response to receiving a detection instruction, the system acquires the identifier of the baseline data warehouse table included in the detection instruction, as well as the second development script. The second development script is developed based on data viewing requirements and also includes relevant fields in the data source table, as well as operations on the relevant fields.
[0040] Based on the identifier of the benchmark data warehouse table, obtain the first development script.
[0041] Optionally, in any embodiment of the method disclosed herein, the at least one test SQL query statement includes:
[0042] The first test SQL query statement is used to verify the structural changes of the data warehouse table under test relative to the benchmark data warehouse table;
[0043] The second test SQL query statement is used to verify whether the information changes corresponding to the change-affected fields in the data warehouse table under test meet the preset requirements.
[0044] The third test SQL query statement is used to verify whether the data warehouse table under test has any information changes that are not affected by the changed fields relative to the benchmark data warehouse table or the data source table.
[0045] Optionally, in any embodiment of the method disclosed herein, the execution module includes:
[0046] The query unit is used to query whether there is an SQL query statement template that matches each of the at least one test SQL query statements.
[0047] The first generation unit is used to generate SQL query statement instances based on the instance information in the fourth test SQL query statement and the SQL query statement template that matches the fourth test SQL query statement for each fourth test SQL query statement that has a matching SQL query statement template.
[0048] The calling unit is used to call the query engine to execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement instance, and obtain the execution result; and to call the query engine for each fifth test SQL query statement for which a matching SQL query statement template exists, to execute the fifth test SQL query statement for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statement, and obtain the execution result, wherein the test result corresponding to the fifth test SQL query statement includes the execution result;
[0049] The parsing unit is used to parse the execution result to obtain the parsing result, which includes information on the changes of the data warehouse table under test relative to the benchmark data warehouse table and / or the data source table; the test result corresponding to the fourth test SQL query statement includes the execution result and the parsing result.
[0050] Optionally, in any embodiment of the method disclosed herein, the second determining module is specifically used for:
[0051] If at least one test result meets a preset standard, the data warehouse table under test is determined to have passed the test.
[0052] Otherwise, in response to any test result of the at least one test result not meeting the preset standard, it is determined that the data warehouse table to be tested has failed the test.
[0053] Optionally, in any embodiment of the method disclosed herein, the method further includes:
[0054] The analysis module is used to analyze and troubleshoot the second development script in response to the detection result that the data warehouse table under test has failed the detection, so as to generate a new second development script.
[0055] Optionally, in any embodiment of the method disclosed herein, the analysis module includes:
[0056] An analysis model is used to determine, based on the first development script, the second development script, the target test results that do not meet the preset standards, and the data source table, the target information associated with the target test results in the second development script, and the reasons why the target test results do not meet the preset standards.
[0057] The second generation unit is used to generate a root cause investigation report based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, so as to modify the second development script based on the root cause investigation report to obtain a new second development script.
[0058] In another aspect, this disclosure provides a data management system, including: a data factory, a query engine, and a data warehouse table detection device as described in any embodiment of this disclosure;
[0059] The data factory is used to store relevant information about the data source table, the baseline data warehouse table, and the data warehouse table to be tested. The relevant information includes metadata, structural information, and development scripts.
[0060] The query engine is used to respond to the call of the data warehouse table detection device, execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement, and obtain the execution result.
[0061] In another aspect, embodiments of this disclosure provide an electronic device, including:
[0062] Memory, used to store computer program products;
[0063] A processor is configured to execute a computer program product stored in the memory, and when the computer program product is executed, to implement the method described in any of the above embodiments of the present disclosure.
[0064] In another aspect, this disclosure provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the methods described in any of the above embodiments of this disclosure.
[0065] In another aspect of the present disclosure, a computer program product is provided, including computer program instructions that, when executed by a processor, implement the methods described in any of the above embodiments of the present disclosure.
[0066] Based on the data warehouse table detection method and apparatus, data management system, electronic device, and storage medium provided in the above embodiments of this disclosure, by acquiring a first development script of the baseline data warehouse table before the change and a second development script of the data warehouse table to be tested after the change, the change-affecting fields of the data warehouse table to be tested relative to the baseline data warehouse table are determined based on the differences between the first and second development scripts. Then, using a pre-trained generative model, based on the structural information of the baseline data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source tables involved in the second development script, and the change-affecting fields, a series of test SQL query statements are automatically generated, which can generate accurate and comprehensive test SQL queries. The system generates a series of test SQL queries that can dynamically adapt to changes in the structure of the baseline data warehouse table. This ensures that the generated series of test SQL queries can accurately access the required data, resulting in effective test results. Based on these test results, it determines whether the data warehouse table under test passes the test, thus achieving comprehensive and effective detection of potential data quality issues. Compared to related technologies that require users to input the structure information of all relevant data warehouse tables one by one when generating SQL queries, this system simplifies user operations, improves the accuracy, effectiveness, and comprehensiveness of SQL queries, and enhances consistency with the data warehouse table structure, thereby improving the efficiency and effectiveness of data warehouse table detection.
[0067] The technical solutions of this disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0068] The accompanying drawings, which form part of this specification, illustrate embodiments of this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0069] This disclosure will become clearer with reference to the accompanying drawings and the following detailed description, wherein:
[0070] Figure 1 This is a flowchart of one embodiment of the data warehouse table detection method disclosed herein.
[0071] Figure 2 This is a flowchart of another embodiment of the data warehouse table detection method disclosed herein.
[0072] Figure 3 This is a flowchart of yet another embodiment of the data warehouse table detection method disclosed herein.
[0073] Figure 4 This is a schematic diagram of the structure of one embodiment of the data warehouse table detection device disclosed herein.
[0074] Figure 5 This is a schematic diagram of another embodiment of the data warehouse table detection device disclosed herein.
[0075] Figure 6This is a schematic diagram of the structure of one embodiment of the data management system disclosed herein.
[0076] Figure 7 This is a schematic diagram of the structure of an application embodiment of the electronic device disclosed herein. Detailed Implementation
[0077] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.
[0078] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of this disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.
[0079] It should also be understood that in the embodiments disclosed herein, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.
[0080] It should also be understood that any component, data or structure mentioned in the embodiments of this disclosure can generally be understood as one or more unless expressly defined or given to the contrary in the context.
[0081] Furthermore, the term "and / or" in this disclosure is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this disclosure generally indicates that the preceding and following related objects have an "or" relationship.
[0082] It should also be understood that the description of the various embodiments in this disclosure emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0083] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0084] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.
[0085] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0086] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0087] The embodiments disclosed herein can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.
[0088] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.
[0089] In this embodiment of the disclosure, a data warehouse (hereinafter referred to as "data warehouse") is a subject-oriented, relatively stable collection of data reflecting historical changes, used to support management decisions of business systems. When using data warehouse tables to manage the massive amounts of data of a business system, the massive amounts of data collected during the provision of business processes can be filled into various types of data warehouse tables for querying and retrieval.
[0090] Figure 1 This is a flowchart of one embodiment of the data warehouse table detection method disclosed herein. Figure 1 As shown, the data warehouse table detection method in this embodiment includes:
[0091] 102. Obtain the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change.
[0092] The second development script includes at least one data source table identifier (ID). Each data source table identifier is used to uniquely identify a data source table. The data source table identifier can be, for example, the table name, number, creation date of the data source table, and any combination of any two or more of them. This disclosure embodiment does not limit this.
[0093] In this embodiment, the baseline data warehouse table can be a data warehouse table generated by filtering, restricting, and concatenating data source tables according to business needs such as querying and usage, and which has been put into operation after passing data quality problem detection. The data warehouse table to be tested is a data warehouse table that needs to be tested for data quality problems, generated by filtering, restricting, and concatenating data source tables according to business needs such as querying and usage and / or iteratively generating the baseline data warehouse table.
[0094] The data source table is the table used to describe the sources of data in the data warehouse table. The baseline data warehouse table before the change corresponds to the data warehouse table under test after the change; that is, their corresponding data source tables are the same or at least different. For example, in one application example, the baseline data warehouse table is named hive_online, and the data source tables are named A and B. Data source table A includes the fields id, name, and male, while data source table B includes the fields id, age, and code. The baseline data warehouse table hive_online is a data warehouse table that links data source tables A and B by the id field and includes the id and name fields from data source table A and the code field from data source table B. The data warehouse table under test is named hive_new, and the data source tables are named A and B. The data warehouse table hive_new is a data warehouse table that links data source tables A and B by the id field and includes the id and name fields from data source table A and the age field from data source table B.
[0095] In this embodiment of the disclosure, the development script is an executable file used to process the corresponding data to obtain various data tables such as data source tables and data warehouse tables. For example, based on the first development script, performing necessary filtering, restriction, and concatenation operations on the corresponding data source table can generate a baseline data warehouse table; based on the second development script, performing necessary filtering, restriction, and concatenation operations on the corresponding data source table can generate a data warehouse table to be tested; and based on the third development script, performing necessary selection and filling operations on the corresponding metadata can generate a data source table.
[0096] In some implementations, the development scripts for the data warehouse tables can be SQL statements, meaning the first and second development scripts are SQL statements.
[0097] 104. Based on the differences between the first development script and the second development script, determine the fields affected by changes to the data warehouse table under test relative to the baseline data warehouse table.
[0098] In operation 104, the difference between the first development script and the second development script can be compared to determine the fields affected by changes in the data warehouse table under test relative to the baseline data warehouse table. The fields affected by changes are changes in field information, which may include, but are not limited to, adding fields, removing fields, and changes in the range of field values. This embodiment of the disclosure does not limit the specific range of the fields affected by changes.
[0099] For example, in the application example, the fields affected by changes to the data warehouse table under test relative to the baseline data warehouse table include the fields code and age.
[0100] 106. Using a pre-trained generative model, generate at least one test SQL query statement based on the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the fields affected by changes.
[0101] In this embodiment of the disclosure, the test SQL query statement is an SQL query statement used to test whether there are data quality problems in the data warehouse table under test. By executing the test SQL query statement, one or more of the baseline data warehouse table, the data warehouse table under test, and the data source table can be queried, and the corresponding test results can be obtained based on the query results.
[0102] The generative model in this embodiment can be pre-trained based on a large number of training samples. The trained generative model can output a sequence of corresponding test SQL queries for the input structure information of the baseline data warehouse table, the structure information of the data warehouse table to be tested, the structure information of the data source table, and the fields affected by changes. The sequence of test SQL queries may include one or more test SQL queries, each of which is used to test the data warehouse table to be tested for a test point according to a preset verification logic. The training method of the generative model is described in the following embodiments.
[0103] The generation model in this embodiment can perceive changes in the structure of data tables by using the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, and the structural information of the data source table. For example, the data source table identified as "student" includes two fields: "name" and "age". An "id" field is added on top of this to obtain the benchmark data warehouse table, which can adapt to the structure of the data table and generate test SQL compatible with various data warehouse tables, thereby solving the problem of complex SQL generation operations.
[0104] In some implementations, the generative model in this disclosure embodiment can be implemented using a generative pre-trained transformer (GPT). Alternatively, other deep learning models, such as convolutional neural networks (CNN) and recurrent neural networks (RNN), can also be used. This disclosure embodiment does not limit the specific model type used for the generative model.
[0105] 108. Execute at least one of the above test SQL queries on the baseline data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result.
[0106] In this embodiment, different test SQL query statements may target different tables in the benchmark data warehouse table, the data warehouse table under test, and the data source table. Each test SQL query statement can be executed for the different tables in the benchmark data warehouse table, the data warehouse table under test, and the data source table targeted by each test SQL query statement.
[0107] 110. Based on at least one of the above test results, determine whether the data warehouse table to be tested passes the test and obtain the test result.
[0108] Based on this embodiment, by obtaining the differences between the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table under test after the change, the fields affecting the change of the data warehouse table under test relative to the baseline data warehouse table are determined. Then, using a generative model, based on the structural information of the baseline data warehouse table, the structural information of the data warehouse table under test, the structural information of the data source tables involved in the second development script, and the fields affecting the change, a series of test SQL query statements are automatically generated. This can generate accurate and comprehensive test SQL query statements and can dynamically adapt to structural changes in the baseline data warehouse table, effectively ensuring that the generated series of test SQL query statements can accurately access the required data, thereby obtaining effective series of test results. Furthermore, based on the series of test results, it is determined whether the data warehouse table under test passes the test, thus achieving comprehensive and effective detection of potential data quality problems in the data warehouse table under test. Compared with related technologies that require users to input the structural information of all involved data warehouse tables one by one when generating SQL query statements, this simplifies user operations, improves the accuracy, effectiveness, and comprehensiveness of SQL query statements, as well as their consistency with the data warehouse table structure, thereby improving the detection efficiency and effectiveness of the data warehouse table.
[0109] Optionally, in some implementations, developers can develop a second development script based on the data viewing requirements provided by the business party. This script can be converted into SQL through natural language processing. The second development script may include: at least one data source table identifier, relevant fields in the data source tables, and operations on those fields. For example, in a specific example, the data viewing requirement is to generate a data warehouse table to be tested, named hive_new. The data source tables are named A and B, and A and B are related by the id field. The fields in the hive_new data warehouse table to be tested include the id and name fields in A and the code field in B. The relevant fields in the data source tables are the fields in the relevant data source tables, namely the id and name fields in data source table A and the id and code fields in data source table B. Operations on the relevant fields include filtering (e.g., the id field value is 0001~01000), restricting (e.g., the age field value does not include age>40), and concatenating (e.g., concatenating the id fields in data source tables A and B). This embodiment of the disclosure does not restrict the above-mentioned operations on the relevant fields. After developers obtain a second development script based on the data provided by the business party and review the requirements, they can input the second development script through the client and send a detection command. The detection command includes the identifier of the benchmark data warehouse table and the second development script. The identifier of the benchmark data warehouse table is used to uniquely identify the benchmark data warehouse table. For example, it can be the table name, number, creation date of the data source table, and any combination of two or more of them. This disclosure embodiment does not limit this. The client sends the detection command to the data warehouse table detection device used to implement the embodiments of this disclosure.
[0110] Accordingly, in some implementations, operation 102 may include: in response to receiving a detection instruction, obtaining the identifier of the baseline data warehouse table included in the detection instruction, and a second development script, which is developed based on data viewing requirements. The second development script may also include relevant fields in the data source table and operations on the relevant fields; then, based on the identifier of the baseline data warehouse table, obtaining the first development script corresponding to the identifier of the baseline data warehouse table from the data management system (e.g., a data factory). For example, obtaining the first development script corresponding to the identifier of the baseline data warehouse table from the data factory through an access interface provided by the data factory. The data factory in this embodiment of the disclosure can be used to store relevant information of the data source table and the baseline data warehouse table. This relevant information may include, but is not limited to, the table identifier, metadata involved in the table, structural information (e.g., field names), and development scripts, etc. In addition, the data factory can also store relevant information of a temporarily developed data warehouse table to be tested. After the data warehouse table to be tested passes the detection, it becomes the baseline data warehouse table. If the data warehouse table to be tested fails the detection, the relevant information of the data warehouse table to be tested can be deleted.
[0111] Based on this embodiment, the interface between the data warehouse table testing device and the data management system is established so as to obtain the basic data required for testing the data warehouse table under test from the data management system.
[0112] In practical applications, to ensure the security of data in the data management system, an access control unit can be set up. This unit can be pre-configured with account information or hardware unit identification information (such as MAC address) that have access permissions. When an access request to the data management system is received, the access is verified using the account information or hardware unit identification information carried in the access request. Access to the data management system is only granted after the account information or hardware unit identification information carried in the access request has been verified.
[0113] In this embodiment of the disclosure, a large number of training samples (hereinafter referred to as first training samples for easy distinction) can be collected in advance. Each first training sample may include the structural information of the sample benchmark data warehouse table, the structural information of the sample test data warehouse table, the structural information of the sample data source table, and the sample change impact field, and carries the test SQL query statement sequence label. The first initial model is trained using a large number of first training samples. That is, by inputting a large number of first training samples into the first initial model, the first initial model learns the structural information of the sample benchmark data warehouse table, the structural information of the sample test data warehouse table, the structural information of the sample data source table, the sample change impact field, and the test SQL query statement sequence label. After training, the first initial model obtains the above-mentioned generated model.
[0114] Accordingly, in some implementations, the aforementioned at least one test SQL query statement may include: a first test SQL query statement, a second test SQL query statement, and a third test SQL query statement. The first test SQL query statement is used to verify the structural changes of the data warehouse table under test relative to the baseline data warehouse table. The second test SQL query statement is used to verify whether the information changes corresponding to the fields affected by the aforementioned changes in the data warehouse table under test meet preset requirements. The third test SQL query statement is used to verify whether there are any information changes in the data warehouse table under test relative to the baseline data warehouse table or the data source table that are not affected by the aforementioned changes in the affected fields. Depending on the testing requirements, the first, second, and third test SQL queries may each include one or more test SQL queries. The specific number of test SQL queries included in the first, second, and third test SQL queries can be determined based on the structural information of the baseline data warehouse table, the structural information of the data warehouse table under test, the structural information of the data source table, and the situation of the fields affected by the changes; this disclosure does not impose any limitations on this.
[0115] In this embodiment, based on the aforementioned change-affected fields, it can be determined which data information in the data warehouse table under test will change relative to the benchmark data warehouse table (referred to as: changed information) and which data information should not change (hereinafter referred to as: unchanged information). Based on this embodiment, a first test SQL query statement can be used to test the structural changes of the data warehouse table under test relative to the benchmark data warehouse table, including changes in rows, columns, etc.; a third test SQL query statement can be used to test whether the unchanged information in the data warehouse table under test is consistent with the benchmark data warehouse table or the data source table; and a second test SQL query statement can be used to test whether the information changes corresponding to the aforementioned change-affected fields in the data warehouse table under test meet preset requirements. Each test SQL query statement can target a test point and test the data warehouse table under test according to the preset verification logic corresponding to that test point. The first test SQL query can detect structural changes in the data warehouse table under test. The second and third test SQL queries, combined, can perform a comprehensive data quality problem detection on the data warehouse table under test. Based on the first, second, and third test SQL queries, a comprehensive detection can be performed on the structural changes in the data warehouse table under test, and whether the changes result in data quality problems.
[0116] For example, in some optional examples, the first test SQL query statement may include, but is not limited to, any one or more of the following: a test SQL query statement for verifying row changes between the data warehouse table under test and the benchmark data warehouse table (i.e., verifying which rows have changed); and a test SQL query statement for verifying column changes between the data warehouse table under test and the benchmark data warehouse table (i.e., verifying which columns have changed).
[0117] The second test SQL query statement may include, but is not limited to, any one or more of the following: a test SQL query statement used to verify whether the change in the total number of rows in the data warehouse table under test relative to the benchmark data warehouse table is within a first preset fluctuation range (e.g., less than 200). This test SQL query statement can verify whether the change in the number of rows after adding several rows to the data warehouse table under test exceeds the first preset fluctuation range. If it exceeds the first preset fluctuation range, it is considered that problematic data has occurred. A test SQL query statement used to verify whether the change in the total number of columns in the data warehouse table under test relative to the benchmark data warehouse table is within a second preset fluctuation range (e.g., less than 5). This test SQL query statement can verify whether the change in the number of columns after adding several columns to the data warehouse table under test exceeds the second preset fluctuation range. If it exceeds the second preset fluctuation range, it is considered that problematic data has occurred. A test SQL query statement used to verify whether the change in the field value of a second preset field in the data warehouse table under test is within a second preset range (5℃). For example, when the second preset field is temperature, it can verify whether the change in temperature value is reasonable. If the change in temperature value exceeds the second preset range, it can be considered that data error has occurred.
[0118] The third test SQL query statement may include, but is not limited to, any one or more of the following: a test SQL query statement to verify whether the total number of rows in the data warehouse table under test is consistent with the baseline data warehouse table; a test SQL query statement to verify whether the total number of rows changes when a column is added to the data warehouse table under test; a test SQL query statement to verify whether the total number of columns in the data warehouse table under test is consistent with the baseline data warehouse table; a test SQL query statement to verify the change in the field values of fields other than the affected field in the data warehouse table relative to the corresponding field values in the baseline data warehouse table; a test SQL query statement to verify whether the field values that should not change have changed relative to the baseline data warehouse table; and a test SQL query statement to verify the change in the field values of fields other than the affected field in the data warehouse table relative to the corresponding field values in the data source table. This test SQL query statement can be used to verify whether the values of fields that should not change have changed relative to the data source table; it can also be used to verify whether the value of the first preset field in the data warehouse table under test is within a first preset range, for example, if the first preset field is age, the first preset range can be (0, 100), and exceeding this first preset range can be considered a data error; it can also be used to verify whether the value of the third preset field in the data warehouse table under test conforms to preset value rules, for example, whether the age value is a number, whether the mobile phone number is 11 digits, etc.; it can also be used to verify whether the value of the fourth preset field in the data warehouse table under test has changed, for example, whether the ID number has changed; it can also be used to verify whether there are duplicate fields in the data warehouse table under test; and it can also be used to verify whether there are empty field values in the data warehouse table under test.
[0119] Figure 2 This is a flowchart of another embodiment of the data warehouse table detection method disclosed herein. Figure 2 As shown, in Figure 1 Based on the illustrated embodiment, operation 108 may include:
[0120] 1082, for each test SQL query statement in at least one test SQL, query whether there is an SQL query statement template that matches each test SQL query statement.
[0121] To facilitate distinction, the test SQL query statement that has a matching SQL query statement template is called the fourth test SQL query statement, and there can be one or more fourth test SQL query statements. The test SQL query statement that does not have a matching SQL query statement template is called the fifth test SQL query statement, and there can also be one or more fifth test SQL query statements.
[0122] For each of the fourth test SQL queries that have a matching SQL query template, execute operation 1084; for each of the fifth test SQL queries that have a matching SQL query template, execute operation 1090.
[0123] 1084. Based on the instance information in the fourth test SQL query statement and the SQL query statement template that matches the fourth test SQL query statement, generate an SQL query statement instance.
[0124] The instance information in the fourth test SQL query statement, i.e. the specific execution information in the fourth test SQL query statement, includes the information of the involved objects and the execution operation information for the involved objects. The information of the involved objects may include, but is not limited to: the identifier of the table (e.g., the baseline data warehouse table, the data warehouse table under test, any one or more data source tables), the structure of the table (e.g., the number of rows, the number of columns, etc.), the fields in the table, the field values, etc. The execution operation information is computer-executable information used to verify whether the information of the involved objects conforms to the preset verification logic.
[0125] In some implementations, the SQL query statement template can include query information and analysis information. The query information, once instantiated, can be used to perform data query operations on the corresponding tables (such as the baseline data warehouse table, the data warehouse to be tested table, and any one or more data source tables) to obtain the execution results. The analysis information, once instantiated, can be used to parse the execution results to obtain the parsed results.
[0126] In some implementations, in operation 1084, corresponding instance information can be extracted from the fourth test SQL query statement and filled into the corresponding position in the query part information of the matching SQL query statement template. This process is called instantiation of the query part information. After instantiation of the query part information, the analysis part information can be instantiated accordingly based on the instantiated query part information to obtain the SQL query statement instance. Alternatively, in other implementations, the entire fourth test SQL query statement can be used as the corresponding execution part information in the matching SQL query statement template to instantiate the query part information, and the analysis part information can be instantiated accordingly based on the instantiated query part information to obtain the SQL query statement instance. This disclosure does not limit the specific method of generating the SQL query statement instance.
[0127] 1086 invokes the query engine (QE) to execute the SQL query statement instance on the baseline data warehouse table, the data warehouse table under test, and / or the data source table involved in the SQL query statement instance, and obtains the execution result.
[0128] The execution result may include information about the changes in the test data warehouse table relative to the baseline data warehouse table and / or the data source table involved in the SQL query instance, such as newly added rows and columns, deleted rows and columns, changed fields and field values, etc.
[0129] 1088, parse the execution result to obtain the parsed result.
[0130] The process of parsing the execution results involves analyzing and summarizing the results according to the SQL query template to obtain the parsed results. These parsed results include information on the changes of the data warehouse table under test relative to the baseline data warehouse table and / or the data source table. For example, information on data additions (e.g., how many rows and columns were added), deletions (e.g., how many rows and columns were deleted), and data quality issues such as inconsistencies (e.g., changes to unchanging information, changes to changed information that do not meet requirements, etc.).
[0131] At this point, the test results include the execution results of operation 1086 and the parsing results of operation 1088.
[0132] Then, the subsequent processes of this embodiment will not be executed.
[0133] 1090. Call the query engine to execute the fifth test SQL query statement on the baseline data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statement, and obtain the execution result.
[0134] At this point, the above test results include the execution result.
[0135] The execution result may include information about the changes in the test data warehouse table relative to the baseline data warehouse table and / or the data source table involved in the fifth test SQL query statement, such as newly added rows and columns, deleted rows and columns, changed fields and field values, etc.
[0136] Based on the embodiments of this disclosure, the query engine can be invoked to query data for each test SQL query statement for which no matching SQL query statement template exists, and the execution result can be obtained. For each test SQL query statement for which a matching SQL query statement template exists, the execution result can be further analyzed. The verification result of the data warehouse table under test relative to the benchmark data warehouse table and / or the data source table can be analyzed to identify quality issues such as data addition, deletion, and data inconsistency, so as to assist data developers in troubleshooting and to correct the second development script.
[0137] Optionally, in some implementations, if at least one of the above test results meets the preset standard, it can be confirmed that no data quality issues (such as data consistency, accuracy, etc.) were detected in the data warehouse table under test, and the data warehouse table under test can be determined to have passed the test. In some implementations, if the test result shows that the data warehouse table under test has passed the test, then the data warehouse table under test can be launched as a new baseline data warehouse table or replace the aforementioned baseline data warehouse table for launch.
[0138] Otherwise, if any of the above test results does not meet the preset standard, it is determined that the data warehouse table under test has failed the test, that is, the data warehouse table under test has one or more data quality problems, and the second development script needs to be adjusted and the data warehouse table needs to be regenerated.
[0139] Based on this embodiment, it is possible to determine whether the data warehouse table under test has passed the test based on the fact that at least one of the above test results meets the preset standard, so as to promptly identify and correct data quality problems of the data warehouse table under test.
[0140] Optionally, in some implementations, in response to the detection result that the data warehouse table under test fails the test, the second development script can be analyzed and troubleshooted to generate a new second development script. The process from operation 104 above to the present can be iteratively executed using the new second development script as the second development script to detect whether there are data quality problems in the new data table (as the data warehouse table under test) obtained based on the second development script.
[0141] Figure 3 This is a flowchart of yet another embodiment of the data warehouse table detection method disclosed herein. Figure 3 As shown, based on the above embodiments, in some implementations, analyzing and troubleshooting the second development script to generate a new second development script may include:
[0142] 302. Input the first development script, the second development script, the target test results that do not meet the preset standards, and the data source table into the pre-trained analysis model. The analysis model outputs the target information associated with the target test results in the second development script, and the reasons why the target test results do not meet the preset standards.
[0143] For example, a second development script instance is: `insert overwrite table hive_testpartition(pt=′${-1d_pt}′) SELECT t1.id,t1.name,t2.code form(SELECT id,name,code form AWHERE pt=′${-1d_pt}′) t1 LEFT JOIN(id,code form B WHERE pt=′${-2d_pt}′ t2ONt1.id=t2.id)`. The target test result associated with the target information (also known as the bug) in the second development script is form A WHERE pt=′${-1d_pt}′ and form B WHERE pt=′${-2d_pt}′. The reason the target test result does not meet the preset standard is that the second development script does not restrict the data queried from table A (form A) and table B (form B) to yesterday's data (pt=′${-1d_pt}′), and restricts the query to table B (form B). The data in B) is from the day before yesterday, t = ′${-2d_pt}′.
[0144] In some implementations, the analysis model in this disclosure embodiment can be implemented using a generative pre-trained transformer (GPT). Alternatively, other deep learning models, such as convolutional neural networks (CNN) and recurrent neural networks (RNN), can also be used. This disclosure embodiment does not limit the specific model type used for the generative model.
[0145] The analysis model in this embodiment can be pre-trained based on a large number of training samples. The trained analysis model can output the target information associated with the target test result in the second development script and the reason why the target test result does not meet the preset standard, in response to the input first development script, second development script, target test result that does not meet the preset standard, and data source table.
[0146] In this embodiment of the disclosure, a large number of training samples (hereinafter referred to as second training samples for easy distinction) can be collected in advance. Each second training sample may include a first sample development script, a second sample development script, sample test results, and a sample data source table, and carries the location information associated with the sample test results in the second sample development script, as well as the reason information for the sample test results not meeting the preset standard. The second initial model is trained using a large number of second training samples. That is, by inputting a large number of second training samples into the second initial model, the second initial model learns the first sample development script, the second sample development script, the sample test results, and the sample data source table, the location information associated with the sample test results in the second sample development script, and the reason information for the sample test results not meeting the preset standard. After training is completed, the second initial model obtains the above-mentioned generated model.
[0147] 304. Based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, a root cause investigation report is generated so that the second development script can be modified based on the root cause investigation report to obtain a new second development script.
[0148] The root cause investigation report may include the target test results, the reasons why the target test results do not meet the preset standards, and target information.
[0149] Based on this embodiment, target test results that do not meet preset standards (e.g., some values in a field are not equal) can be converted into SQL and input into the analysis model along with the data table development scripts before and after the change and the data source table. The analysis model (e.g., GPT) can quickly locate the problems (bugs) in the second development script and the reasons for the problems by analyzing the correlation between the target test results that do not meet preset standards and the development scripts. Based on the target test results, the reasons why the target test results do not meet preset standards, and target information, a root cause investigation report is generated so that developers can correct the bugs in the second development script of the table. The data table to be tested is then tested again based on the above embodiment of this disclosure until the test passes.
[0150] Optionally, in some implementations, the root cause investigation report provided by GPT can be scored and used as a new training sample to iteratively train the analysis model, so as to continuously improve the performance of the analysis model and improve its accuracy.
[0151] Any of the data warehouse table detection methods provided in this disclosure can be executed by any suitable device with data processing capabilities, including but not limited to: terminal devices and servers. Alternatively, any of the data warehouse table detection methods provided in this disclosure can be executed by a processor, such as by a processor executing any of the data warehouse table detection methods mentioned in this disclosure by calling corresponding instructions stored in memory. Further details will not be elaborated below.
[0152] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.
[0153] Figure 4 This is a schematic diagram of one embodiment of the data warehouse table detection device of this disclosure. This data warehouse table detection device can be used to implement the above-described data warehouse table detection method embodiments of this disclosure. Figure 4 As shown, the data warehouse table detection device of this embodiment includes: an acquisition module 402, a first determination module 404, a model generation module 406, an execution module 408, and a second determination module 410. Wherein:
[0154] The acquisition module 402 is used to acquire the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change. The second development script includes at least one data source table identifier, and each data source table identifier is used to uniquely identify a data source table.
[0155] The first determination module 404 is used to determine the fields affected by changes in the data warehouse table under test relative to the baseline data warehouse table based on the differences between the first development script and the second development script.
[0156] Generate model 406 to generate at least one test SQL query statement based on the structural information of the baseline data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the fields affected by changes.
[0157] The execution module 408 is used to execute at least one test SQL query statement on the baseline data warehouse table, the data warehouse table to be tested, and the data source table, and obtain at least one test result.
[0158] The second determining module 410 is used to determine whether the data warehouse table to be tested passes the test based on at least one test result, and obtain the test result.
[0159] Optionally, in some implementations, the acquisition module 402 is specifically used to: in response to receiving a detection instruction, acquire the identifier of the benchmark data warehouse table included in the detection instruction, and the second development script, the second development script being developed based on data viewing requirements, the second development script also including relevant fields in the data source table, and operations on the relevant fields; and acquire the first development script based on the identifier of the benchmark data warehouse table.
[0160] Optionally, in some implementations, the above-mentioned at least one test SQL query statement includes: a first test SQL query statement used to verify the structural changes of the data warehouse table under test relative to the benchmark data warehouse table; a second test SQL query statement used to verify whether the information changes corresponding to the fields affected by the changes in the data warehouse table under test meet the preset requirements; and a third test SQL query statement used to verify whether there are any information changes in the data warehouse table under test relative to the benchmark data warehouse table or the data source table that are not affected by the changes in the fields affected by the changes.
[0161] Figure 5 This is a schematic diagram of another embodiment of the data warehouse table detection device disclosed herein. Figure 5 As shown, in Figure 4 Based on the illustrated embodiment, the execution module 408 may include: a query unit 4082, a first generation unit 4084, a calling unit 4086, and a parsing unit 4088. The query unit 4082 is used to query whether there exists an SQL query statement template matching each test SQL query statement in at least one test SQL. The first generation unit 4084 is used to generate SQL query statement instances based on instance information in the fourth test SQL query statement and the matching SQL query statement template for each fourth test SQL query statement for which a matching SQL query statement template exists. The calling unit 4086 is used to call the query engine to execute the SQL query statement instances for the baseline data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement instances, obtaining execution results; and to call the query engine to execute the fifth test SQL query statements for the baseline data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statements for which a matching SQL query statement template exists, obtaining execution results. The test results for the fifth test SQL query statement include the execution result. The parsing unit 4088 is used to parse the execution result obtained from the executed SQL query statement instance to obtain the parsing result, which includes information on the changes of the data warehouse table under test relative to the baseline data warehouse table and / or the data source table. The test results for the fourth test SQL query statement include both the execution result and the parsing result.
[0162] Optionally, in some implementations, the second determining module 410 is specifically used to: determine that the data warehouse table under test passes the test in response to at least one of the above test results meeting the preset standard; otherwise, determine that the data warehouse table under test fails the test in response to any one of the above at least one test result not meeting the preset standard.
[0163] Optionally, see also Figure 5 In another embodiment of the data warehouse table detection device disclosed herein, it may further include: an analysis module 502, used to analyze and troubleshoot the second development script in response to the detection result that the data warehouse table to be tested has failed the detection, so as to generate a new second development script.
[0164] Optionally, in some implementations, the analysis module 502 may include: an analysis model 5022 and a second generation unit 5024. The analysis model 5022 is used to determine, based on the first development script, the second development script, target test results that do not meet preset standards, and a data source table, the target information associated with the target test results in the second development script, and the reasons why the target test results do not meet the preset standards. The second generation unit 5024 is used to generate a root cause analysis report based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, so that the second development script can be modified based on the root cause analysis report to obtain a new second development script.
[0165] The data warehouse table detection device of this disclosure corresponds to the data warehouse table detection method described above, and the relevant content can be referred to each other, which will not be repeated here. The beneficial technical effects of the data management system of this disclosure can be referred to the corresponding beneficial technical effects in the above-described exemplary method section, which will not be repeated here.
[0166] Figure 6 This is a schematic diagram illustrating the structure of one embodiment of the data management system disclosed herein. This data management system can be used to implement the above-described data warehouse table detection method embodiments of this disclosure. Figure 6 As shown, the data management system of this embodiment may include: a data factory 602, a query engine 604, and a data warehouse table detection device 606.
[0167] in:
[0168] Data Factory 602 is used to store information related to the data source table, the baseline data warehouse table, and the data warehouse table to be tested. This information may include, but is not limited to, metadata, structural information, and development scripts.
[0169] The query engine 604 is used to respond to the call of the data warehouse table testing device 606, execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement, and obtain the execution result.
[0170] The data warehouse table detection device 606 can be used to implement the data warehouse table detection method described above in this disclosure. It can be selectively implemented using the structure of any of the data warehouse table detection device embodiments described above in this disclosure, which will not be elaborated here.
[0171] The data warehouse table detection device in this embodiment can be developed using a client application equipped with a Python-based extension library (Pandas) and a data warehouse tool (Hive). Pandas is a widely used tool for data analysis and data mining, providing rich data processing functions and supporting data processing for various data structures. Using Pandas' application programming interface (API), data from the source table, the data warehouse table to be tested, and the benchmark data warehouse table can be retrieved. Hive can be used to extract the source table, the data warehouse table to be tested, and the benchmark data warehouse table from the data factory for comparison. The data warehouse table detection device developed using a client application equipped with Pandas and Hive can extract data from the data factory of various structures, including the source table, the data warehouse table to be tested, and the benchmark data warehouse table, and perform accurate comparisons. This improves the detection efficiency of the data warehouse table to be tested and allows for analysis of the reasons for failure to pass the detection.
[0172] The data management system of this disclosure corresponds to the data warehouse table detection method described above, and related content can be referred to each other, which will not be repeated here. The beneficial technical effects of the data management system of this disclosure can be found in the corresponding beneficial technical effects of the exemplary method section described above, which will not be repeated here.
[0173] In addition, embodiments of this disclosure also provide an electronic device, including:
[0174] Memory, used to store computer program products;
[0175] A processor is configured to execute a computer program product stored in a memory, and when the computer program product is executed, to implement the data warehouse table detection method described in any of the above embodiments of this disclosure.
[0176] Figure 7 This is a schematic diagram illustrating the structure of an application embodiment of the electronic device disclosed herein. Below, reference is made to… Figure 7This describes an electronic device according to embodiments of the present disclosure. The electronic device may be either or both of a first device and a second device, or a standalone device independent of them, which can communicate with the first and second devices to receive acquired input signals from them. Figure 7 As shown, the electronic device includes one or more processors and memory.
[0177] A processor can be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and can control other components in an electronic device to perform desired functions.
[0178] The memory can store one or more computer program products, and the memory can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program products can be stored on the computer-readable storage medium, and the processor can run the computer program products to implement the data warehouse table detection methods of the various embodiments of this disclosure described above, and / or other desired functions.
[0179] In one example, the electronic device may also include input devices and output devices, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0180] In addition, the input device may also include, for example, a keyboard, a mouse, etc.
[0181] This output device can output various information to the outside, including determined distance information, direction information, etc. The output device may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0182] Of course, for the sake of simplicity, Figure 7 Only some of the components of the electronic device relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device may include any other suitable components depending on the specific application.
[0183] In addition to the methods and apparatus described above, embodiments of this disclosure may also be computer program products comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the data warehouse table detection methods according to various embodiments of this disclosure as described in the foregoing sections of this specification.
[0184] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0185] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the data warehouse table detection method according to various embodiments of this disclosure as described in the foregoing portion of this specification.
[0186] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable 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.
[0187] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0188] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0189] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0190] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.
[0191] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions to this disclosure.
[0192] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0193] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A data warehouse table detection method, characterized in that, include: Obtain the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change. The second development script includes at least one data source table identifier, and each data source table identifier is used to uniquely identify a data source table. Based on the differences between the first development script and the second development script, determine the fields affected by changes to the data warehouse table under test relative to the baseline data warehouse table; Using a pre-trained generative model, at least one test Structured Query Language (SQL) query statement is generated based on the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the change impact field. Execute at least one test SQL query statement on the baseline data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result; Based on the at least one test result, determine whether the data warehouse table to be tested passes the test, and obtain the test result.
2. The method according to claim 1, characterized in that, Obtain the first development script for the baseline data warehouse table before the change, and the second development script for the data warehouse table to be tested after the change, including: In response to receiving a detection instruction, the system acquires the identifier of the baseline data warehouse table included in the detection instruction, as well as the second development script. The second development script is developed based on data viewing requirements and also includes relevant fields in the data source table, as well as operations on the relevant fields. Based on the identifier of the benchmark data warehouse table, obtain the first development script.
3. The method according to claim 1, characterized in that, The at least one test SQL query statement includes: The first test SQL query statement is used to verify the structural changes of the data warehouse table under test relative to the benchmark data warehouse table; The second test SQL query statement is used to verify whether the information changes corresponding to the change-affected fields in the data warehouse table under test meet the preset requirements. The third test SQL query statement is used to verify whether the data warehouse table under test has any information changes that are not affected by the changed fields relative to the benchmark data warehouse table or the data source table.
4. The method according to claim 1, characterized in that, Execute at least one test SQL query statement on the baseline data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result, including: For each test SQL query statement in the at least one test SQL, query whether there is an SQL query statement template that matches each test SQL query statement; For each fourth test SQL query statement that has a matching SQL query statement template, an SQL query statement instance is generated based on the instance information in the fourth test SQL query statement and the SQL query statement template that matches the fourth test SQL query statement. The query engine is invoked to execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement instance, obtaining the execution result. The execution result is then parsed to obtain the parsing result, which includes information on the changes in the data warehouse table to be tested relative to the benchmark data warehouse table and / or the data source table. The test result includes the execution result and the parsing result. For each fifth test SQL query statement for which no matching SQL query statement template exists, the query engine is invoked to execute the fifth test SQL query statement on the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statement, and the execution result is obtained. The test result includes the execution result.
5. The method according to claim 1, characterized in that, Determining whether the data warehouse table under test passes the test based on at least one test result includes: In response to the fact that at least one test result meets the preset standard, the data warehouse table to be tested is determined to have passed the test; Otherwise, in response to any test result of the at least one test result not meeting the preset standard, it is determined that the data warehouse table to be tested has failed the test.
6. The method according to any one of claims 1-5, characterized in that, Also includes: In response to the detection result that the data warehouse table under test fails the test, the second development script is analyzed and troubleshooted to generate a new second development script. The new second development script is then used as the second development script to iteratively execute the operation that determines the fields affected by changes in the data warehouse table under test relative to the benchmark data warehouse table based on the differences between the first development script and the second development script.
7. The method according to claim 6, characterized in that, The second development script is analyzed and troubleshooting is performed to generate a new second development script, including: The first development script, the second development script, the target test result that does not meet the preset standard, and the data source table are input into the pre-trained analysis model. The analysis model outputs the target information associated with the target test result in the second development script and the reason why the target test result does not meet the preset standard. Based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, a root cause investigation report is generated so that the second development script can be modified based on the root cause investigation report to obtain a new second development script.
8. A data warehouse table detection device, characterized in that, include: The acquisition module is used to acquire the first development script of the baseline data warehouse table before the change and the second development script of the data warehouse table to be tested after the change. The second development script includes at least one data source table identifier, and each data source table identifier is used to uniquely identify a data source table. The first determining module is used to determine the fields affected by changes in the data warehouse table under test relative to the benchmark data warehouse table based on the differences between the first development script and the second development script. A model is generated to produce at least one test Structured Query Language (SQL) query statement based on the structural information of the benchmark data warehouse table, the structural information of the data warehouse table to be tested, the structural information of the data source table, and the change impact field. The execution module is used to execute at least one test SQL query statement on the benchmark data warehouse table, the data warehouse table to be tested, and the data source table to obtain at least one test result; The second determining module is used to determine whether the data warehouse table to be tested passes the test based on the at least one test result, and to obtain the test result.
9. The apparatus according to claim 8, characterized in that, The acquisition module is specifically used for: In response to receiving a detection instruction, the system acquires the identifier of the baseline data warehouse table included in the detection instruction, as well as the second development script. The second development script is developed based on data viewing requirements and also includes relevant fields in the data source table, as well as operations on the relevant fields. Based on the identifier of the benchmark data warehouse table, obtain the first development script.
10. The apparatus according to claim 8, characterized in that, The at least one test SQL query statement includes: The first test SQL query statement is used to verify the structural changes of the data warehouse table under test relative to the benchmark data warehouse table; The second test SQL query statement is used to verify whether the information changes corresponding to the change-affected fields in the data warehouse table under test meet the preset requirements. The third test SQL query statement is used to verify whether the data warehouse table under test has any information changes that are not affected by the changed fields relative to the benchmark data warehouse table or the data source table.
11. The apparatus according to claim 8, characterized in that, The execution module includes: The query unit is used to query whether there is an SQL query statement template that matches each of the at least one test SQL query statements. The first generation unit is used to generate SQL query statement instances based on the instance information in the fourth test SQL query statement and the SQL query statement template that matches the fourth test SQL query statement for each fourth test SQL query statement that has a matching SQL query statement template. The calling unit is used to call the query engine to execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement instance, and obtain the execution result; and to call the query engine for each fifth test SQL query statement for which there is no matching SQL query statement template, to execute the fifth test SQL query statement for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the fifth test SQL query statement, and obtain the execution result, wherein the test result corresponding to the fifth test SQL query statement includes the execution result; The parsing unit is used to parse the execution result to obtain the parsing result, which includes information on the changes of the data warehouse table under test relative to the benchmark data warehouse table and / or the data source table; the test result corresponding to the fourth test SQL query statement includes the execution result and the parsing result.
12. The apparatus according to claim 8, characterized in that, The second determining module is specifically used for: In response to the fact that at least one test result meets the preset standard, the data warehouse table to be tested is determined to have passed the test; Otherwise, in response to any test result of the at least one test result not meeting the preset standard, it is determined that the data warehouse table to be tested has failed the test.
13. The apparatus according to any one of claims 8-12, characterized in that, Also includes: The analysis module is used to analyze and troubleshoot the second development script in response to the detection result that the data warehouse table under test has failed the detection, so as to generate a new second development script.
14. The apparatus according to claim 13, characterized in that, The analysis module includes: An analysis model is used to determine, based on the first development script, the second development script, the target test results that do not meet the preset standards, and the data source table, the target information associated with the target test results in the second development script, and the reasons why the target test results do not meet the preset standards. The second generation unit is used to generate a root cause investigation report based on the target test results, the reasons why the target test results do not meet the preset standards, and the target information, so as to modify the second development script based on the root cause investigation report to obtain a new second development script.
15. A data management system, characterized in that, include: Data factory, query engine, and data warehouse table detection device as described in any one of claims 8-14; The data factory is used to store relevant information about the data source table, the baseline data warehouse table, and the data warehouse table to be tested. The relevant information includes metadata, structural information, and development scripts. The query engine is used to respond to the call of the data warehouse table detection device, execute the SQL query statement instance for the benchmark data warehouse table, the data warehouse table to be tested, and the data source table involved in the SQL query statement, and obtain the execution result.
16. An electronic device, characterized in that, include: Memory, used to store computer program products; A processor for executing a computer program product stored in the memory, wherein, when the computer program product is executed, it implements the method of any one of claims 1-7.
17. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1-7.
Citation Information
Patent Citations
Structured query statement generation method and device and computer equipment
CN113918594A
Data testing method and device and electronic equipment
CN115495368A
Test support device and test support program
JP2018097785A
