Data query methods, devices, storage media and electronic devices

By pre-building a database set of ambiguous fields, the difficulty of data querying when business metadata fields change is solved. It enables accurate querying of target data without modifying the other party's database, reducing workload and error risk, and improving the timeliness and accuracy of data query.

CN117493408BActive Publication Date: 2026-11-17QINGDAO HAIER TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210880218.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-11-17
Estimated Expiration
2042-07-25

AI Technical Summary

Technical Problem

When the values ​​of business metadata fields change, existing technologies require large-scale modifications to multiple business databases, resulting in a large workload, a high risk of errors, and delayed data updates.

Method used

A pre-built ambiguous field database set is used to perform data queries, avoiding modifications in the other database and directly calling the pre-built ambiguous field database set to query the target data.

Benefits of technology

When a data field in either the business database or the business metadata database changes, there is no need to modify the data in the other database. The target data can be queried directly by calling a pre-built set of ambiguous fields, which reduces workload and error risk and improves the timeliness and accuracy of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117493408B_ABST
    Figure CN117493408B_ABST
Patent Text Reader

Abstract

This application discloses a data query method, apparatus, storage medium, and electronic device, relating to the field of smart home / intelligent home technology. The data query method includes: upon receiving a data query request, obtaining a first field value corresponding to the query request; invoking a pre-built ambiguous field database set, and obtaining a second field value associated with the first field value and a data address parameter associated with the second field value from the ambiguous field database set; and querying target data matching the first field value and the second field value from the target database based on the data address parameter. Therefore, this application enables the querying of the corresponding target data directly by invoking the pre-built ambiguous field database set when a data field in either the business database or the business metadata database changes, without requiring corresponding data modifications to the other database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home / intelligent home technology, and more specifically, to a data query method, apparatus, storage medium, and electronic device. Background Technology

[0002] Metadata, also known as intermediary data or relay data, is data that describes data. It primarily describes data attributes and supports functions such as indicating storage location, historical data, resource lookup, and file records. Metadata is information about the organization of data, data domains, and their relationships; in short, metadata is data about data.

[0003] A database is a repository for organizing, storing, and managing data according to a data structure. It is a large collection of organized, shareable, and centrally managed data that is stored permanently on a computer.

[0004] In the existing solution, if the value of a business metadata field changes, in order to accurately query the data, the values ​​of both the historical data and the newly added data in the business database need to be changed to match the current value of the business metadata field.

[0005] However, a set of data often exists in multiple business databases, such as Elastic Search, MySQL, and ClickHouse. If existing data needs to be modified, corresponding modifications must be made in all of these business databases, resulting in a very large workload. Furthermore, modifying existing data requires new development, which is prone to errors, and necessitates scheduled testing and deployment, meaning the changes cannot take effect immediately. Summary of the Invention

[0006] This application provides a data query method, apparatus, storage medium, and electronic device to solve the technical problem that when performing data queries, if the value of existing business data changes, the corresponding metadata needs to be modified accordingly before the data query can be performed.

[0007] This application provides a data query method, including:

[0008] Upon receiving a data query request, obtain the value of the first field corresponding to the data query request;

[0009] Call the pre-built ambiguous field database set, and obtain the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set;

[0010] Based on the data address parameters, query the target database for target data that matches the first field value and the second field value;

[0011] The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values.

[0012] Alternatively, the first field value may include ambiguous business database field values, and the second field value may include ambiguous metadata field values.

[0013] According to the data query method provided in this application, before invoking the pre-built ambiguous field database set, the method further includes:

[0014] Iterate through the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database to obtain ambiguous metadata field values ​​and ambiguous business database field values ​​with different values ​​under the same field.

[0015] Determine the business database type, database information, table information, and field information associated with the ambiguous metadata field value and / or the ambiguous business database field value;

[0016] An ambiguous field database set is constructed based on the ambiguous metadata field values, the ambiguous business database field values, the business database type, the database information, the table information, and the field information.

[0017] According to the data query method provided in this application, the step of traversing the metadata field values ​​in the business metadata database and the business database field values ​​in the business databases associated with the business metadata database further includes:

[0018] Receive a first query statement input by the user, wherein the first query statement is used to query the metadata field value corresponding to the field in the data table of the business metadata database;

[0019] Parse the first query statement to obtain the data table and fields in the data table, and generate a second query statement based on the data table and fields in the data table. The second query statement is used to query the business database field value corresponding to the field in the data table in the business database.

[0020] Based on the first query statement and the second query statement, iterate through the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database.

[0021] According to the data query method provided in this application, the construction of the ambiguous field database set further includes:

[0022] Under the preset triggering conditions, determine the business metadata database and the array of ambiguous field values ​​matched by each business database associated with the business metadata database;

[0023] The ambiguous field database set is modified based on the ambiguous field value array.

[0024] According to the data query method provided in this application, the preset triggering conditions include the following situations:

[0025] If the detected time reaches the preset trigger time, it is determined that the preset trigger condition has been met; or,

[0026] If a change operation is detected in the business metadata database, it is determined that a preset trigger condition has been met; or,

[0027] If a change operation is detected in the business database, it is determined that a preset trigger condition has been met.

[0028] According to the data query method provided in this application, the process of constructing the ambiguous field database set further includes:

[0029] Upon receiving an ambiguous data change operation request sent by a preset management platform, an authorization check is performed on the ambiguous data change operation request;

[0030] If the ambiguous data change operation request passes the permission check, respond to the ambiguous data change operation request to perform a change operation on the ambiguous field database set.

[0031] According to the data query method provided in this application, after calling the pre-built ambiguous field database set, the method further includes:

[0032] Determine whether the ambiguous field database set includes the value of the first field;

[0033] If the ambiguous field database table set does not include the first field value, query the target database for target data that matches the first field value.

[0034] This application provides a data query device, including:

[0035] The first acquisition unit is used to acquire the value of the first field corresponding to the data query request when a data query request is received;

[0036] The second acquisition unit is used to call a pre-built ambiguous field database set and acquire the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set;

[0037] The query unit is used to query target data that matches the first field value and the second field value from the target database based on the data address parameter;

[0038] The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values.

[0039] Alternatively, the first field value may include ambiguous business database field values, and the second field value may include ambiguous metadata field values.

[0040] This application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data query method described above.

[0041] This application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data query method described above.

[0042] The data query method, apparatus, storage medium, and electronic device provided in this application, upon receiving a data query request, obtain the first field value corresponding to the query request; invoke a pre-built ambiguous field database set, and obtain the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set; and query the target data matching the first field value and the second field value from the target database based on the data address parameter. Thus, this application enables the query of the corresponding target data directly by invoking the pre-built ambiguous field database set when a data field in either the business database or the business metadata database changes, without requiring corresponding data modification. Attached Figure Description

[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0044] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 A schematic diagram of the hardware environment for the data query method provided in this application;

[0046] Figure 2 One of the flowcharts illustrating the data query method provided in this application;

[0047] Figure 3 The second flowchart illustrating the data query method provided in this application;

[0048] Figure 4 A schematic diagram of the prize drawing device provided in this application;

[0049] Figure 5 A schematic diagram of the electronic device provided in this application.

[0050] Figure label:

[0051] 101: Terminal equipment; 102: Server. Detailed Implementation

[0052] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0053] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0054] According to one aspect of the embodiments of this application, a data query method is provided. This data query method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. In this embodiment, Figure 1 This is a schematic diagram of the hardware environment for the data query method provided in this application. The data query method described above can be applied to, for example... Figure 1The hardware environment shown consists of terminal device 101 and server 102. Server 102 is connected to terminal device 101 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. It can set up a database on the server or independently of the server to provide data storage services for server 102. It can also be configured with cloud computing and / or edge computing services on the server or independently of the server to provide data processing services for server 102.

[0055] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. Terminal device 101 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0056] It's important to note that a database is a data repository, essentially a file system. Data is stored in a specific format, and users can perform CRUD operations on the data in the database. Specifically, databases store data in tables. Based on the data types specified by the table fields, we can insert rows of data into the table. Each row in the table is called a "record," and each record contains all the information in that row. Fields are smaller units than records, and a collection of fields makes up a record. Each field describes a certain characteristic of the document, i.e., a data item, and has a unique field identifier that can be recognized by a computer. The records in the field columns are the field values.

[0057] In practical applications, in order to gain a deeper understanding of the database's organizational structure, data metadata is used to define the structure of various objects in the database, such as the database name, table, column name, username, version name, etc.

[0058] Typically, the field values ​​in the metadata of data within the same table in the same database are the same as the field values ​​in the database. When querying data, one can directly query the database using the field values ​​in the database, or query the corresponding data in the database using the field values ​​in the metadata. Therefore, in order to achieve accurate data querying, if the field values ​​of the metadata fields change, the field values ​​of both historical and newly added data in the database need to be changed to match the current field values ​​in the metadata. Similarly, if the field values ​​in the database change, the corresponding field values ​​in the metadata need to be changed. However, this operation is very labor-intensive, and modifying existing field data requires manual execution of the corresponding development tasks, which is prone to errors, and the modified data cannot take effect in a timely manner.

[0059] The data query method proposed in this application aims to solve the technical problems existing in the existing solutions. It adopts a pre-built ambiguous field database set, so that when the data field of one of the business database and the business meta database changes, there is no need to modify the data of the other database. The target data can be queried directly by calling the pre-built ambiguous field dataset table.

[0060] Figure 2 A flowchart illustrating the data query method provided in this application is shown below. Figure 2 As shown, the method includes steps 201, 202 and 203.

[0061] Step 201: Upon receiving a data query request, obtain the value of the first field corresponding to the data query request;

[0062] Specifically, the data query method provided in this application is applicable to any system or smart terminal with data query functionality. This application uses a system with data query functionality as the execution subject for description.

[0063] In practical applications, data query sources include two types: one is to directly query data from the business database based on field values ​​in the business database, and the other is to indirectly query data from the business database based on field values ​​in the business metadata database. Both of these data query methods are query methods described in the prior art, and this invention will not elaborate on them further.

[0064] In this step, after receiving the data query request, the data query request is parsed to determine the value of the first field carried in the data query request, and then the subsequent data query steps are automatically executed based on the value of the first field.

[0065] Step 202: Invoke the pre-built ambiguous field database set, and obtain the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set.

[0066] The system with data query functionality in this application stores a pre-built ambiguous field database set. It should be noted that the ambiguous field database set is a collection of data recording the data mapping relationship between the business metadata database and the business database. In practical applications, this mapping relationship can be recorded in the form of a data table. For example, the information in the data table includes seven elements: ambiguous metadata field value, ambiguous business database field value, business database type, database information, table information, and field information. That is, each row records the business database type, database information, table information, and field information between a pair of ambiguous metadata field values ​​and ambiguous business database field values. Alternatively, in this embodiment, the data mapping relationship between the business metadata database and the business database can also be recorded in the form of a document. For example, mapping relationship 1: ambiguous metadata field value, ambiguous business database field value, business database type, database information, table information, and field information, thus forming the ambiguous field database set. Furthermore, the ambiguous field database set in this embodiment may also include other forms, which are not limited.

[0067] In this embodiment, the first field value and the second field value are field values ​​with different characters under the same field in the business database and the business metadata database. In other words, the ambiguous field database table in this application only records the data information of the relevant business metadata database and business database with different characters under the same field. That is, in this embodiment, the first field value includes the ambiguous metadata field value and the second field value includes the ambiguous business database field value; or, the first field value includes the ambiguous business database field value and the second field value includes the ambiguous metadata field value.

[0068] Specifically, the ambiguous field database set includes the following six primary key information: business database type, database information, table information, field information, ambiguous metadata field values, and ambiguous business database field values.

[0069] Ambiguous metadata field values ​​and ambiguous business database field values ​​refer to field values ​​with different characters in the same position under the same table location. For example, if the metadata field value is "Other" and the business database field value is "other" or "OTHER", then "Other" is the ambiguous metadata field value, and "other" and "OTHER" are the ambiguous business database field values.

[0070] Field information refers to the field identification information where ambiguous metadata field values ​​and ambiguous business database field values ​​are located. For example, "Other", "other", and "OTHER" are located in the "category" field.

[0071] Table information refers to the table identification information where ambiguous metadata field values ​​and ambiguous business database field values ​​are located. For example, "Other", "other", and "OTHER" are located in the "category" field, and the "category" field is located in the "tmp-all" table.

[0072] Database information refers to the identification information of the database where ambiguous metadata field values ​​and ambiguous business database field values ​​are located. For example, "Other", "other", and "OTHER" are located in the "category" field, the "category" field is located in the "tmp-all" table, and the "tmp-all" table is located in the database with the ID "production environment".

[0073] The business database type refers to the type of business database that stores ambiguous metadata field values ​​and ambiguous business database field values. For example, a database with the ID "production environment" belongs to the Click House type database, which is a columnar storage database. In addition, the database type in this application can also be Elastic Search, MongoDB, MySQL, Click House, etc.

[0074] Specifically, the data address parameter refers to the parameter that can be used to query relevant data in the business database. In this application, the data address parameter includes the ambiguous field database set and the first field value, the second field value, and the business database type, database information, table information, and field information associated with them.

[0075] The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values; or, the first field value includes ambiguous business database field values, and the second field value includes ambiguous metadata field values. That is, if the data corresponding to the data query request is an ambiguous metadata field value, the corresponding ambiguous business database field value is retrieved from the ambiguous field database set; if the data corresponding to the data query request is an ambiguous business database field value, the corresponding ambiguous metadata field value is retrieved from the ambiguous field database set.

[0076] Step 203: Based on the data address parameters, query the target database for target data that matches the first field value and the second field value;

[0077] In this step, the target database refers to the database that matches the business database type and database information. After the target database is found, the table information and field information that match the first field value and the second field value are returned to the target database along with the first field value and the second field value to perform target data query.

[0078] Therefore, the data query method provided in this application does not require modification of existing field values ​​during the data query process. Instead, it achieves the query of the target data by querying relevant data in the ambiguous field database set in real time.

[0079] In another embodiment, reference Figure 3 , Figure 3 This is a second flowchart illustrating the data query method provided by the present invention, as shown below. Figure 3 As shown: Before calling the pre-built ambiguous field database table, the following steps are also included:

[0080] Step 2021: Traverse the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database to obtain ambiguous metadata field values ​​and ambiguous business database field values ​​with different values ​​under the same field.

[0081] Specifically, it iterates through the field information and its values ​​of each table under the same database information of the same business database type. During the iteration, if the field values ​​of the field information under the same database information of the same business database type are different, it identifies the ambiguous metadata field values ​​and ambiguous business database field values.

[0082] It should also be noted that in practical applications, there may be two or more business database field values ​​that match one business field value, or two or more business database field values ​​that match one business database field value. In this step, only business field values ​​whose business field values ​​differ from the field values ​​in the business database field values ​​are identified.

[0083] In other words, the ambiguous business database field value that matches the ambiguous metadata field value in this application may be only one, or it may include two or more. Similarly, the ambiguous metadata field value that matches the ambiguous business database field value may be only one, or it may include two or more.

[0084] Furthermore, in another embodiment, in order to improve the accuracy of query results for metadata field values ​​and business database field values, this embodiment specifically includes the following steps:

[0085] Receive a first query statement input by the user, wherein the first query statement is used to query the metadata field value corresponding to the field in the data table of the business metadata database;

[0086] Parse the first query statement to obtain the data table and fields in the data table, and generate a second query statement based on the data table and fields in the data table. The second query statement is used to query the business database field value corresponding to the field in the data table in the business database.

[0087] Based on the first query statement and the second query statement, iterate through the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database.

[0088] Specifically, the first query statement is generated based on the query parameters configured by the user. These parameters mainly include: data table information from the business metadata database and field information from the database. Therefore, the first query statement can iterate through and query the field values ​​in the corresponding fields of the corresponding data table.

[0089] In this step, since there may be more than one database associated with the metadata database, in order to reduce repetitive manual work and avoid data omissions due to manual editing, this embodiment adopts a method to automatically generate a second query statement for the business database based on the relevant configuration parameters in the first query statement. Thus, the corresponding second query statement is automatically configured accurately based on the data table and fields in the data table in the first query statement, so that the query objects between the first query statement and the second query statement are always consistent, thereby ensuring that ambiguous metadata field values ​​and ambiguous business database field values ​​are accurately retrieved.

[0090] In addition, the process steps for querying the database based on the query statement in this embodiment are the same as those in the prior art, and will not be described in detail here.

[0091] Step 2022: Determine the business database type, database information, table information, and field information associated with the ambiguous metadata field value and / or the ambiguous business database field value;

[0092] After all data has been traversed, the ambiguous metadata field values ​​and ambiguous business database field values ​​are identified. Since metadata defines various object structures in the database, such as database names, tables, column names, usernames, and version names, the business database type, database information, table information, and field information associated with the ambiguous metadata field values ​​recorded in the business database can be read. Furthermore, the business database type, database information, table information, and field information associated with the ambiguous metadata field values ​​recorded in the business metadata database can also be read directly. This invention does not impose any limitations on this.

[0093] Additionally, it should be noted that the ambiguous metadata field values ​​and ambiguous business database field values ​​under the same business database type, the same database information, the same table information, and the same field information in the same field information may be in a one-to-one relationship, or they may be in a one-to-many or many-to-one relationship. The number and characters of the ambiguous metadata field values ​​and ambiguous business database field values ​​can be flexibly set based on the actual situation.

[0094] Step 2023: Construct an ambiguous field database set based on the ambiguous metadata field value, the ambiguous business database field value, the business database type, the database information, the table information, and the field information.

[0095] In this step, the data mapping relationship between the business metadata database and the business database can be recorded in the form of a data table. For example, the information in the data table includes seven elements: ambiguous metadata field value, ambiguous business database field value, business database type, database information, table information, and field information. That is, each row records the business database type, database information, table information, and field information between a pair of ambiguous metadata field values ​​and ambiguous business database field values. Alternatively, in this embodiment, the data mapping relationship between the business metadata database and the business database can also be recorded in the form of a document. For example, mapping relationship 1: ambiguous metadata field value, ambiguous business database field value, business database type, database information, table information, and field information, thus forming an ambiguous field database set. In addition, the ambiguous field database set in this embodiment may also include other forms, which are not limited.

[0096] Based on the above embodiments, after step 2022, the method further includes:

[0097] Determine whether the ambiguous field database set includes the value of the first field;

[0098] If the first field value is not included in the ambiguous field database set, the target data matching the first field value is queried from the target database.

[0099] In this step, if the value of the first field is not included in the ambiguous field database set, it indicates that the value of the first field has not changed, and a query can be performed directly in the target database.

[0100] Specifically, if the first field value is a business database field value, the data is directly queried from the business database; if the first field value is a business metadata database field value, the data is indirectly queried from the business database based on the field value in the business metadata database. Both of these data query methods are query methods described in the prior art, and this invention will not elaborate on them further.

[0101] The data query method provided in this application, by pre-constructing an ambiguous field database set between the business metadata database and the business database, enables the query of the corresponding target data by simply calling the pre-constructed ambiguous field database set when a data field in either the business database or the business metadata database changes, without needing to modify the data in the other database.

[0102] Based on the above embodiments, after step 2022, the method further includes:

[0103] Under the preset triggering conditions, determine the business metadata database and the array of ambiguous field values ​​matched by each business database associated with the business metadata database;

[0104] The ambiguous field database set is modified based on the ambiguous field value array.

[0105] Specifically, the preset trigger conditions refer to the pre-set conditions that automatically trigger the traversal and matching query of the business metadata database and the business databases associated with the business metadata database.

[0106] The ambiguous field value array refers to an array consisting of ambiguous metadata field values, ambiguous business database field values, and their related business database types, database information, table information, and field information. Therefore, when a field value in the business metadata database changes, only the pre-established ambiguous field database table needs to be modified according to the ambiguous field value array; no changes are required in the other database to achieve subsequent data queries.

[0107] In order to reduce the workload of determining the array of ambiguous field values ​​and speed up the processing in this step, this application traverses and queries the database logs of the business metadata database and the database logs of each business database associated with the business metadata database. The database logs record content that updates the database, such as additions, deletions, and modifications within the database.

[0108] If a field value modification operation is found based on a query of the database log, a second query is performed on the corresponding business database and business metadata database based on the field value data corresponding to the data modification operation recorded in the database log, thereby determining the corresponding array of ambiguous field values.

[0109] After determining the array of ambiguous field values, the ambiguous field database table is traversed and queried. After finding the business database type, database information, table information, and field information that are consistent with the array of ambiguous field values, the original ambiguous metadata field values ​​and / or the original ambiguous business database field values ​​corresponding to the consistent business database type, database information, table information, and field information in the ambiguous field database table are modified to the ambiguous metadata field values ​​and / or the ambiguous business database field values ​​recorded in the array of ambiguous field values.

[0110] If no matching business database type, database information, table information, and field information are found in the ambiguous field value array in the ambiguous field database, the relevant content recorded in the ambiguous field value array will be added to the ambiguous field database.

[0111] It is easy to understand that in practical applications, there may be changes to existing data in the business database and business metadata database, such as changes in capitalization, addition of underscores to values, etc. In addition, there may be cases of adding or deleting data. In order to improve the accuracy of data query through the ambiguous field database table, after the ambiguous field database table is constructed, the business metadata database and the business database associated with the business metadata database are periodically traversed and matched based on preset trigger conditions.

[0112] The preset trigger conditions include the following situations:

[0113] If the detected time reaches the preset trigger time, it is determined that the preset trigger condition has been met; or,

[0114] If a change operation is detected in the business metadata database, it is determined that a preset trigger condition has been met; or,

[0115] If a change operation is detected in the business database, it is determined that a preset trigger condition has been met.

[0116] Specifically, the preset trigger time refers to the pre-set time for performing traversal matching queries, such as 10 PM on Sundays every week or 8 AM at the beginning of each month.

[0117] In addition, this application can monitor the data query operation interface of the business metadata database and the business database. Specifically, it can monitor the interface call information. After monitoring the relevant interface call request, it can traverse and query the data in the business metadata database and the business database, or traverse and query the database logs related to the business database and the business metadata database. If the relevant change operation is found, it can be determined that the preset trigger condition has been met.

[0118] The data query method provided in this application improves the accuracy of data queries through the ambiguous field database set by periodically modifying the ambiguous field database set according to preset trigger conditions, thereby ensuring that the information in the ambiguous field database set is consistent with the information in the business metadata database and the business database.

[0119] Based on the above embodiments, after step 2022, the method further includes:

[0120] Upon receiving an ambiguous data change operation request sent by a preset management platform, an authorization check is performed on the ambiguous data change operation request;

[0121] If the ambiguous data change operation request passes the permission check, respond to the ambiguous data change operation request to perform a change operation on the ambiguous field database set.

[0122] The preset management platform refers to the device that allows modification of information recorded in the ambiguous field database set. Users can log in to the preset management platform to perform real-time management operations such as adding, deleting, modifying, and querying information in the ambiguous field database set. For example, they can directly view the currently cached ambiguous field information through the preset management platform. If data is found to be missing in the ambiguous field database set, the platform can proactively add new ambiguous metadata field values, ambiguous business database field values, and related information. If data redundancy is found, the platform can proactively delete corrected ambiguous metadata field values, ambiguous business database field values, and related information. If data record errors are found, the platform can proactively modify the changed ambiguous metadata field values, ambiguous business database field values, and related information. This allows the preset management platform to maintain the accuracy of the data in the ambiguous field database set in real time. Specifically, in practical applications, in addition to automatically modifying the ambiguous field database set based on preset trigger conditions, it can also passively perform corresponding modification operations based on ambiguous data modification requests sent by users through the preset management platform.

[0123] In this application, to prevent the ambiguous field database set from being arbitrarily modified by users and thus losing its credibility, this step involves performing permission checks on the request initiator corresponding to the ambiguous data change operation request after receiving the request. The request initiator is only responded to if it passes the permission check.

[0124] In addition, to prevent data query operations from failing due to calls to the ambiguous field database set when modifying the ambiguous field database set, upon receiving an ambiguous data modification request, it checks whether there is currently a request to call the ambiguous field database set. If no such request exists, the ambiguous data modification request is deemed to have passed the permission check.

[0125] Therefore, the data query method provided in this application can not only automatically modify the ambiguous field database set based on preset trigger conditions, but also passively perform corresponding modification operations according to the ambiguous data modification operation requests sent by users based on preset management platforms. The data modification methods in the ambiguous field database set are flexible, and when modification operations are performed based on preset management platforms, permission checks are performed on the ambiguous data modification operation requests, which not only ensures the accuracy of information in the ambiguous field database, but also ensures the successful execution of data query operations.

[0126] Based on any of the above embodiments Figure 4 A schematic diagram of the data query device provided in this application is shown below. Figure 4 As shown, the device includes:

[0127] The first acquisition unit 410 is used to acquire the value of the first field corresponding to the data query request when a data query request is received;

[0128] The second acquisition unit 420 is used to call a pre-built ambiguous field database set and acquire the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set;

[0129] Query unit 430 is used to query target data that matches the first field value and the second field value from the target database based on the data address parameter;

[0130] The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values.

[0131] Alternatively, the first field value may include ambiguous business database field values, and the second field value may include ambiguous metadata field values.

[0132] The data query apparatus provided in this application, upon receiving a data query request, obtains the first field value corresponding to the query request; calls a pre-built ambiguous field database set and obtains the second field value associated with the first field value and the data address parameter associated with the second field value from the ambiguous field database set; and queries the target data matching the first field value and the second field value from the target database based on the data address parameter. Thus, this application enables the querying of the corresponding target data directly by calling the pre-built ambiguous field database set when data fields change, without requiring corresponding data modification.

[0133] Based on any of the above embodiments, according to the data query device provided in this application, the second acquisition unit 420 is further configured to: traverse the metadata field values ​​in the business metadata database and the business database field values ​​in the business databases associated with the business metadata database, and acquire ambiguous metadata field values ​​and ambiguous business database field values ​​with different field values ​​under the same field; determine the business database type, database information, table information and field information associated with the ambiguous metadata field value and / or the ambiguous business database field value; and construct an ambiguous field database table based on the ambiguous metadata field value, the ambiguous business database field value, the business database type, the database information, the table information and the field information.

[0134] Based on any of the above embodiments, according to the data query device provided in this application, the second acquisition unit 420 is further configured to: determine the business metadata database and the array of ambiguous field values ​​matched by each business database associated with the business metadata database when a preset trigger condition is met; and perform a modification operation on the ambiguous field database set based on the array of ambiguous field values.

[0135] Based on any of the above embodiments, according to the data query apparatus provided in this application, the second acquisition unit 420 is further configured to: receive a first query statement input by a user, wherein the first query statement is used to query the metadata field value corresponding to a field in a data table in a business metadata database; parse the first query statement to obtain the data table and the fields in the data table in the first query statement, and generate a second query statement based on the data table and the fields in the data table, wherein the second query statement is used to query the business database field value corresponding to the field in the data table in the business database; and traverse each metadata field value in the business metadata database and the business database field values ​​in each business database associated with the business metadata database based on the first query statement and the second query statement.

[0136] Based on any of the above embodiments, according to the data query device provided in this application, the second acquisition unit 420 is further configured to: determine that a preset trigger condition has been met when the time is detected to have reached a preset trigger time; or, determine that a preset trigger condition has been met when a change operation of the business element database is detected; or, determine that a preset trigger condition has been met when a change operation of the business database is detected.

[0137] Based on any of the above embodiments, according to the data query apparatus provided in this application, the second acquisition unit 420 is further configured to: determine whether the ambiguous field database set includes the first field value; and if the ambiguous field database set does not include the first field value, query target data matching the first field value from the target database.

[0138] Based on any of the above embodiments, Figure 5 A schematic diagram of the structure of the electronic device provided in this application, such as Figure 5 As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communications bus 540. The processor 510 can call logical commands stored in the memory 530 to execute the following methods:

[0139] Upon receiving a data query request, the system retrieves the first field value corresponding to the data query request; it then calls a pre-built ambiguous field database set and retrieves the second field value associated with the first field value and the data address parameter associated with the second field value from the ambiguous field database set; based on the data address parameter, it queries the target database for target data that matches the first field value and the second field value; wherein the first field value includes an ambiguous metadata field value and the second field value includes an ambiguous business database field value; or, the first field value includes an ambiguous business database field value and the second field value includes an ambiguous metadata field value.

[0140] Furthermore, the logical commands in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several commands to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0141] The processor in the electronic device provided in this application embodiment can call logical instructions in the memory to implement the above method. Its specific implementation method is the same as the aforementioned method implementation method and can achieve the same beneficial effects, which will not be repeated here.

[0142] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments.

[0143] The specific implementation method is the same as the aforementioned method implementation method and can achieve the same beneficial effects, so it will not be repeated here.

[0144] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.

[0145] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0146] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A data query method, characterized in that, include: Upon receiving a data query request, obtain the value of the first field corresponding to the data query request; Call the pre-built ambiguous field database set, and obtain the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set; Based on the data address parameters, query the target database for target data that matches the first field value and the second field value; The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values. Alternatively, the first field value may include ambiguous business database field values, and the second field value may include ambiguous metadata field values; The ambiguous metadata field value and the ambiguous business database field value are different field values ​​under the same field in the business database associated with the business metadata database; the data address parameter includes the business database type, database information, table information and field information associated with the ambiguous metadata field value and / or the ambiguous business database field value.

2. The data query method according to claim 1, characterized in that, Before invoking the pre-built ambiguous field database set, the following is also included: Iterate through the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database to obtain the ambiguous metadata field values ​​and the ambiguous business database field values; An ambiguous field database set is constructed based on the ambiguous metadata field values, the ambiguous business database field values, the business database type, the database information, the table information, and the field information.

3. The data query method according to claim 2, characterized in that, The process of traversing the metadata field values ​​in the business metadata database and the business database field values ​​in the business databases associated with the business metadata database also includes: Receive a first query statement input by the user, wherein the first query statement is used to query the metadata field value corresponding to the field in the data table of the business metadata database; Parse the first query statement to obtain the data table and fields in the data table, and generate a second query statement based on the data table and fields in the data table. The second query statement is used to query the business database field value corresponding to the field in the data table in the business database. Based on the first query statement and the second query statement, iterate through the values ​​of each metadata field in the business metadata database and the values ​​of the business database fields in each business database associated with the business metadata database.

4. The data query method according to claim 2, characterized in that, Building an ambiguous field database set, which then includes: Under the preset triggering conditions, determine the business metadata database and the array of ambiguous field values ​​matched by each business database associated with the business metadata database; The ambiguous field database set is modified based on the ambiguous field value array.

5. The data query method according to claim 4, characterized in that, The preset triggering conditions include the following situations: If the time detected reaches the preset trigger time, it is determined that the preset trigger condition has been met; or, If a change operation is detected in the business metadata database, it is determined that a preset trigger condition has been met; or, If a change operation is detected in the business database, it is determined that a preset trigger condition has been met.

6. The data query method according to claim 2, characterized in that, The process of constructing the ambiguous field database set then includes: Upon receiving an ambiguous data change operation request sent by a preset management platform, an authorization check is performed on the ambiguous data change operation request; If the ambiguous data change operation request passes the permission check, respond to the ambiguous data change operation request to perform a change operation on the ambiguous field database set.

7. The data query method according to claim 1, characterized in that, Following the invocation of the pre-built ambiguous field database set, the following is also included: Determine whether the ambiguous field database set includes the value of the first field; If the first field value is not included in the ambiguous field database set, the target data matching the first field value is queried from the target database.

8. A data query device, characterized in that, include: The first acquisition unit is used to acquire the value of the first field corresponding to the data query request when a data query request is received; The second acquisition unit is used to call a pre-built ambiguous field database set and acquire the second field value associated with the first field value and the data address parameter associated with the second field value in the ambiguous field database set; The query unit is used to query target data that matches the first field value and the second field value from the target database based on the data address parameter; The first field value includes ambiguous metadata field values, and the second field value includes ambiguous business database field values. Alternatively, the first field value may include ambiguous business database field values, and the second field value may include ambiguous metadata field values; The ambiguous metadata field value and the ambiguous business database field value are different field values ​​under the same field in the business database associated with the business metadata database; the data address parameter includes the business database type, database information, table information and field information associated with the ambiguous metadata field value and / or the ambiguous business database field value.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the data query method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data service method and device

    CN111209319A