Metadata reduction method of database and computing equipment
By building a knowledge base and utilizing multiple models to automatically restore abbreviation identifiers in database metadata, the problem of low metadata restoration efficiency is solved, achieving efficient and accurate abbreviation completion and ensuring data consistency after database migration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HENAN QINWEI DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2026-01-04
- Publication Date
- 2026-05-12
Smart Images

Figure CN122019535A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to a method and computing device for restoring metadata of a database. Background Technology
[0002] In database design, table identifiers (such as table names) or field identifiers (such as field names) in metadata are often abbreviated to improve storage and query efficiency. However, this abbreviation practice increases the difficulty of database interpretation and maintenance, and may lead to data usage errors during database migration due to the inability to restore abbreviations. Especially in the absence of complete database documentation or comments, developers may find it difficult to accurately understand the true meaning of abbreviations, thus affecting the accuracy of subsequent development and data utilization. Traditional abbreviation completion processes lack automated support and are inefficient, especially with large databases; furthermore, the efficiency and accuracy of abbreviation completion are low when database documentation is incomplete or missing. Summary of the Invention
[0003] This application provides a method and computing device for restoring metadata of a database, thereby improving the efficiency and accuracy of metadata restoration.
[0004] In a first aspect, embodiments of this application provide a method for restoring metadata of a database. The method includes: determining a first identifier in the metadata, where the metadata is the metadata of a table in the database, and the first identifier is an identifier represented in abbreviated form within the metadata; determining the business function of the first identifier based on a first knowledge base and a first target table in the database, where the first knowledge base describes the business functions of the table in the database and the business functions of the fields included in the table, and the identifier of the object corresponding to the first target table includes the first identifier; the object is a table and / or the fields included in the table; and restoring the first identifier to a second identifier based on the business function of the first identifier and the metadata of the first target table, where the second identifier is the complete form of the first identifier.
[0005] Thus, based on the first target table and the first knowledge base (which describes the business functions of the tables in the database and the business functions of the fields included in the tables), the business function of the first identifier is constructed, assigning the first identifier relevant information at the actual business level. Furthermore, the metadata of the first target table indicates the relevant information of the table and its included fields at the database level. Based on this, and using the business function of the first identifier and the metadata of the first target table, the first identifier is restored to its complete form as the second identifier. This ensures that the restoration result conforms to both actual business needs and database structure design rules, solving the problem of difficulty in interpreting abbreviations, reducing data usage errors caused by misreading abbreviations, and improving the efficiency and accuracy of data abbreviation completion.
[0006] In one possible implementation, restoring the first identifier to a second identifier based on the business function of the first identifier and the metadata of the first target table includes: inputting the business function of the first identifier and the metadata of the first target table into a first model; obtaining at least two candidate identifiers output by the first model, the candidate identifiers being used to represent the complete form of the predicted first identifier; determining a second identifier from the at least two candidate identifiers based on the evaluation results of the at least two candidate identifiers, the evaluation results being used to indicate the degree of fit of the candidate identifiers as the complete form of the first identifier; and restoring the first identifier to the second identifier.
[0007] In this way, the business function of the first identifier and the metadata of the first target table are input into the first model, so that the at least two candidate identifiers generated by the first model are consistent with the actual design rules of the business logic and the table's metadata. Then, based on the evaluation results indicating at least two candidate identifiers, the second identifier is determined from at least two candidate identifiers. This can accurately filter out candidate identifiers that have a high degree of matching with the first identifier and conform to both the business logic and the table's metadata, while excluding candidate identifiers with poor adaptability, thereby improving the accuracy and rationality of the determined second identifier as the complete form of the first identifier.
[0008] In another possible implementation, the first identifier is restored to the second identifier based on the business function of the first identifier and the metadata of the first target table, including: inputting the business function of the first identifier and the metadata of the first target table into the first model, obtaining a candidate identifier output by the first model; using the candidate identifier as the second identifier, and restoring the first identifier to the second identifier.
[0009] In this way, by directly outputting a candidate identifier using the first model and using it as the second identifier, the efficiency of determining the second identifier is improved while ensuring that the second identifier is compatible with the first identifier.
[0010] In one possible implementation, before determining the second identifier from at least two candidate identifiers based on the evaluation results of at least two candidate identifiers, the method further includes: determining a first business function description of the object corresponding to the first identifier, the first business function description representing the predicted business function description of the object corresponding to the second target table when the candidate identifier is used as the identifier of the object corresponding to the second target table. The identifier of the object corresponding to the second target table includes the first identifier, and the second target table is different from the first target table. Determining the semantic similarity between the first business function description and the second business function description, the second business function description representing the actual business function description of the object corresponding to the second target table. The semantic similarity is used to indicate the semantic consistency between the first business function description and the second business function description; and determining the evaluation results of at least two candidate identifiers based on the semantic similarity.
[0011] Thus, by introducing a second target table that is different from the first target table and whose objects contain the first identifier, cross-validation is performed on whether each candidate identifier can be the complete form of the first identifier. This makes the suitability judgment of the candidate identifier closely match the actual business function, avoids the one-sidedness of the business function description in the single table scenario, makes the evaluation results more objective, and improves the fit and rationality of restoring the first identifier.
[0012] In one possible implementation, when the object corresponding to the first identifier is a table, the business function description of the object corresponding to the second target table is the business function description of the second target table, the actual business function description of the object corresponding to the second target table is the actual business function description of the second target table, and the object corresponding to the second target table is the second target table.
[0013] Thus, the object corresponding to the first identifier being a table can be understood as the first identifier being the identifier within the identifier of a table in the database (such as the second target table). In this scenario, using the business function description of the second target table as the business function description of the object corresponding to the first identifier, and using the actual business function description of the second target table as the actual business function of the object corresponding to the second target table, can ensure the consistency of business semantics in this scenario.
[0014] In another possible implementation, if the object corresponding to the first identifier is a field, or if the object corresponding to the first identifier is a table and a field, the business function description of the object corresponding to the second target table is the business function description of the second target table and the business function description of the field, and the actual business function description of the object corresponding to the second target table is the actual business function description of the second target table and the actual business function description of the field. The object corresponding to the second target table is the second target table and the field.
[0015] Thus, the object corresponding to the first identifier as a field can be understood as the first identifier being the identifier among the identifiers of the fields included in a table in the database (such as the second target table). The object corresponding to the first identifier as a table and field can be understood as the first identifier being the identifier of the second target table and the identifier among the identifiers of the fields included in that table. This ensures consistency in the business semantics of this scenario.
[0016] In one possible implementation, based on a first knowledge base and a first target table in the database, the business function of the first identifier is determined, including: determining a third business function description from the first knowledge base, wherein the third business function description represents the business function description of the object corresponding to the first target table; based on the third business function description, obtaining first basic knowledge of the domain involved in the third business function description from a second knowledge base, wherein the second knowledge base is used to describe the basic knowledge of the domain involved in different business function descriptions; and determining the business function of the first identifier based on the third business function description and the first basic knowledge.
[0017] Thus, by obtaining a third business function description that matches the first identifier from the first knowledge base, and then combining it with the first basic knowledge of the relevant domain obtained from the second knowledge base to determine the business function of the first identifier, the business function of the first identifier can not only match the business function of the object corresponding to the first target table, but also have domain knowledge support, thereby accurately and comprehensively generating the business function of the first identifier.
[0018] In one possible implementation, when the object corresponding to the first identifier is a table, the business function description of the object corresponding to the first target table is the business function description of the first target table, and the object corresponding to the first target table is the first target table. When the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is both a table and a field, the business function description of the object corresponding to the first target table is the business function description of the first target table and the business function description of the field, and the object corresponding to the first target table is the first target table and the field.
[0019] Thus, the first identifier corresponding to a table can be understood as the first identifier being the identifier within the identifiers of a table in the database (such as the first target table). In this scenario, the business function description of the first target table is used as the third business function description. The first identifier corresponding to a field can be understood as the first identifier being the identifier within the identifiers of fields included in a table in the database (specifically, the first target table). The first identifier corresponding to both a table and a field can be understood as the first identifier being the identifier of the first target table and the identifier within the identifiers of the fields included in that table. This ensures consistency in the business semantics within this scenario.
[0020] In one possible implementation, the business function of the first identifier is determined based on the third business function description and the first basic knowledge, including: inputting the third business function description and the first basic knowledge into the second model, and obtaining the business function of the first identifier output by the second model.
[0021] Thus, by inputting the third business function description and the first basic knowledge into the second model, the business function of the first identifier can be accurately obtained.
[0022] In one possible implementation, before determining the business function of the first identifier based on the first knowledge base and the first target table in the database, the method further includes: acquiring target log data, which includes first log data and second log data. The first log data is used to indicate the execution logic of the application associated with the database in response to the target operation, and the second log data is used to indicate the change records of the database in response to the target operation. The target operation is an operation performed by a user on an application associated with the database. Based on the target log data, the method determines the business domain involved in the target operation. Based on the business domain, the method acquires second basic knowledge of the business domain from the second knowledge base. Based on the target log data and the second basic knowledge, the method determines the objects involved in the target operation and a fourth business function description of the objects involved in the target operation. The method generates the first knowledge base based on the objects involved in the target operation and the fourth business function description of the objects involved in the target operation.
[0023] In this way, the business function positioning of objects in the database can be more accurate, the business function description can not only conform to the actual operation, but also meet the domain knowledge requirements. At the same time, it can build a mapping relationship between objects in the database and business function descriptions, so as to realize the construction of the first knowledge base.
[0024] In one possible implementation, obtaining the target log data includes: obtaining the target timestamp when the target operation was performed; obtaining the application logs and the database change data capture (CDC) logs. Based on the target timestamp, log data corresponding to the target timestamp is filtered from the application logs and CDC logs as the target log data.
[0025] Thus, application logs record traceable text or structured data streams automatically generated during application runtime, recorded chronologically, regarding the application's running status, execution flow, events, and errors, including execution records of the application's response to the target operation at different times. CDC logs, by capturing and recording data change events from database transaction logs, provide real-time or near real-time streaming data on database add, delete, and update operations, including change records of the database's response to the target operation at different times. Therefore, by combining the target timestamp to filter corresponding data from the two types of logs as the target log data, it is possible to accurately filter out log data from other time dimensions unrelated to the target operation, avoiding interference from redundant data, and ensuring that the target log data meets actual needs.
[0026] In one possible implementation, the business domain involved in the target operation is determined based on the target log data, including: inputting the target log data into a third model and obtaining the business domain output by the third model.
[0027] In this way, by combining the capabilities of the third model, we can accurately output business domains that fit the actual target operation scenario, thereby improving the automation and intelligence of generating business domains.
[0028] In one possible implementation, the method further includes: inputting the metadata of the first target table into the fourth model, and obtaining the structured metadata of the first target table output by the fourth model. Based on the business function of the first identifier and the metadata of the first target table, the method restores the first identifier to a second identifier, including: restoring the first identifier to a second identifier based on the business function of the first identifier and the structured metadata of the first target table.
[0029] Thus, by using the fourth model to transform the metadata of the discrete first target table into structured metadata, it is more conducive to the expression of structural information in the database.
[0030] Secondly, embodiments of this application provide a computing device, including: a memory and a processor. The memory is used to store program instructions. The processor is used to execute the program instructions, causing the computing device to perform a database metadata restoration method as described in the first aspect or any possible implementation thereof.
[0031] Thirdly, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed on a computing device, cause the computing device to perform a database metadata restoration method as described in the first aspect or any possible implementation thereof.
[0032] Fourthly, a computer program product is provided, the computer program product including computer execution instructions, which, when executed on a computing device, cause the computing device to perform a database metadata restoration method as described in the first aspect or any possible implementation of the first aspect.
[0033] The technical effects of any of the implementation methods in the second to fourth aspects can be found in the technical effects of different implementation methods in the first aspect, and will not be repeated here.
[0034] Based on the implementation methods provided in the above aspects, the embodiments of this application can be further combined to provide more implementation methods. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of the structure of a first computing device provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application; Figure 3 A flowchart illustrating a method for restoring metadata of a database, provided in an embodiment of this application; Figure 4 A visual flowchart illustrating the process of acquiring a first knowledge base, provided as an embodiment of this application; Figure 5 A visual flowchart illustrating a method for restoring metadata of a database, provided in an embodiment of this application; Figure 6 This is a flowchart illustrating a specific implementation method for restoring a first identifier to a second identifier based on the business function of the first identifier and the metadata of the first target table, as provided in an embodiment of this application. Figure 7 A visual flowchart illustrating the process of determining a second identifier based on a first target table, a first knowledge base, and a second knowledge base, provided for embodiments of this application; Figure 8 A visual flowchart illustrating a method for restoring metadata of a database, provided in an embodiment of this application; Figure 9 This is a schematic diagram of another computing device provided in an embodiment of this application. Detailed Implementation
[0036] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0037] In the description of the embodiments of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. In the embodiments of this application, "and / or" is merely a description of the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.
[0038] Furthermore, in the description of the embodiments of this application, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0039] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" are not necessarily different. Meanwhile, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is being used as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0040] The following is a brief introduction to the relevant terms used in the embodiments of this application.
[0041] A database is a data storage system actually used by applications, and it is also a database that requires abbreviation and completion. A database provides tables and the fields they contain. Database metadata includes the metadata of the tables within the database. For example, table metadata can include the table identifier (such as the table name) and a description of the table's business function. For instance, a table identifier of "qw_erp_model_info" with a business function description such as "model information table" indicates that the table is used to manage model information, meaning it includes model information that indicates a specific model. Table metadata can also include field identifiers (such as field names), as well as the field's data type, whether the field is nullable, and a description of the field's business function. For example, a field identifier of "model_series" with a data type of "varchar(50), null" and a business function description of "model series" indicates that the field is used to represent the series to which the model belongs. Another example is a field identifier of "model_name" with a data type of "varchar(100), null" and a business function description of "model name," indicating that the field is used to represent the name of the model. For example, a field with the identifier "model_type", a data type of "varchar(50), not null", and a business function of "model series" indicates that this field is used to represent the series to which the model belongs. Another example is a field with the identifier "model_name", a data type of "varchar(100), null", and a business function description of "model type", indicating that this field is used to represent the type of the model, such as belonging to "dialogue model chat / reasoning model think / embed model embed / reranker model", etc.
[0042] Abbreviations refer to simplified representations of identifiers used in table and / or field identifiers within metadata, which are used to simplify database design. In this embodiment, metadata refers to the metadata of tables within the database.
[0043] Abbreviation completion / restoration refers to the process of restoring abbreviated identifiers (such as the first identifier) in metadata to their full forms (such as the second identifier, which can be a fully spelled English word or phrase).
[0044] The following provides an exemplary description of the application scenarios of the embodiments of this application.
[0045] The embodiments of this application are mainly applied to scenarios where abbreviated identifiers in metadata are restored (or abbreviations are completed).
[0046] Taking a database migration scenario as an example, when an enterprise migrates its database from an old Enterprise Resource Planning (ERP) system to a new ERP system, for instance, the old ERP system's database might include an order table with an abbreviated field identifier "ord_type," and this order table lacks database documentation and comments. The actual meaning of "ord_type" is "order_type" (order type, used to distinguish between "online orders," "offline store orders," and "wholesale orders," with corresponding values of 1, 2, and 3 respectively). However, during the database migration process, due to a lack of accurate restoration of this abbreviated field identifier, the new ERP system developers might mistakenly interpret "ord_type" as "order_typology" and design the new ERP system's business logic based on this misunderstanding: incorrectly mapping the original field values "1, 2, 3" to "physical orders," "virtual orders," and "hybrid orders," respectively. As a result, after the database migration is complete, the new ERP system will encounter errors when processing order data, leading to confusion in the post-migration business logic and incorrect data usage.
[0047] The system architecture of the embodiments of this application will be described exemplarily below.
[0048] This application provides a first computing device. This first computing device is used to perform abbreviation completion (i.e., restoration) on a first identifier in abbreviated form in metadata to obtain a second identifier. It is understood that the first identifier is an identifier represented in abbreviated form in metadata, and the second identifier is the complete form of the first identifier. The first computing device is capable of reading data from a database or writing data to a database. In some embodiments, such as... Figure 1 As shown, the database is deployed on a device other than the first computing device (such as a second computing device). The first computing device can interact with the second computing device to read data from the database or write data to the database. In other embodiments, the database may be deployed on the first computing device.
[0049] Specifically, the first computing device is used to determine a first identifier in the metadata. The first computing device is also used to determine the business function of the first identifier based on a first knowledge base and a first target table in the database. The first knowledge base describes the business functions of the tables in the database and the business functions of the fields included in the tables. The identifier of the object corresponding to the first target table includes the first identifier; the object is the table and / or the fields included in the table. Furthermore, the first computing device is also used to restore the first identifier to a second identifier based on the business function of the first identifier and the metadata of the first target table.
[0050] In some embodiments, the first computing device is further configured to acquire a first knowledge base. The first knowledge base is determined based on application logs, change data capture (CDC) logs, and a second knowledge base. The application logs record a traceable text or structured data stream automatically generated by the application during runtime, recorded chronologically, regarding its running status, execution flow, events, and errors, such as execution records of the application responding to user operations at different timestamps. The CDC logs are a special data source that provides real-time or near real-time streaming data on database add, delete, and update operations by capturing and recording data change events from database transaction logs, such as change records of the database responding to user operations at different timestamps.
[0051] The second knowledge base is used to describe the basic knowledge of the fields (or different business fields) involved in the description of different business functions. For example, the second knowledge base can be stored on the first computing device or a device other than the first computing device (such as the second computing device). In this embodiment, the second knowledge base being stored on the first computing device is used as an example for illustrative explanation.
[0052] Optionally, the first knowledge base may be generated by the first computing device based on application logs, CDC logs, and the second knowledge base. Alternatively, it may be generated by a device other than the first computing device (such as the second computing device) and sent to the first computing device. In this embodiment, the generation of the first knowledge base by the first computing device is used as an example for illustrative explanation.
[0053] In one implementation, the first computing device acquires application logs via a probe used for collecting application logs. The probe can be deployed on the same device as the database, such as a second computing device.
[0054] An example, such as Figure 1 As shown, the probe is deployed on the second computing device. The application logs of the database-related applications can be stored in the storage space of the second computing device, such as local memory or the operating system's built-in logging service. The second computing device retrieves the application logs of the database-related applications from its storage space based on the probe and sends the collected application logs to the first computing device.
[0055] As another example, the probe can be deployed on the first computing device, and the application logs of the database-related application can be stored in the storage space of the first computing device. In this way, the first computing device can obtain the application logs of the database-related application from its storage space based on the probe.
[0056] In one implementation, the first computing device acquires CDC logs via a CDC plugin or tool, which is used to collect CDC logs. The CDC plugin or tool can be deployed on the same device as the database, such as a second computing device. The CDC logs can be stored in the database.
[0057] An example, such as Figure 1 As shown, the CDC plugin or tool is deployed on the second computing device. The second computing device collects CDC logs through the CDC plugin or tool and sends the collected CDC logs to the first computing device.
[0058] In another example, a CDC plugin or tool is deployed on a first computing device, which uses the CDC plugin or tool to retrieve CDC logs from a database.
[0059] In one implementation, the first computing device determines a first knowledge base based on application logs, CDC logs, and a second knowledge base. Specifically, this includes: the first computing device determining the business domain involved in the target operation based on target log data in the application logs and CDC logs. The target log data includes execution records indicating the application's response to the target operation and change records of the database's response to the target operation. The target operation is an operation performed by a user on an application associated with the database. The first computing device obtains second basic knowledge of that business domain based on the business domain and the second knowledge base. The first computing device is also used to determine the first knowledge base based on the application logs, CDC logs, and the second basic knowledge.
[0060] An example, such as Figure 1 As shown, the first computing device is equipped with a third model. The third model has the function of generating a business domain based on the target log data. The first computing device inputs the target log data into the third model and obtains the business domain output by the third model.
[0061] Specifically, based on the target log data and the second basic knowledge, the first computing device determines the objects involved in the target operation and the fourth business function description of the objects involved in the target operation. The first computing device then generates a first knowledge base based on the objects involved in the target operation and their fourth business function descriptions.
[0062] An example, such as Figure 1 As shown, the first computing device is equipped with a fifth model. The fifth model has the capability to generate objects involved in the target operation and their business function descriptions based on target log data and fundamental knowledge. The first computing device inputs the target log data and the second fundamental knowledge into the fifth model, and obtains the objects involved in the target operation and their fourth business function descriptions output by the fifth model.
[0063] In some embodiments, the computing device identifies the first identifier using a natural language processing tool, such as a natural language toolkit (NLTK), which has the capability to identify identifiers in their full form from metadata. After reading the metadata, the first computing device analyzes the identifiers in the metadata using the natural language processing tool, identifies the identifiers in their full form, and determines the identifiers other than those in their full form as the first identifier.
[0064] An example, such as Figure 1 As shown, the natural language processing tools are deployed on the first computing device.
[0065] As another example, the natural language processing tool can be deployed on a device other than the first computing device (such as a second computing device), which, after reading the metadata, determines the first identifier and sends the first identifier to the first computing device.
[0066] In some embodiments, the first computing device determines a third business function description based on a first knowledge base. This third business function description represents the business function description of the object corresponding to the first target table. The first computing device also obtains first basic knowledge of the domain involved in the third business function description based on the third business function description and a second knowledge base. Furthermore, the first computing device determines the business function of the first identifier based on the third business function description and the first basic knowledge.
[0067] In one implementation, such as Figure 1 As shown, the first computing device is equipped with a second model, which has the ability to generate business functions based on business function descriptions and basic knowledge. The first computing device inputs a third business function description and first basic knowledge into the second model to obtain the business functions of the first identifier output by the second model.
[0068] In some embodiments, such as Figure 1 As shown, the first computing device is equipped with a fourth model, which has the function of generating structured metadata of the first target table based on the metadata of the first target table. The first computing device inputs the metadata of the first target table into the fourth model and obtains the structured metadata of the first target table output by the fourth model. Correspondingly, the first computing device restores the first identifier to the second identifier according to the business function of the first identifier and the metadata of the first target table.
[0069] In some embodiments, the first computing device determines at least two candidate identifiers based on the business function of the first identifier and the metadata of the first target table (specifically, structured metadata of the first target table), and selects a second identifier from the at least two candidate identifiers. The candidate identifiers are used to represent the complete form of the predicted first identifier.
[0070] In one implementation, such as Figure 1 As shown, the first computing device is equipped with a first model. The first model has the function of predicting the full form of the identifier corresponding to the abbreviated form of the identifier based on the business function of the first identifier and the metadata of the first target table. The first computing device inputs the business function of the first identifier and the metadata of the first target table into the first model and obtains at least two candidate identifiers output by the first model.
[0071] In some embodiments, the first computing device is further configured to determine a first business function description. The first business function description represents a predicted business function description of an object corresponding to a second target table, where the candidate identifier is used as the identifier of the object corresponding to the second target table. The identifier of the object corresponding to the second target table includes the first identifier, and the second target table is different from the first target table. The first computing device is further configured to determine the evaluation results of at least two candidate identifiers based on the semantic similarity between the first and second business function descriptions. The second business function description represents the actual business function description of the object corresponding to the second target table. The semantic similarity is used to indicate the semantic consistency between the first and second business function descriptions. Therefore, the first computing device's selection of a second identifier from at least two candidate identifiers may specifically include: selecting a second identifier from at least two candidate identifiers based on the evaluation results of the at least two candidate identifiers.
[0072] In determining one implementation method for the description of the first business function, such as Figure 1 As shown, the first computing device also deploys a sixth model. The sixth model has the function of replacing the first identifier in the identifier of the object corresponding to the second target table with a candidate identifier, and predicting the business function description of the object corresponding to the second target table based on the replaced identifier. The first computing device inputs the candidate identifier and the second target table into the sixth model and obtains the first business function description output by the sixth model. Specifically, the sixth model first replaces the first identifier in the identifier of the object corresponding to the second target table with a candidate identifier, and then predicts the business function description of the object corresponding to the second target table based on the replaced identifier.
[0073] In one implementation, the description of the second business function is determined through the seventh model. For example... Figure 1As shown, the first computing device is equipped with a seventh model, which has the function of generating business function descriptions of objects corresponding to the second target table based on the objects corresponding to the second target table. The first computing device inputs the second target table into the seventh model, obtains the business function description output by the seventh model, and uses it as the actual business function description of the second target table, that is, the second business function description.
[0074] In other embodiments, the aforementioned multiple models, such as the first model, second model, third model, fourth model, fifth model, sixth model, and seventh model, can be deployed on a device other than the first computing device (such as a second computing device) or in the cloud. The first computing device obtains the output results of the multiple models by interacting with the device or the cloud.
[0075] In some embodiments, the aforementioned multiple models, such as the first model, second model, third model, fourth model, fifth model, sixth model, and seventh model, may be the same model or different models. Specifically, these multiple models may be large language models (LLMs) based on generative pre-trained Transformer architectures.
[0076] In this embodiment, the computing device (such as a first computing device, a second computing device, etc.) can be a server. The server can be a single physical server or logical server, or it can be composed of two or more physical servers or logical servers that share different responsibilities, working together to achieve various server functions such as data processing and service provision through division of labor and cooperation.
[0077] In terms of hardware form, servers can be blade servers, high-density servers, rack servers, or tower servers, which are suitable for different application scenarios such as high-density cluster deployment in data centers and small enterprise server rooms.
[0078] like Figure 2 As shown, the hardware of a computing device includes a processor, a basic input / output system (BIOS) chip, an out-of-band controller, and memory, while the software mainly includes BIOS firmware, an out-of-band management module, and an operating system (OS).
[0079] The processor may include a central processing unit (CPU) and / or a graphics processing unit (GPU). In embodiments of this application, the computing device may specifically implement the above-described functions through a processor (such as a CPU). In one implementation, the multiple models described above may be run by a CPU or a GPU to implement the functions of multiple models.
[0080] Memory, also known as internal memory or main memory, is installed in memory slots on the motherboard of a computing device and connected to the CPU via a memory bus. It is primarily used for temporary storage of data and instructions, providing high-speed data read and write support for the processor. In one implementation, for a computing device where a database is deployed, the memory of that computing device serves as the database's cache and working space.
[0081] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0082] For ease of understanding, the following description, in conjunction with the aforementioned computing device and accompanying drawings, provides an exemplary account of the database metadata restoration method provided in the embodiments of this application.
[0083] like Figure 3 As shown, this application embodiment provides a method for restoring metadata of a database. For example, it includes the following steps: S301-S303, which can be executed by the aforementioned first computing device, such as its processor, like a CPU.
[0084] In some embodiments, the method further includes: constructing a knowledge base. Optionally, this step may be performed before step S301.
[0085] The knowledge base includes a first knowledge base. The first knowledge base describes the business functions of the tables in the database and the business functions of the fields included in those tables. For example, business functions may include business domains, business objects, and function descriptions. Business domains represent the business domains associated with tables and / or fields in the database, clarifying the belonging of those tables and / or fields within the overall business architecture, such as the model information in the aforementioned model information table. For example, when the database is associated with an e-commerce platform, it may include a purchase order table (po_table), an order settlement table, and a member information table (mem_table), whose associated business domains may be, for example, purchase management, order settlement, and member management. Business objects represent the specific business entities directly managed, recorded, or associated with tables and / or fields in the database, such as the "model" in the aforementioned model information table. For example, the purchase order table includes "suppliers," the order settlement table includes "users" and "payment orders," and the member information table includes "members" and "member points." Functional descriptions are used to indicate the specific purpose of tables and / or fields in a database, the core data content they store, and their role in the business process (such as data recording, process support, information association, etc.). They clarify how the table and / or field provides data support for business operations or analysis. For example, the aforementioned model information table manages model information, and the model type indicates the type of model (e.g., belonging to chat / think / embed / reranker, etc.). Another example: the purchase order table records core information about purchase orders between the company and its suppliers; the member information table stores basic information about members in the chain retail system (name, linked mobile phone number, registration time) and membership level, etc.
[0086] Optionally, the knowledge base may also include a second knowledge base. The second knowledge base is used to describe the fundamental knowledge of the areas (or different business areas) involved in the descriptions of different business functions. For example, the second knowledge base may specifically include: user manuals, application-related websites, competitor documents, and other relevant documents within the field. Here, "application" refers to an application associated with the database, specifically including applications, application software, or application systems, such as ERP systems, e-commerce trading platforms, and enterprise financial accounting systems. For instance, in a scenario where the application is an ERP system, this second knowledge base is used to describe the fundamental knowledge of the areas (or different business areas) involved in the descriptions of different business functions of the ERP.
[0087] In one specific implementation of constructing a first knowledge base, firstly, target log data is acquired. This target log data includes first log data and second log data. The first log data indicates the execution records of the application's response to the target operation associated with the database, while the second log data indicates the change records of the database's response to the target operation. The target operation is an operation performed by a user on an application associated with the database. Secondly, based on the target log data, the business domain involved in the target operation is determined. Then, based on the business domain, second basic knowledge of the business domain is acquired from the second knowledge base. Next, based on the target log data and the second basic knowledge, the objects involved in the target operation and their fourth business function descriptions are determined. Finally, the first knowledge base is generated based on the objects involved in the target operation and their fourth business function descriptions.
[0088] For example, the object is a database table and / or the fields included in the table. Based on this, the objects involved in the target operation can be categorized as follows: the table involved in the target operation, the fields included in the table involved in the target operation, or the table involved in the target operation and the fields included in the table. The fourth business function description of the object can be categorized as follows: the business function description of the table, the business function description of the fields included in the table, or the business function description of the table and the fields included in the table. It is understandable that when the object is a table and the fields included in the table, it means describing the object at the granularity of both the table and the fields. For example, table 1 includes fields 1, 2, and 3. The target operation may involve table 1, and may also involve fields 1, 2, and 3 in table 1. Similarly, if table 1 has a business function description, fields 1, 2, and 3 will also each have corresponding business function descriptions.
[0089] Furthermore, within the same time period, the target operation is a single operation performed by a single user on the database-related application; that is, a single target operation responded to by the application within the same time period. In this embodiment, for scenarios where the first identifier in the metadata needs to be abbreviated and completed, a test environment can be set up. This test environment includes the database-related application, where users can sequentially perform operations on multiple functions of the application (such as creating a new user, modifying a company name, etc.). These operations are the target operations. During this process, the application's response to these operations generates execution records; and the database's response to these operations generates change records, such as changes to the personnel table due to creating a new user, or changes to the company table due to modifying a company name.
[0090] For example, the first log data may include: the timestamp corresponding to the target operation, and the application's execution record of the target operation under that timestamp. For instance, if the timestamp corresponding to the target operation is 2025 / 10 / 11 / 10:00, the application's execution record of the target operation under that timestamp is a record related to "creating a new user". Or, for another example, if the timestamp corresponding to the target operation is 2025 / 10 / 11 / 10:03, the application's execution record of the target operation under that timestamp is a record related to "changing the company name".
[0091] Furthermore, the second log data indicates changes to the data of objects involved in the database response to the target operation. For example, the second log data may include: the timestamp corresponding to the target operation, and the changes to the objects in the database in response to the target operation at that timestamp. For instance, if the timestamp for the target operation is 2025 / 10 / 11 / 10:00, the changes to the objects in the database at that timestamp might be "Adding relevant information about new users to the personnel table in the database," where the object is the personnel table. As another example, if the timestamp for the target operation is 2025 / 10 / 11 / 10:00, the changes to the objects in the database at that timestamp might be "Modifying the company name in the company table in the database," where the object is the company table.
[0092] In this embodiment, when a user performs a target operation, by acquiring target log data including the application's execution record in response to the target operation and the database's change record in response to the target operation, a complete understanding of the application layer's processing logic and the entire process of database layer changes in response to the target operation can be obtained, making the target log data more comprehensive. Based on this, the business domain of the target operation is determined through the target log data, ensuring that the business domain closely aligns with the user's actual operation and actual data changes, without deviating from the real business scenario. Then, based on the business domain, corresponding second basic knowledge is obtained from the second knowledge base, which can supplement the domain specifications, business background, and other content not covered in the log, filling information gaps. Finally, by combining the target log data and the second basic knowledge, the objects involved in the target operation and the fourth business function description are determined, and a first knowledge base is generated based on the objects involved in the target operation and their fourth business function descriptions. This allows for more accurate positioning of the object's business function, ensuring that the business function description conforms to both the actual operation and the domain knowledge requirements. Simultaneously, it enables the construction of a mapping relationship between objects in the database and business function descriptions, thereby realizing the construction of the first knowledge base.
[0093] Optionally, the identifiers of objects and the business function descriptions of objects in the first knowledge base can be stored in the form of a correspondence, such as table names or field names, which correspond to the business function descriptions of the table or field, respectively.
[0094] In one specific implementation of obtaining target log data, the target timestamp when the target operation is executed is obtained. Application logs and CDC logs are obtained; the application logs include execution records of the application's response to the target operation at different times; the CDC logs include change records of the database's response to the target operation at different times. Based on the target timestamp, log data corresponding to the target timestamp is filtered from the application logs and CDC logs as the target log data.
[0095] For example, the application log records multiple log entries, including: Log data 1, the target operation's timestamp is 2025 / 10 / 11 / 9:00, and the application's execution record of responding to the target operation under that timestamp; Log data 2, the target operation's timestamp is 2025 / 10 / 11 / 9:20, and the application's execution record of responding to the target operation under that timestamp; Log data 3, the target operation's timestamp is 2025 / 10 / 11 / 9:55, and the application's execution record of responding to the target operation under that timestamp; Log data 4, the target operation's timestamp is 2025 / 10 / 11 / 10:00, and the application's execution record of responding to the target operation under that timestamp is related to "creating a new user"; Log data 5, the target operation's timestamp is 2025 / 10 / 11 / 10:03, and the application's execution record of responding to the target operation under that timestamp is related to "changing the company name". Based on this, if the target timestamps include 2025 / 10 / 11 / 10:00 and 2025 / 10 / 11 / 10:03, then log data 4 and log data 5 are selected from the application logs as the first log data.
[0096] Similarly, the CDC log also records multiple log entries, including: Log data 6, the timestamp of the target operation is 2025 / 10 / 11 / 9:00, and the database's response to the target operation change record at that timestamp; Log data 7, the timestamp of the target operation is 2025 / 10 / 11 / 9:20, and the database's response to the target operation change record at that timestamp; Log data 8, the timestamp of the target operation is 2025 / 10 / 11 / 9:55, and the database's response to the target operation change record at that timestamp; Log data 9, the timestamp of the target operation is 2025 / 10 / 11 / 10:00, and the database's response to the target operation change record at that timestamp indicates "the relevant information of the new user has been added to the personnel table in the database"; Log data 10, the timestamp corresponding to the target operation is 2025 / 10 / 11 / 10:00, and the database's response to the target operation change record at that timestamp indicates "the company name has been modified in the company table in the database". Based on this, if the target timestamps include 2025 / 10 / 11 / 10:00 and 2025 / 10 / 11 / 10:03, then log data 9 and log data 10 are selected from the CDC logs as the second log data.
[0097] In this embodiment of the application, by combining the target timestamp to select the corresponding data from the two types of logs as the target log data, it is possible to accurately filter out log data of other time dimensions that are not related to the target operation, avoid interference from redundant data, and ensure that the target log data can meet the actual needs.
[0098] Combination Figure 4 As shown, a visual flowchart for obtaining the first knowledge base is provided. The user performs a target operation on the application associated with the database. At this time, the application log and CDC log record the log data corresponding to the target timestamp, such as the first log data and the second log data. Subsequently, the first knowledge base can be obtained based on the first log data, the second log data, and the second knowledge base.
[0099] In one specific implementation method for determining the business domain involved in a target operation based on target log data, the target log data and a first prompt word are input into a third model to obtain the business domain output by the third model. The first prompt word is used to instruct the third model to generate the business domain involved in the target operation based on the target log data. Thus, by inputting the target log data and the first prompt word used to instruct the third model to generate the business domain based on the target log data into the third model to determine the business domain of the target operation, it is possible to accurately output the business scope that fits the actual scenario of the target operation based on the model's capabilities and log data, thereby improving the automation and intelligence of generating the business domain.
[0100] In a specific implementation method for generating the objects involved in a target operation and their fourth business function descriptions based on target log data and second basic knowledge, the target log data, second basic knowledge, and second prompt word are input into a fifth model. The fifth model outputs the objects involved in the target operation and their fourth business function descriptions. The second prompt word instructs the fifth model to generate the objects involved in the target operation and their fourth business function descriptions based on the target log data and second basic knowledge. Thus, by inputting the target log data, second basic knowledge, and the second prompt word instructing the model to generate the fourth business function descriptions based on these two types of information into the fifth model, the objects involved in the target operation and their fourth business function descriptions can be accurately obtained.
[0101] S301, Determine the first identifier in the metadata.
[0102] The first identifier is an identifier represented in abbreviated form in the metadata. The first identifier can be the identifier of a table (e.g., table name) and / or the identifier of a field (e.g., field name) in the metadata; that is, the table name and / or field name itself consists only of this one abbreviation, without any other additional characters. It can also be a partial identifier from the table identifier (e.g., table name) and / or the field identifier (e.g., field name). For example, hr, sys, etc. This first identifier can exist in the identifiers of multiple different tables and / or field identifiers. For example, the first identifier hr can exist in table name 1: hr_sys_1, or in table name 2: hr_sys_tablename1. It can also exist in the field name of a field in table 1: hr_employee_id (employee number).
[0103] In one implementation, the computing device analyzes the table identifiers and field identifiers in the metadata using natural language processing tools to identify a first identifier from the table identifiers and field identifiers in the metadata.
[0104] In some embodiments, the method further includes: determining a first target table in the database. Optionally, this step may be performed before step S302.
[0105] A target table is a table whose identifier includes the first identifier. For example, if the first identifier is 'hr', and a table's identifier includes 'hr', then that table is a target table. Alternatively, a table whose field identifiers include the first identifier is a target table. For example, if the first identifier is 'md_name', and a table's field identifier includes 'md_name', then that table is a target table. Another type of target table is a table whose identifier and field identifiers both include the first identifier. For example, if the first identifier is 'hr', and a table's identifier includes 'hr', and both the identifiers of its fields also include 'hr', then that table is a target table. The target table includes a first target table and a second target table that is different from the first target table. For instance, the first and second target tables are determined according to their order in the list. For example, the first K target tables in the list are considered the first target tables, and the M target tables after the Kth target table (excluding the Kth target table) are considered the second target tables. Here, K is greater than 1. The M target tables following the Kth target table (excluding the Kth target table) can be understood as some or all of the target tables following the Kth target table (excluding the Kth target table).
[0106] For example, K can be determined based on n, where n is the total number of items in the target table. For instance, if n is greater than the first quantity, K is a preset quantity; the first quantity can range from 45 to 55, and the preset quantity can range from 20 to 30. If n is greater than or equal to the second quantity and less than or equal to the first quantity, then K = 0.5n, and the second quantity can range from 5 to 15. If n is less than the second quantity, then K = n.
[0107] S302, based on the first knowledge base and the first target table in the database, determine the business function of the first identifier.
[0108] In a specific implementation method for determining the business function of a first identifier based on a first knowledge base and a first target table in a database, a third business function description is determined from the first knowledge base. This third business function description represents the business function description of the object corresponding to the first target table. Based on the third business function description, first basic knowledge of the domain involved in the third business function description is obtained from a second knowledge base. Based on the third business function description and the first basic knowledge, the business function of the first identifier is determined.
[0109] In one possible implementation, when the object corresponding to the first identifier is a table, the business function description of the object corresponding to the first target table is the business function description of the first target table, and the object corresponding to the first target table is the first target table.
[0110] The object corresponding to the first identifier can be understood as a table, meaning that the first identifier is the identifier within the identifiers of a table in the database (such as the first target table). In this scenario, the business function description of the first target table is used as the third business function description.
[0111] For example, if the first identifier is qw, the first target table 1 is named "qw_erp_model_info", and the third business function description can be a description of the business function of the first target table 1, such as a description related to managing model information, specifically including: basic model information, maintaining model version iteration records (such as historical version numbers, update times, descriptions of new / optimized functions), associated model call permission configuration data, model usage permissions, etc. If there are multiple first target tables, the third business function description is a collection of business function descriptions for multiple first target tables.
[0112] In another possible implementation, when the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is a table and a field, the business function description of the object corresponding to the first target table is the business function description of the first target table and the business function description of the field, and the object corresponding to the first target table is the first target table and the field.
[0113] The first identifier corresponding to a field can be understood as the identifier among the identifiers of the fields included in a table in the database (specifically, the first target table). The first identifier corresponding to both a table and a field can be understood as the identifier of the first target table and the identifier among the identifiers of the fields included in that table. In this scenario, the business function descriptions of the first target table and the fields are used as the third business function description.
[0114] For example, the first target table 1 is as described above: its table name is "qw_erp_model_info", and its business function is "managing model information". The first target table 1 includes multiple fields, such as "md_series", "md_name", and "md_type". If the first identifier is one of these fields, such as "md_type", then the third function description can include: managing model information and the type of the model. Correspondingly, if there are multiple first target tables, the third business function description is a collection of business function descriptions for the multiple first target tables, and the business function descriptions of the field included in those multiple first target tables.
[0115] In this way, the consistency of business semantics across multiple scenarios can be achieved.
[0116] In this embodiment, a third business function description is obtained from a first knowledge base. This description is then combined with the first basic knowledge of the relevant domain obtained from a second knowledge base to determine the business function of the first identifier. This ensures that the business function of the first identifier not only aligns with the actual business function of the first target table, or the first target table and its fields, but also has domain knowledge support, enabling the accurate and comprehensive generation of the first identifier's business function.
[0117] In one method for determining the specific implementation of the business function of a first identifier based on a third business function description and first basic knowledge, the third business function description, the first basic knowledge, and a third prompt word are input into a second model to obtain the business function of the first identifier output by the second model. The third prompt word is used to instruct the second model to generate the business function based on the third business function description and the first basic knowledge. Thus, by inputting the third business function description, the first basic knowledge, and the third prompt word used to instruct it to generate the business function based on these two types of information into the second model, the business function of the first identifier can be accurately obtained.
[0118] Combination Figure 5 The diagram illustrates a method for restoring metadata from a database. It defines the business function of a first identifier based on a first knowledge base, a second knowledge base, and a database (specifically, a first target table within the database). The diagram also shows how structured metadata for the first target table is determined based on the database (specifically, the metadata of the first target table within the database).
[0119] S303, based on the business function of the first identifier and the metadata of the first target table, restore the first identifier to the second identifier.
[0120] The second identifier is the complete form of the first identifier.
[0121] Optionally, the metadata of the target table includes: the identifier of the target table, the business function description of the target table, the identifiers of the fields included in the target table, the data type of the fields, whether the fields are not nullable, and the business function description of the fields.
[0122] Alternatively, the metadata of the target table can also include the dependencies between the table and other tables (which can be another target table or tables other than the target table). For example, target table 1 is a company information table, which includes the company names of Company 1 and Company 2. Target table 2 is an employee information table, which has foreign keys for associating with specific companies, such as Company 1 or Company 2, in the company information table. For example, if employee 1 is an employee of Company 1, then there is a dependency relationship between target table 1 and target table 2.
[0123] In some embodiments, the metadata of the first target table may be structured metadata of the first target table. In one implementation, the method further includes: performing structured processing on the metadata of the first target table to obtain structured metadata of the first target table. Subsequently, the structured metadata of the first target table can be used as the metadata of the first target table.
[0124] For example, the first target table includes Table 1 and Table 2.
[0125] The structured metadata for Table 1 is as follows: -**Table name**: `your_table_name1` - **Table Business Function Description:** Briefly describe the main purpose or stored content of this table. |Field Name|Type|Whether Not Null|Business Object|Business Function Description (Explanation / Purpose)| |----------|------|----------|----------|--------------| |field1|Type|Yes / No|Description of the business function of this field| |field2|Type|Yes / No|Description of the business function of this field| |...|...|...|...|...| -**This is a dependency relationship with Table 2** ... The structured metadata for Table 2 is as follows: -**Table name**: `your_table_name2` - **Table Business Function Description:** Briefly describe the main purpose or stored content of this table. |Field Name|Type|Whether Not Null|Business Object|Business Function Description (Explanation / Purpose)| |----------|------|----------|----------|--------------| |field1|Type|Yes / No|Description of the business function of this field| |field2|Type|Yes / No|Description of the business function of this field| |...|...|...|...|...| -**This is a dependency relationship with Table 1** ... In a specific implementation of structuring the metadata of a first target table to obtain structured metadata, the metadata of the first target table and a fourth prompt word are input into a fourth model, resulting in the output of structured metadata of the first target table from the fourth model. The fourth prompt word instructs the fourth model to generate structured metadata of the first target table based on its metadata. Thus, by transforming the discrete metadata of the first target table into structured metadata through the fourth model, the expression of structural information in the database is more effective.
[0126] Continue to combine Figure 5 As shown, after step S302, the first computing device restores the first identifier to the second identifier based on the business function of the first identifier and the metadata of the structured first target table, for example, corresponding to step S303 above.
[0127] As can be seen from steps S301-S303 above, the database metadata restoration method provided in this application embodiment constructs the business function of the first identifier based on the first target table and the first knowledge base (which describes the business functions of the tables in the database and the business functions of the fields included in the tables), assigning the first identifier relevant information at the actual business level; and the metadata of the first target table indicates the relevant information of the table and the fields included in the table at the database level. Based on this, and based on the business function of the first identifier and the metadata of the first target table, the first identifier is restored to its complete form as the second identifier, so that the restoration result not only conforms to the actual business but also fits the database structure design rules, solving the problem of difficulty in interpreting abbreviations, reducing data usage errors caused by misreading abbreviations, and improving the efficiency and accuracy of data abbreviation completion.
[0128] like Figure 6 As shown, this application embodiment provides a specific implementation method for restoring a first identifier to a second identifier (i.e., step S303) based on the business function of the first identifier and the metadata of the first target table, for example including the following steps: S3031-S3036 S3031, input the business function of the first identifier and the metadata of the first target table into the first model, and obtain at least two candidate identifiers output by the first model.
[0129] The candidate identifier is used to represent the full form of the predicted first identifier.
[0130] In one possible implementation, the business function of the first identifier and the metadata of the first target table are input into the first model to obtain at least two candidate identifiers output by the first model. This includes: inputting the business function of the first identifier, the metadata of the first target table, and a fifth prompt word into the first model to obtain at least two candidate identifiers output by the first model. The fifth prompt word is used to instruct the first model to generate at least two candidate identifiers based on the business function of the first identifier and the metadata of the first target table.
[0131] For example, the number of candidate identifiers can specifically be greater than 3. For instance, the fifth cue word is used to instruct the first model to generate 3 or more candidate identifiers based on the business functions of the first identifier and the metadata of the first target table.
[0132] S3032, determine the first business function description of the object corresponding to the first identifier. The first business function description is used to represent the predicted business function description of the object corresponding to the second target table when the candidate identifier is used as the identifier of the object corresponding to the second target table.
[0133] For example, when the object corresponding to the first identifier is a table, the business function description of the object corresponding to the second target table is the business function description of the second target table. It can be understood that the object corresponding to the second target table here is the second target table itself. For instance, if the first identifier is `hr`, and one of its candidate identifiers is `human_resource`, and if the first identifier is part of the name of the second target table 1, and the name of the second target table 1 is `hr_sys_1`, then replacing `hr` with `human_resource` in `hr_sys_1` yields `human_resource_sys_1`. Thus, the replaced identifier of the second target table is `human_resource_sys_1`. Subsequently, the business function description of the second target table 1 is determined based on `human_resource_sys_1`.
[0134] Based on this, in a specific implementation of determining the first business function description, the candidate identifier, the second target table, and the sixth prompt word are input into the sixth model to obtain the first business function description output by the sixth model. The sixth prompt word is used to instruct the sixth model to replace the first identifier in the identifier of the second target table with the candidate identifier, and to determine the first business function description based on the identifier after replacement in the second target table.
[0135] In another example, when the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is both a table and a field, the business function description of the object corresponding to the second target table is the business function description of the second target table and the business function description of that field. It can be understood that the object corresponding to the second target table here refers to both the second target table and its field. For example, the first identifier is part of the identifier "emp" in the identifier "emp_id" of field 1 in the second target table 1, and one candidate identifier is "employee". Then, replacing "emp" with "employee" in the identifier of field 1 yields "employee_id". Thus, the identifier of field 1 after replacement is "employee_id". Subsequently, based on "employee_id", the business function description of field 1 is determined, and the business function description of the second target table 1 also needs to be determined.
[0136] Based on this, in another specific implementation of determining the first business function description, the candidate identifier, the second target table, and the seventh prompt word are input into the sixth model to obtain the first business function description output by the sixth model. The seventh prompt word is used to instruct the sixth model to replace the first identifier in the identifier of the second target table with the candidate identifier, and to determine the business function description of the second target table and the business function description of the field based on the identifier after replacement in the second target table.
[0137] S3033, determine the semantic similarity between the first business function description and the second business function description, wherein the second business function description is used to represent the actual business function description of the object corresponding to the second target table.
[0138] Semantic similarity is used to indicate the semantic consistency between the description of the first business function and the description of the second business function.
[0139] For example, if the object corresponding to the first identifier is a table, the business function description of the object corresponding to the second target table is the actual business function description of the second target table. It can be understood that the object corresponding to the first target table here is the second target table.
[0140] In another example, when the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is both a table and a field, the business function description of the object corresponding to the second target table is the business function description of the second target table and the business function description of the field.
[0141] In some embodiments, the method further includes: determining a second business function description.
[0142] When the object corresponding to the first identifier is a table, in one specific implementation method for determining the second business function description, the second target table and the eighth prompt word are input into the seventh model to obtain the second business function description output by the seventh model. The eighth prompt word is used to instruct the seventh model to generate the actual business function description of the second target table based on the second target table, that is, the second business function description.
[0143] When the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is a table and a field, in one specific implementation method for determining the second business function description, the second target table and the ninth prompt word are input into the seventh model to obtain the second business function description output by the seventh model. The ninth prompt word is used to instruct the seventh model to generate the business function description of the second target table and the business function description of the field based on the second target table, which is the second business function description.
[0144] In another specific implementation method for determining the description of the second business function, if the description of the second business function is stored in the database, then the description of the second business function is directly obtained.
[0145] In a specific implementation of determining the semantic similarity between a first business function description and a second business function description, for each of at least two candidate identifiers, a first vector of the first business function description of the object corresponding to the first identifier and a second vector of the second business function description are determined, and the semantic similarity between the first vector and the second vector is calculated. In this way, the semantic similarity between the first business function description and the second business function description can be accurately determined.
[0146] It is understandable that for each candidate identifier, if there are multiple first business function descriptions and second business function descriptions of the object corresponding to the first identifier, then each candidate identifier can correspond to multiple semantic similarities.
[0147] S3034, Based on semantic similarity, determine the evaluation results of at least two candidate identifiers.
[0148] In one implementation, for each candidate identifier, if it has only one semantic similarity, the evaluation result is determined based on that semantic similarity. If it has multiple semantic similarities, a target semantic similarity is determined among the multiple semantic similarities, and the evaluation result of the candidate identifier is determined based on that target semantic similarity.
[0149] As an example, the target semantic similarity is the average semantic similarity of multiple semantic similarities. For instance, the average semantic similarity can be calculated based on the following formula:
[0150] Where P is the average semantic similarity, k is the number of semantic similarities, and i is the i-th semantic similarity among the k semantic similarities.
[0151] Another example is that the target semantic similarity is the maximum semantic similarity among multiple semantic similarities.
[0152] Another example is that the target semantic similarity is any one of multiple semantic similarities.
[0153] In this way, when multiple semantic similarities correspond to candidate identifiers, the target semantic similarity can be determined more flexibly based on various methods, thereby determining the evaluation result of the candidate identifier. Thus, each candidate identifier has a corresponding target semantic similarity.
[0154] In one implementation of an evaluation method for determining candidate identifiers based on target semantic similarity, the evaluation result can be represented by a score. For example, the target semantic similarity mentioned above can be mapped to a score as the evaluation result. The higher the target semantic similarity value, the higher the score.
[0155] Optionally, steps S3032-S3034 above are optional steps.
[0156] S3035, Based on the evaluation results of at least two candidate identifiers, determine a second identifier from at least two candidate identifiers.
[0157] The evaluation results are used to indicate the degree of fit of the candidate identifier as the full form of the first identifier.
[0158] In a specific implementation of determining a second identifier from at least two candidate identifiers based on the evaluation results of those candidate identifiers, a candidate identifier with a value greater than a preset evaluation result is determined from the evaluation results of the at least two candidate identifiers. The candidate identifier with the best evaluation result among the candidate identifiers with a value greater than the preset evaluation result is then selected as the second identifier. For example, if the evaluation result is a score, then the candidate identifier with the best evaluation result is the candidate identifier with the highest score.
[0159] For example, the preset evaluation result can be determined based on the actual situation, and it can be represented by a score (such as a numerical value). For instance, the preset evaluation result can be set to be greater than or equal to 0.7, such as 0.7, 0.75, or 0.8.
[0160] In this implementation, if none of the evaluation results of at least two candidate identifiers is greater than the preset evaluation result, then the restoration of the first identifier is determined to have failed.
[0161] In another specific implementation method for determining a second identifier from at least two candidate identifiers based on the evaluation results of at least two candidate identifiers, a candidate identifier that is greater than a preset evaluation result is determined from the evaluation results of at least two candidate identifiers. Any one of the candidate identifiers that is greater than the preset evaluation result is then used as the second identifier.
[0162] In another specific implementation of determining a second identifier from at least two candidate identifiers based on the evaluation results of at least two candidate identifiers, the candidate identifier with the best evaluation result among the at least two candidate identifiers is taken as the second identifier.
[0163] In this way, the second identifier can be determined more flexibly and accurately from at least two candidate identifiers based on multiple methods.
[0164] S3036, restore the first identifier to the second identifier.
[0165] In this embodiment, by determining the semantic similarity between the first business function description and the second business function description, the accuracy of the predicted business function description can be objectively measured using the actual business function description of the same target table. This provides a quantitative judgment standard for the suitability of the candidate identifier as the complete form of the first identifier, thereby providing a reliable business-level basis for the evaluation results of the candidate identifier. Thus, based on the evaluation results of at least two candidate identifiers, the determined second identifier is more accurate, further improving the efficiency and accuracy of metadata restoration. In another implementation method that restores the first identifier to the second identifier based on the business function of the first identifier and the metadata of the first target table, the business function of the first identifier and the metadata of the first target table are input into the first model to obtain a candidate identifier output by the first model. This candidate identifier is used as the second identifier, and the first identifier is restored to the second identifier. In this way, the second identifier can be determined directly and efficiently.
[0166] like Figure 7As shown in the illustration, this application provides a visual diagram illustrating the determination of a second identifier based on a first target table, a first knowledge base, and a second knowledge base. For example, it corresponds to the specific implementation of steps S301-S303 above. First, the metadata of the first target table is obtained. Second, the metadata of K first target tables is traversed, and a third business function description is determined from the first knowledge base based on the metadata of each target table in the first target table, until the metadata of all first target tables has been traversed. Then, the business function of the first identifier is determined based on the third business function description and the second knowledge base. Next, at least two candidate identifiers are determined based on the business function of the first identifier and the metadata of the first target tables. The evaluation results of the at least two candidate identifiers are then determined. Next, it is determined whether the evaluation results of the at least two candidate identifiers are greater than a preset evaluation result. If so, the candidate identifier with the best evaluation result is taken as the second identifier. If not, it indicates that there is no candidate identifier among the at least two candidate identifiers whose evaluation results are greater than the preset evaluation result, and the restoration of the first identifier is skipped.
[0167] In some embodiments, if there are multiple first identifiers, steps S301-S303 are performed for each first identifier until all first identifiers are restored to second identifiers. For example, the table name hr_sys_1 contains two first identifiers, hr and sys. For hr, its full form is human_resource. Therefore, human_resource_sys_1 can be its corresponding second identifier. For sys, its full form is system, so hr_system_1 can be its corresponding second identifier. Thus, for the table name hr_sys_1, there can be multiple table names after abbreviation completion, such as human_resource_sys_1, hr_system_1, or human_resource_system_1, thereby achieving the restoration of identifiers in abbreviation form.
[0168] Combination Figure 8 As shown in the illustration, this application provides a visual flowchart of another method for restoring metadata from a database. First, a knowledge base is constructed. Second, metadata is acquired, and a first identifier is identified from the identifiers in the metadata. Then, each first identifier is traversed, and the business function of each first identifier and the metadata of the first target table are determined. Furthermore, based on the business function of the first identifier and the metadata of the first target table, one or more candidate identifiers are determined, and then a second identifier is determined based on the one or more candidate identifiers. This process continues until all first identifiers have been traversed.
[0169] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0170] like Figure 9 As shown, this application embodiment provides another computing device 500. The computing device 500 includes a processor 510 and a memory 520 for storing processor-executable instructions. When the processor 510 is configured to execute instructions, the computing device 500 implements the database metadata restoration method described above. For example, the processor 510 may include a CPU. Specifically, when the CPU is configured to execute instructions, the computing device 500 implements the database metadata restoration method described above.
[0171] Figure 9 The computing device 500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0172] The computing device 500 is manifested in the form of a general-purpose computing device. The components of the computing device 500 may include, but are not limited to: one or more processors 510, memory 520, communication bus 540 connecting different system components (including memory 520 and processor 510), and communication interface 530.
[0173] Communication bus 540 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnection (PCI) bus.
[0174] Computing device 500 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computing device, including volatile and non-volatile media, removable and non-removable media.
[0175] Memory 520 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. The computing device may further include other removable / non-removable, volatile / non-volatile computer system storage media. Although Figure 9 Not shown, a disk drive may be provided for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and a removable non-volatile optical disk (e.g., a compact disc read-only memory, CD). ROM, Digital Video Disc Read-Only Memory (DVD) An optical disc drive that reads and writes to ROM or other optical media. In these cases, each drive can be connected to the communication bus 540 through one or more data media interfaces. The memory 520 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.
[0176] A program / utility having a set (at least one) of program modules can be stored in memory 520. Such program modules include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. The program modules typically perform the functions and / or methods described in the embodiments of this application.
[0177] The computing device 500 can also communicate with one or more external devices (e.g., keyboard, pointing device, display, etc.), and with one or more devices that enable a user to interact with the computing device, and / or with any device that enables the computing device to communicate with one or more other computing devices (e.g., network interface card, modem, etc.). This communication can be performed through the communication interface 530. Furthermore, the computing device 500 can also communicate through a network adapter (… Figure 9(Not shown) communicates with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet). The aforementioned network adapter can communicate with other modules of the computing device via the communication bus 540. It should be understood that, although... Figure 9 As not shown, the computing device 500 may be used with other hardware and / or software modules, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (RAID) systems, tape drives, and data backup storage systems.
[0178] The processor 510 executes various functional applications and data processing by running programs stored in the memory 520, such as implementing the methods described above in the embodiments of this application.
[0179] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the computing device 500. In other embodiments of this application, the computing device 500 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0180] It is understood that the aforementioned computing devices, etc., include hardware structures and / or software modules corresponding to the execution of each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the exemplary units and algorithm steps described in conjunction with the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in a hardware-driven or software-driven manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0181] This application embodiment can divide the above-mentioned computing device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0182] This application also provides a storage medium storing computer program instructions. When the computer program instructions are executed by a computing device, the computing device performs the method described above.
[0183] This application also provides a computer program product, which includes a computer program that, when at least one processor executes the computer program, causes the at least one processor to perform the methods described above in this application.
[0184] The computing device, storage medium, or computer program product provided in the embodiments of this application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0185] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0186] In the embodiments of this application, the functional units can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0187] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.
[0188] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for restoring metadata of a database, characterized in that, include: Identify a first identifier in the metadata, wherein the metadata is the metadata of a table in the database, and the first identifier is an identifier in the metadata represented in abbreviated form; Based on the first knowledge base and the first target table in the database, the business function of the first identifier is determined. The first knowledge base is used to describe the business functions of the tables in the database and the business functions of the fields included in the tables in the database. The identifier of the object corresponding to the first target table includes the first identifier. The object is a table and / or the fields included in the table. Based on the business function of the first identifier and the metadata of the first target table, the first identifier is restored to the second identifier, which is the complete form of the first identifier.
2. The method according to claim 1, characterized in that, The step of restoring the first identifier to the second identifier based on the business function of the first identifier and the metadata of the first target table includes: The business function of the first identifier and the metadata of the first target table are input into the first model to obtain at least two candidate identifiers output by the first model. The candidate identifiers are used to represent the complete form of the predicted first identifier. Based on the evaluation results of the at least two candidate identifiers, the second identifier is determined from the at least two candidate identifiers, wherein the evaluation results are used to indicate the degree of fit of the candidate identifier as an identifier in the complete form of the first identifier; Restore the first identifier to the second identifier.
3. The method according to claim 2, characterized in that, Before determining the second identifier from the at least two candidate identifiers based on the evaluation results of the at least two candidate identifiers, the method further includes: A first business function description of the object corresponding to the first identifier is determined. The first business function description is used to represent the predicted business function description of the object corresponding to the second target table when the candidate identifier is used as the identifier of the object corresponding to the second target table. The identifier of the object corresponding to the second target table includes the first identifier. The second target table is different from the first target table. Determine the semantic similarity between the first business function description and the second business function description, wherein the second business function description is used to represent the actual business function description of the object corresponding to the second target table; the semantic similarity is used to indicate the semantic consistency between the first business function description and the second business function description. The evaluation results of the at least two candidate identifiers are determined based on the semantic similarity.
4. The method according to claim 3, characterized in that, When the object corresponding to the first identifier is a table, the business function description of the object corresponding to the second target table is the business function description of the second target table, the actual business function description of the object corresponding to the second target table is the actual business function description of the second target table, and the object corresponding to the second target table is the second target table. When the object corresponding to the first identifier is a field, or when the object corresponding to the first identifier is a table and a field, the business function description of the object corresponding to the second target table is the business function description of the second target table and the business function description of the field, and the actual business function description of the object corresponding to the second target table is the actual business function description of the second target table and the actual business function description of the field. The object corresponding to the second target table is the second target table and the field.
5. The method according to any one of claims 1-4, characterized in that, The business function of determining the first identifier based on the first knowledge base and the first target table in the database includes: A third business function description is determined from the first knowledge base, wherein the third business function description is used to represent the business function description of the object corresponding to the first target table; Based on the third business function description, the first basic knowledge of the field involved in the third business function description is obtained from the second knowledge base. The second knowledge base is used to describe the basic knowledge of the field involved in different business function descriptions. Based on the third business function description and the first basic knowledge, the business function of the first identifier is determined.
6. The method according to claim 5, characterized in that, The business function for determining the first identifier based on the third business function description and the first basic knowledge includes: The third business function description and the first basic knowledge are input into the second model to obtain the business function of the first identifier output by the second model.
7. The method according to any one of claims 1-6, characterized in that, Before determining the business function of the first identifier based on the first knowledge base and the first target table in the database, the method further includes: Obtain target log data, which includes first log data and second log data. The first log data is used to indicate the execution records of the application associated with the database in response to the target operation, and the second log data is used to indicate the change records of the database in response to the target operation. The target operation is an operation performed by the user on the application associated with the database. Based on the target log data, the business domain involved in the target operation is determined; Based on the business domain, obtain the second basic knowledge of the business domain from the second knowledge base; Based on the target log data and the second basic knowledge, the objects involved in the target operation and the fourth business function description of the objects involved in the target operation are determined. The first knowledge base is generated based on the objects involved in the target operation and the fourth business function description of the objects involved in the target operation.
8. The method according to claim 7, characterized in that, The acquisition of target log data includes: Obtain the target timestamp when the target operation is performed; Obtain the application logs of the application and the change data capture (CDC) logs of the database; Based on the target timestamp, log data corresponding to the target timestamp is selected from the application logs and the CDC logs as the target log data.
9. The method according to claim 7 or 8, characterized in that, The step of determining the business domain involved in the target operation based on the target log data includes: The target log data is input into the third model to obtain the business domain output by the third model.
10. A computing device, characterized in that, It includes a processor and a memory; the processor is coupled to the memory; The memory is used to store instructions; The processor is configured to execute instructions stored in the memory to cause the computing device to perform the method as described in any one of claims 1-9.