Data query method, data query system, electronic equipment and medium
Through API calls and metadata management, data queries and data sources are decoupled, and efficient queries across multiple data sources are realized, solving the problem of inefficient query in the existing technology and improving query efficiency and flexibility.
Patent Information
- Application Number
- CN202411367700.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-03
AI Technical Summary
In the big data processing framework, when performing complex query operations across multiple different types of data sources, the existing technology lacks flexibility and efficiency, making it difficult to dynamically manage data sources and metadata, resulting in inefficient query.
Through API calls, decoupling data queries and underlying data sources are introduced, and data routing modules and metadata management devices are introduced. Users do not need to understand the specific data source type or internal structure, and can realize queries across multiple different types of data sources, and use metadata to manage abstract data source, optimize query process.
Improve the efficiency and flexibility of data query, and users can query multiple different types of data sources under a single interface, reducing direct dependence on data sources, and enhancing the stability and security of the system.
Smart Images

Figure CN119248864A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of big data and data processing technology, in particular to the field of data circulation management technology, and specifically to a data query method based on API call, a data query system, an electronic device, a computer-readable cache medium and a computer program product. Background Art
[0002] In today's data-intensive computing environment, the diversity and complexity of data sources make cross-data source data query a major technical challenge. Especially in big data processing frameworks, query engines are often required to perform complex query operations in multiple different types of data sources. Therefore, there is an urgent need for an efficient data query system and method that can dynamically manage data sources and metadata.
[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0004] The present disclosure provides a data query method based on API call, a data query system, an electronic device, a computer-readable cache medium and a computer program product.
[0005] According to one aspect of the present disclosure, there is provided a data query method based on API call, the method being used in a data query system, the data query system comprising: a data source for storing a data table; a gateway comprising a data routing module; a metadata management device for storing data assets and information of a callable data API, wherein the data assets are generated based on information of the data table and attribute information stored in the data source, and wherein the attribute information comprises the type of the data source, the data assets comprise metadata of the data table, and wherein the metadata management device further comprises a data API execution module; wherein the method comprises: in response to receiving a call request for a data API from a first user, the data routing module sending the call request to the data API execution module; in response to receiving the call request from the data routing module, based on the call request and information of the callable data API, the data API execution module determining information of data to be queried indicated by the call request; based on the information of the data to be queried, the data API execution module acquiring target metadata corresponding to the data to be queried from the metadata management device; and the data API execution module acquiring a target data table corresponding to the target metadata from the data source.
[0006] According to another aspect of the present disclosure, a data query system is provided, the data query system comprising: a data source for storing a data table; a gateway comprising a data routing module; a metadata management device for storing data assets and information of a callable data API, wherein the data assets are generated based on the information of the data table and attribute information stored in the data source, and wherein the attribute information comprises the type of the data source, the data assets comprise metadata of the data table, and wherein the metadata management device further comprises a data API execution module; wherein the data routing module is configured to: in response to receiving a call request for a data API from a first user, send the call request to the data API execution module; wherein the data API execution module is configured to: in response to receiving the call request from the data routing module, determine information of the data to be queried indicated by the call request based on the call request and the information of the callable data API; based on the information of the data to be queried, obtain target metadata corresponding to the data to be queried from the metadata management device; and obtain a target data table corresponding to the target metadata from the data source.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above method.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the above method.
[0009] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0010] According to one or more embodiments of the present disclosure, a data query method based on API calls is provided. Through API calls, data query is decoupled from the actual implementation of the underlying data source, and users do not need to understand the specific data source type or its internal structure. In addition, through API calls, users can query across multiple different types of data sources under a single interface, thereby improving the efficiency of data query.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0013] Figure 1 is a schematic diagram illustrating an example system in which the various methods described herein may be implemented according to an exemplary embodiment.
[0014] Figure 2 A flow chart of a data query method based on an API call according to an embodiment of the present disclosure is shown;
[0015] Figure 3 A flow chart showing a data query operation based on an API call that a data query system according to an embodiment of the present disclosure is configured to perform;
[0016] Figure 4 A structural block diagram of a data query system according to an embodiment of the present disclosure is shown; and
[0017] Figure 5 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0018] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0019] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0020] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0021] In the related technology, optimization is usually performed for specific data sources, and static configuration is used to access and manage different data sources. This method often lacks flexibility and efficiency when dealing with large-scale and diverse data sources, especially when data sources frequently change or dynamically expand. It is difficult to effectively adapt to the static configuration method. During the data query process, only data in a single data source can be queried in the API instruction, and data cannot be queried across multiple different types of data sources.
[0022] To solve the above problems, the present disclosure provides a data query method based on API calls. Through API calls, data query is decoupled from the actual implementation of the underlying data source, and users do not need to understand the specific data source type or its internal structure. In addition, through API calls, users can query across multiple different types of data sources under a single interface, thereby improving the efficiency of data query.
[0023] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0024] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0025] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the execution of a data query method based on an API call.
[0026] In some embodiments, server 120 may also provide other services or software applications that may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0027] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is an example of a system for implementing the methods described herein and is not intended to be limiting.
[0028] The user may use client devices 101, 102, 103, 104, 105 and / or 106 to perform the data query method based on the API call. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0029] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.
[0030] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0031] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0032] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0033] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0034] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0035] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.
[0036] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0037] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0038] Figure 2 A flow chart of a data query method based on API calls according to an embodiment of the present disclosure is shown. The method is used in a data query system, which includes: a data source for storing data tables; a gateway including a data routing module; a metadata management device for storing data assets and information of callable data APIs, wherein the data assets are generated based on the information of the data tables stored in the data source and attribute information, and wherein the attribute information includes the type of the data source, the data assets include metadata of the data tables, and wherein the metadata management device also includes a data API execution module.
[0039] like Figure 2 As shown, the data query method 200 based on API call includes:
[0040] Step S201: In response to receiving a call request for a data API from a first user, the data routing module sends the call request to the data API execution module;
[0041] Step S202: in response to receiving the call request from the data routing module, the data API execution module determines information of the to-be-queried data indicated by the call request based on the call request and information of the callable data API;
[0042] Step S203: Based on the information of the data to be queried, the data API execution module obtains target metadata corresponding to the data to be queried from the metadata management device; and
[0043] Step S204: The data API execution module obtains a target data table corresponding to the target metadata from the data source.
[0044] The data query system includes a data source, a gateway and a metadata management device. The metadata management device is used to store metadata and data asset information associated with the data source. Data assets are generated based on the data table information and attribute information of the data source. It is an integration operation performed on different types of data sources. On the basis of extracting the data table information of the data source (such as field information, source, domain and other key information), the configuration of attribute information is added. In some examples, tag information can be added so that in the process of retrieving and filtering data assets, retrieval and filtering can be performed according to the configured attribute information and / or tag information to improve the convenience of retrieval and filtering. The data API execution module is responsible for processing API calls and obtaining data tables from data sources based on metadata.
[0045] The metadata management device can be used to store and manage metadata related to data sources, including data table information, data source type, and other attribute information, such as data source connection information, access rights, etc. By managing metadata, the system can abstractly represent the data source, so that subsequent queries can be based on these metadata without directly contacting the data source itself.
[0046] In an example, the attribute information may also include row filtering information of the data source, desensitization rules used in preprocessing, and data partition information.
[0047] The above architecture of the data query system clearly separates metadata and actual data, realizes abstract management of data sources through metadata management devices, reduces the frequency of direct interaction with data sources, and optimizes the efficiency of data query.
[0048] When a user issues a data API call request, the data query system forwards the request to the data API execution module through the data routing module in the gateway. The data API execution module determines the data to be queried based on the request and obtains the corresponding metadata from the metadata management device. Finally, the data API execution module obtains the data table corresponding to the metadata from the data source. The data API execution module automatically determines the data source based on the information in the metadata management device and obtains the corresponding data, reducing the direct dependence on the data source and enhancing the flexibility of the system.
[0049] Through API calls, data query is decoupled from the actual implementation of the underlying data source, and users do not need to understand the specific data source type or its internal structure. In addition, through API calls, users can query across multiple different types of data sources under a single interface, improving the efficiency of data query.
[0050] According to some embodiments, the data query system also includes a query engine, and wherein method 200 also includes: determining, by the data API execution module, the type of the data to be queried; in response to determining that the type of the data to be queried is the first type, sending, by the data API execution module, the target metadata to the query engine; and in response to receiving the target metadata, obtaining, by the query engine, a target data table corresponding to the target metadata from the data source, and sending the target data table to the data API execution module.
[0051] According to some embodiments, the first type of data source comprises data assets.
[0052] Exemplarily, when the data to be queried is of the first type, such as data assets, the data API execution module sends the metadata to the query engine. The query engine obtains the corresponding target data table from the data source according to the metadata, and then returns the target data table to the data API execution module, and then returns it to the user to complete the data query process.
[0053] By introducing the query engine, the system can handle complex query operations more efficiently, especially in scenarios involving multiple data sources. The query engine can obtain the complete query path through the metadata management device, reducing the burden on the data API execution module.
[0054] According to some embodiments, the method 200 further includes: in response to determining that the type of the data to be queried is the second type, the data API execution module directly obtains a target data table corresponding to the target metadata from the data source.
[0055] According to some embodiments, the second type of data includes MYSQL, DORIS, and HIVE data tables.
[0056] When it is determined that the data to be queried is of the second type, the data API execution module does not go through the query engine, but directly obtains the data table corresponding to the metadata from the data source. Thus, the dependence on the query engine is reduced, so that the system can skip the query engine when facing simple and fast data queries and directly obtain data from the data source, further optimizing the query speed and system performance.
[0057] Therefore, by distinguishing different types of data, the data query system can flexibly adjust the query process according to the complexity of the query, thereby improving the response speed.
[0058] According to some embodiments, the data query system also includes a shared storage system, the metadata management device also includes a data API management module, the gateway also includes a data management module, and wherein method 200 also includes: in response to receiving a data API creation request and / or a data API deletion request from a second user, the data API management module updates the information of the callable data API to the data management module; and the data management module stores the updated information of the callable data API in the shared storage system.
[0059] Exemplarily, the shared storage system may be ETCD. A shared storage system and a data API management module are introduced to manage the creation and deletion of APIs. The data API management module stores the updated API information in the shared storage system for access by the data routing module.
[0060] By introducing a shared storage system and data API management module, the system can dynamically manage the life cycle of the API, realize the creation and deletion of the API, and ensure the consistency of the data API information in the whole system. The introduction of the shared storage system enables the system to have high concurrent access and high fault tolerance, and enhances the stability of the data API and the flexibility of management.
[0061] According to some embodiments, the call request includes user permission information of the first user, and the information of the callable data API also includes access permission information of the data indicated by the callable data API, and wherein method 200 also includes: the data routing module obtains the information of the callable data API from the shared storage system; and in response to receiving a call request for the data API from the first user, based on the call request, the user permission information and the access permission information, the data routing module determines whether the first user has permission to query the data to be queried, wherein the step of sending the call request to the data API execution module by the data routing module is performed in response to determining that the first user has permission to query the data to be queried.
[0062] The data API call request contains user permission information. The data routing module extracts the callable API and its permission information from the shared storage system, and verifies based on the user's permission information to determine whether the user has the right to query the requested data. If the user has the corresponding permission, the data routing module forwards the call request to the data API execution module.
[0063] The system ensures data security through a strict permission control mechanism, prevents unauthorized users from accessing sensitive data, and improves the security and compliance of the data query system. The permission verification process is completed at the gateway, reducing the burden on subsequent query execution modules and improving the query response speed of the entire system.
[0064] According to some embodiments, method 200 also includes: in response to receiving a call request for a data API from a first user, the data routing module updates the number of calls to the data API indicated in the call request; in response to determining that the number of calls to the data API is greater than or equal to a threshold, the data routing module abandons sending the call request to the data API execution module.
[0065] The data routing module tracks the number of calls to each API and determines whether to continue executing the request based on the number of calls and the set threshold. If the number of calls exceeds the threshold, the system will no longer process the call request.
[0066] By introducing a limit on the number of API calls, the system can effectively prevent a certain API from being frequently abused, reduce the consumption of system resources, and avoid performance problems caused by API overload. This mechanism enhances the stability of the system, especially in high-concurrency scenarios, and can protect the system from malicious calls.
[0067] Figure 3 A flow chart of a data query operation based on an API call that a data query system according to an embodiment of the present disclosure is configured to perform is shown.
[0068] like Figure 3 As shown, the API manager, i.e., the second user, submits a data API creation request and / or a data API deletion request to the data API management module in the metadata management device through the big data portal. In response to receiving the data API creation request and / or the data API deletion request from the second user, the data API management module updates the information of the callable data API to the data management module in the gateway. It can be understood that the data API management module is used to manage the update of the callable data API, and synchronize the updated information of the callable data API to the data management module in the gateway, so that the gateway obtains the latest information of the callable data API.
[0069] Furthermore, the data management module stores the updated information of the callable data API in the shared storage system, so that the data routing module can obtain the information of the callable data API from the shared storage system, thereby realizing the synchronization of the information of the callable data API between the data management module and the data routing module. Figure 3 etcd shown.
[0070] Therefore, when receiving a call request for the data API from the first user (ie, the API user), the data routing module sends the call request to the data API execution module.
[0071] In one example, the data routing module determines whether the first user (i.e., API user) has permission to query the data to be queried based on the call request, user permission information of the first user (i.e., API user), and access permission information of the data indicated by the callable data API, and after determining that the first user has permission to query the data to be queried, sends the call request to the data API execution module.
[0072] Therefore, a strict permission control mechanism is used to ensure data security, prevent unauthorized users from accessing sensitive data, and improve the security and compliance of the data query system. The permission verification process is completed at the gateway, which reduces the burden on subsequent query execution modules and improves the query response speed of the entire system.
[0073] In one example, after receiving a call request for a data API, the data routing module updates the number of calls to the data API indicated in the call request, and if it is determined that the number of calls to the data API is greater than or equal to a threshold, abandons sending the call request to the data API execution module.
[0074] Therefore, by introducing a limit on the number of API calls, the system can effectively prevent a certain API from being frequently abused, reduce the consumption of system resources, and avoid performance problems caused by API overload. This mechanism enhances the stability of the system, especially in high-concurrency scenarios, and can protect the system from malicious calls.
[0075] In response to receiving a call request from the data routing module, the data API execution module determines the information of the data to be queried indicated by the call request based on the call request and the information of the data API that can be called. Further, based on the information of the data to be queried, the data API execution module obtains the target metadata corresponding to the data to be queried from the metadata management device, and obtains the target data table corresponding to the target metadata from the data source.
[0076] Specifically, in response to determining that the type of data to be queried is the first type, that is, the API called by the first user is an API query based on data assets, the data API execution module sends the target metadata to the query engine; in response to receiving the target metadata, the query engine obtains the target data table corresponding to the target metadata from the data source, and sends the target data table to the data API execution module, and then forwards it to the first user, completing the data query process. In response to determining that the type of data to be queried is the second type, that is, the API called by the first user is an API query based on a data table, the data API execution module directly obtains the target data table corresponding to the target metadata from the data source, and then forwards it to the first user, completing the data query process.
[0077] According to another aspect of the present disclosure, a data query system is provided. Figure 4 As shown, the data query system 400 includes: a data source 401 for storing a data table; a gateway 402, including a data routing module 402-1; a metadata management device 403, for storing data assets and information of a callable data API, wherein the data assets are generated based on the information of the data table stored in the data source and attribute information, and wherein the attribute information includes the type of the data source, the data assets include the metadata of the data table, and wherein the metadata management device 403 also includes a data API execution module 403-1; wherein the data routing module 402-1 is configured to: in response to receiving A call request for a data API is received from a first user, and the call request is sent to the data API execution module 403-1; wherein the data API execution module 403-1 is configured to: in response to receiving the call request from the data routing module 402-1, determine the information of the data to be queried indicated by the call request based on the call request and the information of the callable data API; based on the information of the data to be queried, obtain the target metadata corresponding to the data to be queried from the metadata management device 403; and obtain the target data table corresponding to the target metadata from the data source 401.
[0078] The data query system 400 includes a data source 401, a gateway 402 and a metadata management device 403. The metadata management device 403 is used to store metadata and data asset information associated with the data source. Data assets are generated based on the data table information and attribute information of the data source. It is an integration operation performed on different types of data sources. On the basis of extracting the data table information of the data source (such as key information such as field information, source, and domain), the configuration of attribute information is added. In some examples, tag information can be added so that in the process of retrieving and filtering data assets, retrieval and filtering can be performed based on the configured attribute information and / or tag information to improve the convenience of retrieval and filtering. The data API execution module 403-1 is responsible for processing API calls and obtaining data tables from data sources based on metadata.
[0079] The metadata management device 403 can be used to store and manage metadata related to the data source, including data table information, data source type and other attribute information, such as data source connection information, access rights, etc. By managing metadata, the system can abstractly represent the data source, so that subsequent queries can be based on these metadata without directly contacting the data source itself.
[0080] In an example, the attribute information may also include row filtering information of the data source, desensitization rules used in preprocessing, and data partition information.
[0081] The above architecture of the data query system clearly separates metadata from actual data, implements abstract management of data sources through the metadata management device 403, reduces the frequency of direct interaction with the data source, and optimizes the efficiency of data query.
[0082] When a user issues a data API call request, the data query system 400 forwards the request to the data API execution module 403-1 through the data routing module 402-1 in the gateway. The data API execution module 403-1 determines the data to be queried based on the request and obtains the corresponding metadata from the metadata management device 403. Finally, the data API execution module 403-1 obtains the data table corresponding to the metadata from the data source. The data API execution module 403-1 automatically determines the data source based on the information in the metadata management device 403 and obtains the corresponding data, which reduces the direct dependence on the data source and enhances the flexibility of the system.
[0083] Through API calls, data query is decoupled from the actual implementation of the underlying data source, and users do not need to understand the specific data source type or its internal structure. In addition, through API calls, users can query across multiple different types of data sources under a single interface, improving the efficiency of data query.
[0084] According to some embodiments, the data query system 400 also includes a query engine, and wherein the data API execution module 403-1 is further configured to: determine the type of the data to be queried; and in response to determining that the type of the data to be queried is a first type, send the target metadata to the query engine; and wherein the query engine is configured to: in response to receiving the target metadata, obtain a target data table corresponding to the target metadata from the data source, and send the target data table to the data API execution module.
[0085] According to some embodiments, the first type of data source comprises data assets.
[0086] Exemplarily, when the data to be queried is of the first type, such as data assets, the data API execution module sends the metadata to the query engine. The query engine obtains the corresponding target data table from the data source according to the metadata, and then returns the target data table to the data API execution module, and then returns it to the user to complete the data query process.
[0087] By introducing the query engine, the system can handle complex query operations more efficiently, especially in scenarios involving multiple data sources. The query engine can obtain the complete query path through the metadata management device, reducing the burden on the data API execution module.
[0088] According to some embodiments, the data API execution module is further configured to: in response to determining that the type of the data to be queried is the second type, directly obtain a target data table corresponding to the target metadata from the data source.
[0089] According to some embodiments, the second type of data includes MYSQL, DORIS, and HIVE data tables.
[0090] When it is determined that the data to be queried is of the second type, the data API execution module does not go through the query engine, but directly obtains the data table corresponding to the metadata from the data source. Thus, the dependence on the query engine is reduced, so that the system can skip the query engine when facing simple and fast data queries and directly obtain data from the data source, further optimizing the query speed and system performance.
[0091] Therefore, by distinguishing different types of data, the data query system can flexibly adjust the query process according to the complexity of the query, thereby improving the response speed.
[0092] According to some embodiments, the data query system also includes a shared storage system, the metadata management device also includes a data API management module, the gateway also includes a data management module, and wherein the data API management module is configured to: in response to receiving a data API creation request and / or a data API deletion request from a second user, update the information of the callable data API to the data management module; and wherein the data management module is configured to: store the updated information of the callable data API in the shared storage system.
[0093] Exemplarily, the shared storage system may be ETCD. A shared storage system and a data API management module are introduced to manage the creation and deletion of APIs. The data API management module stores the updated API information in the shared storage system for access by the data routing module.
[0094] By introducing a shared storage system and data API management module, the system can dynamically manage the life cycle of the API, realize the creation and deletion of the API, and ensure the consistency of the data API information in the whole system. The introduction of the shared storage system enables the system to have high concurrent access and high fault tolerance, and enhances the stability of the data API and the flexibility of management.
[0095] According to some embodiments, the call request includes user permission information of the first user, and the information of the callable data API also includes access permission information of the data indicated by the callable data API, and wherein the data routing module is further configured to: obtain the information of the callable data API from the shared storage system; and in response to receiving a call request for the data API from the first user, determine whether the first user has permission to query the data to be queried based on the call request, the user permission information and the access permission information, wherein the step of sending the call request to the data API execution module is performed in response to determining that the first user has permission to query the data to be queried.
[0096] The data API call request contains user permission information. The data routing module extracts the callable API and its permission information from the shared storage system, and verifies based on the user's permission information to determine whether the user has the right to query the requested data. If the user has the corresponding permission, the data routing module forwards the call request to the data API execution module.
[0097] The system ensures data security through a strict permission control mechanism, prevents unauthorized users from accessing sensitive data, and improves the security and compliance of the data query system. The permission verification process is completed at the gateway, reducing the burden on subsequent query execution modules and improving the query response speed of the entire system.
[0098] According to some embodiments, the data routing module is further configured to: in response to receiving a call request for a data API from a first user, update the number of calls to the data API indicated in the call request; in response to determining that the number of calls to the data API is greater than or equal to a threshold, abandon sending the call request to the data API execution module.
[0099] The data routing module tracks the number of calls to each API and determines whether to continue executing the request based on the number of calls and the set threshold. If the number of calls exceeds the threshold, the system will no longer process the call request.
[0100] By introducing a limit on the number of API calls, the system can effectively prevent a certain API from being frequently abused, reduce the consumption of system resources, and avoid performance problems caused by API overload. This mechanism enhances the stability of the system, especially in high-concurrency scenarios, and can protect the system from malicious calls.
[0101] According to another aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the aforementioned method.
[0102] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is further provided, wherein the computer instructions are used to enable the computer to execute the aforementioned method.
[0103] According to another aspect of the present disclosure, a computer program product is also provided, including a computer program, wherein the computer program implements the aforementioned method when executed by a processor.
[0104] like Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0105] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, an output unit 507, a storage unit 508 and a communication unit 509. The input unit 506 can be any type of device that can input information to the electronic device 500. The input unit 506 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a trackpad, a trackball, a joystick, a microphone and / or a remote control. The output unit 507 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator and / or a printer. The storage unit 508 can include but is not limited to a disk, an optical disk. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as Bluetooth TM devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0106] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as a data query method based on an API call. For example, in some embodiments, the data query method based on an API call may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the data query method based on an API call described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform a data query method based on an API call by any other appropriate means (e.g., by means of firmware).
[0107] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0108] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0109] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0111] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0112] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be performed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document is not limited here.
[0114] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A data query method based on API call, the method is used in a data query system, the data query system comprising: Data source, used to store data tables; A gateway, including a data routing module; A metadata management device, used for storing information of data assets and callable data APIs, wherein the data assets are generated based on information of data tables and attribute information stored in the data source, and wherein the attribute information includes the type of the data source, and the data assets include metadata of the data tables, and wherein the metadata management device further includes a data API execution module; Wherein, the method comprises: In response to receiving a call request for a data API from a first user, the data routing module sends the call request to the data API execution module; In response to receiving the call request from the data routing module, the data API execution module determines information of the to-be-queried data indicated by the call request based on the call request and information of the callable data API; Based on the information of the data to be queried, the data API execution module acquires target metadata corresponding to the data to be queried from the metadata management device; and The data API execution module obtains a target data table corresponding to the target metadata from the data source.
2. The method according to claim 1, wherein: The data query system further includes a query engine, and wherein the method further includes: The data API execution module determines the type of the data to be queried; In response to determining that the type of the data to be queried is the first type, the data API execution module sends the target metadata to the query engine; and In response to receiving the target metadata, the query engine obtains a target data table corresponding to the target metadata from the data source, and sends the target data table to the data API execution module.
3. The method according to claim 2, further comprising: In response to determining that the type of the data to be queried is the second type, the data API execution module directly obtains a target data table corresponding to the target metadata from the data source.
4. The method according to any one of claims 1 to 3, wherein: The data query system further includes a shared storage system, the metadata management device further includes a data API management module, the gateway further includes a data management module, and wherein the method further includes: In response to receiving a data API creation request and / or a data API deletion request from a second user, the data API management module updates the information of the callable data API to the data management module; and The data management module stores the updated information of the callable data API in the shared storage system.
5. The method according to claim 4, wherein: The call request includes user authority information of the first user, and the information of the callable data API also includes access authority information of the data indicated by the callable data API, and the method further includes: The data routing module obtains information of callable data API from the shared storage system; and In response to receiving a call request for a data API from a first user, the data routing module determines whether the first user has permission to query the data to be queried based on the call request, the user permission information and the access permission information, wherein the step of sending the call request to the data API execution module by the data routing module is performed in response to determining that the first user has permission to query the data to be queried.
6. The method according to any one of claims 1 to 5, further comprising: In response to receiving a call request for a data API from a first user, the data routing module updates the number of calls of the data API indicated in the call request; In response to determining that the number of calls to the data API is greater than or equal to a threshold, the data routing module abandons sending the call request to the data API execution module.
7. The method according to claim 3, wherein: The second type of data includes MYSQL, DORIS, and HIVE data tables.
8. The method according to any one of claims 1 to 7, wherein: The first type of data source includes data assets.
9. A data query system, comprising: Data source, used to store data tables; A gateway, including a data routing module; A metadata management device, used for storing information of data assets and callable data APIs, wherein the data assets are generated based on information of data tables and attribute information stored in the data source, and wherein the attribute information includes the type of the data source, and the data assets include metadata of the data tables, and wherein the metadata management device further includes a data API execution module; Wherein, the data routing module is configured as follows: In response to receiving a call request for a data API from a first user, sending the call request to the data API execution module; Wherein, the data API execution module is configured as follows: In response to receiving the call request from the data routing module, based on the call request and information of the callable data API, determine information of the to-be-queried data indicated by the call request; Based on the information of the data to be queried, acquiring target metadata corresponding to the data to be queried from the metadata management device; and A target data table corresponding to the target metadata is acquired from the data source.
10. The data query system according to claim 9, wherein: The data query system also includes a query engine. And among them, The data API execution module is further configured to: Determine the type of the data to be queried; as well as In response to determining that the type of the data to be queried is the first type, sending the target metadata to the query engine; And wherein the query engine is configured to: In response to receiving the target metadata, a target data table corresponding to the target metadata is acquired from the data source, and the target data table is sent to the data API execution module.
11. The data query system according to claim 10, wherein: The data API execution module is further configured to: In response to determining that the type of the data to be queried is the second type, a target data table corresponding to the target metadata is directly acquired from the data source.
12. The data query system according to any one of claims 9 to 11, wherein: The data query system further includes a shared storage system, the metadata management device further includes a data API management module, and the gateway further includes a data management module. And wherein, the data API management module is configured as: In response to receiving a data API creation request and / or a data API deletion request from a second user, updating information of the callable data API to the data management module; And wherein, the data management module is configured as: The updated information of the callable data API is stored in the shared storage system.
13. The data query system according to claim 12, wherein: The call request includes user authority information of the first user, and the information of the callable data API also includes access authority information of the data indicated by the callable data API, and wherein the data routing module is further configured to: Acquire information of a callable data API from the shared storage system; and In response to receiving a call request for a data API from a first user, based on the call request, the user permission information and the access permission information, determining whether the first user has permission to query the data to be queried, wherein the step of sending the call request to the data API execution module is performed in response to determining that the first user has permission to query the data to be queried.
14. The data query system according to any one of claims 9 to 13, wherein: The data routing module is further configured to: In response to receiving a call request for the data API from the first user, updating the number of calls of the data API indicated in the call request; In response to determining that the number of calls to the data API is greater than or equal to a threshold, abandoning sending the call request to the data API execution module.
15. The data query system according to claim 11, wherein: The second type of data includes MYSQL, DORIS, and HIVE data tables.
16. The data query system according to any one of claims 9 to 14, wherein: The first type of data source includes data assets.
17. An electronic device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
