Dynamic interface calling method and device based on multiple data sources and storage medium

By configuring multiple data sources parameters and generating dynamic interfaces, the problem of cumbersome multi-data source configuration management in traditional interface development is solved, and flexibility and scalability are improved, reducing development costs.

CN119003595APending Publication Date: 2024-11-22中国邮政储蓄银行股份有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411153972.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In traditional interface development, the configuration and management of multiple data sources are cumbersome and lack of flexibility, which increases the time cost of development and maintenance, and the flexibility and scalability of the system are limited.

Method used

By configuring multiple data sources in the system, obtaining common interfaces, and dynamically generating target interfaces based on the data source router, unified calls to multiple data sources are realized, reducing the need for manual writing and configuring code.

Benefits of technology

It simplifies the interface development process, improves the flexibility and scalability of the system, reduces the workload and possibility of errors of developers, and solves the cumbersome configuration and management problems of multi-data source interface development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003595A_ABST
    Figure CN119003595A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic interface calling method and device based on multiple data sources and a storage medium, according to the method, parameter configuration is conducted on the multiple data sources in a system, a universal interface is obtained, the universal interface is an interface capable of calling the multiple different data sources at the same time, and the data sources comprise relation sources and / or non-relation sources; a target request is obtained, the target request is a request for querying target data, the target data is stored in at least one database table, and one database table is a data source; according to the target request and based on a data source router, determining a target data source for storing the target data; and dynamically generating a target interface based on the target request, the universal interface and the target data source, and calling the target data source based on the target interface to query target data in the target data source. According to the method, the interface development process is simplified, interface codes of multiple data sources do not need to be manually written and configured through dynamic interface generation, and the workload of developers is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data source interface generation, and in particular to a dynamic interface calling method based on multiple data sources, a dynamic interface calling device based on multiple data sources, a computer-readable storage medium, and an electronic device. Background Art

[0002] With the advent of the era of big data, the visualization data scenarios brought by massive data are increasing day by day. With the exponential growth of data volume, the visualization operation dashboard came into being. However, in the face of complex scenarios, the dashboard data scenarios are ever-changing. Different data sources and different data scenarios lead to ever-changing interfaces.

[0003] In traditional interface development, the configuration and management of multiple data sources is a tedious task. Developers need to manually write and configure interface codes for multiple data sources, which increases the complexity and workload of development. Interfaces can usually only operate on a fixed data source. When an application needs to access multiple data sources, additional interface code needs to be written to adapt to different data sources. This limits the flexibility and scalability of the system. In addition, independent interface code needs to be written for each data source, which increases the time cost of development and maintenance. When an application needs to access multiple data sources, developers need to spend more time writing and maintaining interface code. Summary of the invention

[0004] The main purpose of the present application is to provide a dynamic interface calling method based on multiple data sources, a dynamic interface calling device based on multiple data sources, a computer-readable storage medium and an electronic device, so as to at least solve the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces.

[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a dynamic interface calling method based on multiple data sources is provided, including: configuring parameters of multiple data sources in the system, and obtaining a general interface, the general interface is an interface that can call multiple different data sources at the same time, and the data sources include relational sources and / or non-relational sources; obtaining a target request, the target request is a request to query target data, the target data is stored in at least one database table, and one database table is a data source; according to the target request and based on a data source router, determining a target data source storing the target data; based on the target request, the general interface and the target data source, dynamically generating a target interface, and calling the target data source based on the target interface to query the target data in the target data source.

[0006] Optionally, parameter configuration is performed on multiple data sources in the system, including: obtaining connection information of each of the data sources, the connection information including at least: the database table type of the data source, the address of the data source, the user name with permission to access the data source, and the access password of the data source; storing the connection information of all the data sources in a configuration file or a configuration database table, so as to perform parameter configuration on all the data sources in the system.

[0007] Optionally, obtaining a general interface includes: defining input parameters of the general interface and output parameters of the general interface, the input parameters of the general interface including at least the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface including at least the data type of the output data of the general interface; obtaining the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on an interface description language.

[0008] Optionally, determining the target data source storing the target data according to the target request and based on a data source router includes: determining request data of the target request according to the target request, the request data including at least: a business type of the target request, a user identity of the target request, and a geographic location of the target request; determining parameter information of the target request according to the target request, the parameter information including at least: a request backend address corresponding to the target request, a request header parameter corresponding to the target request; determining the corresponding target data source storing the target data based on the data source router according to the parameter information and the request data of the target request.

[0009] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: obtaining a first mapping relationship, the first mapping relationship representing a mapping relationship between a business request and a data source; obtaining a second mapping relationship, the second mapping relationship representing a mapping relationship between the business request and an input interface code of a universal interface; obtaining a third mapping relationship, the third mapping relationship representing a mapping relationship between the data source and an output interface code of the universal interface; and dynamically generating a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

[0010] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: according to interface parameters of the universal interface and the target data source, using a target engine to identify the target data source; according to interface parameters of the universal interface, the target request and the target data source, using a code generator to dynamically generate interface code adapted to the target data source; according to the interface code adapted to the target data source, the target interface is dynamically generated.

[0011] Optionally, calling the target data source based on the target interface to query the target data in the target data source includes: inputting interface input data that can be recognized by the target interface according to the target request; calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0012] According to another aspect of the present application, a dynamic interface calling device based on multiple data sources is provided, comprising: a first processing unit, used to perform parameter configuration on multiple data sources in the system, and obtain a general interface, wherein the general interface is an interface that can simultaneously call multiple different data sources, and the data sources include relational sources and / or non-relational sources; an acquisition unit, used to obtain a target request, wherein the target request is a request to query target data, and the target data is stored in at least one database table, and one database table is a data source; a determination unit, used to determine a target data source storing the target data according to the target request and based on a data source router; a second processing unit, used to dynamically generate a target interface based on the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0013] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the dynamic interface calling methods based on multiple data sources.

[0014] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the dynamic interface calling methods based on multiple data sources.

[0015] Applying the technical solution of the present application, the above-mentioned dynamic interface calling method based on multiple data sources first configures parameters for multiple data sources in the system, and obtains a general interface, which is an interface that can call multiple different data sources at the same time, and the data sources include relational sources and / or non-relational sources; obtains a target request, which is a request to query target data, and the target data is stored in at least one database table, and one database table is a data source; according to the target request and based on the data source router, determines the target data source storing the target data; based on the target request, the general interface and the target data source, dynamically generates a target interface, and calls the target data source based on the target interface to query the target data in the target data source. This method simplifies the interface development process, and through dynamic interface generation, there is no need to manually write and configure the interface code of multiple data sources, which reduces the workload of developers and the possibility of errors, and solves the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 A hardware structure block diagram of a mobile terminal for executing a dynamic interface calling method based on multiple data sources provided in an embodiment of the present application is shown;

[0018] Figure 2 A schematic diagram of a flow chart of a dynamic interface calling method based on multiple data sources provided according to an embodiment of the present application is shown;

[0019] Figure 3 A structural block diagram of a dynamic interface calling device based on multiple data sources provided according to an embodiment of the present application is shown.

[0020] The above drawings include the following reference numerals:

[0021] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION

[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] As introduced in the background technology, in traditional interface development, the configuration and management of multiple data sources is a cumbersome task. Developers need to manually write and configure the interface code of multiple data sources, which increases the complexity and workload of development. In traditional interface development, the interface can usually only operate on a fixed data source. When an application needs to access multiple data sources, additional interface code needs to be written to adapt to different data sources. This limits the flexibility and scalability of the system. In traditional interface development, independent interface code needs to be written for each data source, which increases the time cost of development and maintenance. When an application needs to access multiple data sources, developers need to spend more time writing and maintaining interface code. In order to solve the problems of cumbersome configuration and management, lack of flexibility and high time cost in the development of multiple data source interfaces in the prior art, the embodiments of the present application provide a dynamic interface calling method based on multiple data sources, a dynamic interface calling device based on multiple data sources, a computer-readable storage medium and an electronic device.

[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0027] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal of a dynamic interface calling method based on multiple data sources according to an embodiment of the present invention. Figure 1As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0028] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the dynamic interface calling method based on multiple data sources in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0029] In this embodiment, a dynamic interface calling method based on multiple data sources is provided and runs on a mobile terminal, a computer terminal or a similar computing device. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0030] Figure 2FIG. 1 is a flow chart of a dynamic interface calling method based on multiple data sources according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0031] Step S201, configuring parameters of multiple data sources in the system and obtaining a general interface, where the general interface is an interface that can simultaneously call multiple different data sources, where the data sources include relational sources and / or non-relational sources;

[0032] Specifically, a relational source is a database table storing a small amount of data, and a non-relational source is a database table storing a large amount of data.

[0033] In some instances, data sources include Elastic Search, postgresql, myasl clickhouse, etc.

[0034] Among them, parameter configuration of multiple data sources in the system includes the following steps:

[0035] Step S2011, obtaining connection information of each of the above data sources, wherein the above connection information at least includes: the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source, and the access password of the above data source;

[0036] Step S2012: storing the connection information of all the above data sources into a configuration file or a configuration database table, so as to perform parameter configuration on all the above data sources in the above system.

[0037] Specifically, this allows the configuration of parameters for multiple data sources, which can then automatically generate interface codes that adapt to multiple data sources based on the different parameters of each data source. This eliminates the need for developers to manually write and maintain a large amount of interface code, greatly reducing development workload and time costs.

[0038] In some instances, connection information of multiple data sources is configured in the system, including database type, database connection information, driver, address, user name, password, etc. Such configuration information may be stored in a configuration file, or managed using a database table or other means.

[0039] Some other examples also include: creating a data source manager for managing multiple data sources. The data source manager can be a singleton object responsible for operations such as loading data source configuration and creating data source connections.

[0040] Wherein, obtaining the general interface includes the following steps:

[0041] Step S301, defining input parameters of the general interface and output parameters of the general interface, wherein the input parameters of the general interface at least include the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface at least include the data type of the output data of the general interface;

[0042] Step S302: acquiring the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on the interface description language.

[0043] Specifically, through the dynamic interface generation technology, interface codes adapted to multiple data sources can be automatically generated according to the interface definition and the results of data source routing.

[0044] In some instances, the input parameters and output results of the interface are defined, including the interface name, parameter types, return type, etc. The interface definition can be standardized and managed using an interface description language (IDL) or other methods.

[0045] In other instances, according to business needs, write the implementation code of the data interface. In the code, obtain the current data source to be used through the data source manager, and then use the data source to perform data operations. You can use the ORM framework or native SQL statements to perform database operations.

[0046] Step S202, obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source;

[0047] Specifically, in traditional interface development, the configuration and management of multiple data sources are cumbersome, and the flexibility of the system is limited. However, the above steps can dynamically select which data source to use based on the request parameters or other conditions through dynamic data source routing technology. The system can automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0048] Step S203, determining a target data source storing the target data according to the target request and based on a data source router;

[0049] Specifically, through dynamic data source routing and interface generation technology, it is possible to automatically generate interfaces that adapt to multiple data sources according to needs during runtime.

[0050] Wherein, according to the target request and based on the data source router, determining the target data source storing the target data includes the following steps:

[0051] Step S2031, determining request data of the target request according to the target request, the request data at least including: the service type of the target request, the user identity of the target request and the geographical location of the target request;

[0052] Step S2032, determining parameter information of the target request according to the target request, the parameter information at least including: a request backend address corresponding to the target request and a request header parameter corresponding to the target request;

[0053] Step S2033: Determine the corresponding target data source storing the target data based on the data source router according to the parameter information of the target request and the request data.

[0054] Specifically, by implementing a data source router, the data source to be used is dynamically selected based on the request parameters or other conditions. This dynamic data source routing technology enables the system to automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0055] In some instances, by implementing a data source routing function, the data source to be used is dynamically selected based on the request parameters (including the address of the front-end request backend, the parameters of the request header, the parameters in the path, etc.) or other conditions. The data source can be selected based on the business type of the request, the user identity, the geographical location, etc. The data source routing rules can be defined using a policy mode or a configuration file.

[0056] Step S204: dynamically generate a target interface based on the target request, the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0057] Specifically, through dynamic interface generation and multi-data source management technology, the interface development process is simplified and the flexibility and scalability of the system are improved. These advantages make interface development more efficient and flexible, and bring convenience to the development and maintenance of application programs.

[0058] The target interface is dynamically generated based on the target request, the general interface and the target data source, including the following steps:

[0059] Step S401, obtaining a first mapping relationship, where the first mapping relationship represents a mapping relationship between a business request and a data source;

[0060] Step S402, obtaining a second mapping relationship, wherein the second mapping relationship represents a mapping relationship between the service request and an input interface code of the universal interface;

[0061] Step S403, obtaining a third mapping relationship, wherein the third mapping relationship represents a mapping relationship between the data source and the output interface code of the universal interface;

[0062] Step S404: dynamically generate a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the general interface and the target data source.

[0063] Specifically, through the results of interface definition and data source routing, interface codes that adapt to multiple data sources are dynamically generated. This interface generation technology can automatically generate corresponding interface codes according to different data sources, reducing the workload and time cost of developers.

[0064] The target interface is dynamically generated based on the target request, the general interface and the target data source, including the following steps:

[0065] Step S501, identifying the target data source using a target engine according to the interface parameters of the general interface and the target data source;

[0066] Step S502, dynamically generating an interface code adapted to the target data source using a code generator according to the interface parameters of the general interface, the target request and the target data source;

[0067] Step S503: dynamically generate the target interface according to the interface code adapted to the target data source.

[0068] Specifically, by automatically generating interface codes and dynamic data source routing technology, this embodiment can simplify the interface development process and reduce cumbersome configuration and management work. At the same time, the system can automatically select the appropriate data source according to actual needs, thereby improving development efficiency and system response speed.

[0069] In some instances, interface codes that adapt to multiple data sources are dynamically generated based on the interface definition and the data source routing results. A template engine or a code generator can be used to implement the generation of interface codes. The generated interface code can include operations such as connection, query, and update of the data source.

[0070] The step of calling the target data source based on the target interface to query the target data in the target data source includes the following steps:

[0071] Step S601, inputting interface input data recognizable by the target interface according to the target request;

[0072] Step S602: calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0073] Specifically, through dynamic data source routing and interface generation technology, interfaces that adapt to multiple data sources are automatically generated according to requirements during runtime. This embodiment simplifies the interface development process and improves the flexibility and efficiency of the system.

[0074] In some instances, the generated interface is called in the application, parameters are passed in according to actual needs, and the results returned by the interface are obtained. During the interface call process, the data source router selects the appropriate data source for data operations according to the configured rules.

[0075] In the configuration file of the application, configure the rules for switching data sources. You can specify the default data source and switch the data source according to different conditions. For example, you can configure a certain interface to use a specific data source, or switch the data source according to the requested URL path.

[0076] In addition, the above-mentioned embodiments use dynamic data source routing and interface generation technology to dynamically select data sources according to actual needs, and automatically generate interface codes that adapt to multiple data sources, thereby improving the flexibility and scalability of the system. By automatically generating interface codes, the time cost of interface development and maintenance is reduced, and the development efficiency and system response speed are improved. Through the dynamic interface generation method, the interface development process is simplified, the flexibility and efficiency of the system are improved, and the workload and time cost of developers are reduced. The cumbersome configuration and management problems of multiple data sources in traditional interface development are solved. Through dynamic data source routing and interface generation technology, interfaces that adapt to multiple data sources are automatically generated according to needs at runtime, which improves the efficiency and flexibility of interface development.

[0077] The above-mentioned dynamic interface calling method based on multiple data sources of the present application first configures parameters of multiple data sources in the system and obtains a general interface, which is an interface that can call multiple different data sources at the same time, and the data sources include relational sources and / or non-relational sources; obtains a target request, which is a request to query target data, and the target data is stored in at least one database table, and one database table is a data source; according to the target request and based on the data source router, determines the target data source storing the target data; based on the target request, the general interface and the target data source, dynamically generates a target interface, and calls the target data source based on the target interface to query the target data in the target data source. This method simplifies the interface development process, and through dynamic interface generation, there is no need to manually write and configure the interface code of multiple data sources, which reduces the workload of developers and the possibility of errors, and solves the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces.

[0078] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0079] The embodiment of the present application also provides a dynamic interface calling device based on multiple data sources. It should be noted that the dynamic interface calling device based on multiple data sources of the embodiment of the present application can be used to execute the dynamic interface calling method based on multiple data sources provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0080] The following introduces a dynamic interface calling device based on multiple data sources provided in an embodiment of the present application.

[0081] Figure 3 Schematic diagram of a dynamic interface calling device based on multiple data sources according to an embodiment of the present application. Figure 3As shown, the device includes: a first processing unit 10, an acquisition unit 20, a determination unit 30 and a second processing unit 40, the first processing unit 10 is used to perform parameter configuration on multiple data sources in the system and obtain a general interface, the general interface is an interface that can call multiple different data sources at the same time, and the data sources include relational sources and / or non-relational sources; the acquisition unit 20 is used to obtain a target request, the target request is a request to query target data, the target data is stored in at least one database table, and one database table is a data source; the determination unit 30 is used to determine the target data source storing the target data according to the target request and based on the data source router; the second processing unit 40 is used to dynamically generate a target interface based on the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0082] The above-mentioned dynamic interface calling device based on multiple data sources of the present application includes: a first processing unit, an acquisition unit, a determination unit, and a second processing unit. The first processing unit is used to configure parameters of multiple data sources in the system and obtain a general interface. The general interface is an interface that can call multiple different data sources at the same time. The data source includes a relational source and / or a non-relational source; the acquisition unit is used to obtain a target request. The target request is a request to query target data. The target data is stored in at least one database table, and one database table is a data source; the determination unit is used to determine the target data source storing the target data according to the target request and based on the data source router; the second processing unit is used to dynamically generate a target interface based on the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source. The device simplifies the interface development process. Through dynamic interface generation, there is no need to manually write and configure the interface code of multiple data sources, which reduces the workload of developers and the possibility of errors, and solves the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces.

[0083] In some instances, the first processing unit includes a first acquisition module and a first storage module, the first acquisition module is used to obtain the connection information of each of the above data sources, the above connection information at least includes: the first storage module is used for the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source and the access password of the above data source; the connection information of all the above data sources is stored in a configuration file or a configuration database table to configure the parameters of all the above data sources in the above system. In this way, the parameters of multiple data sources can be configured, and the interface code adapted to multiple data sources can be automatically generated according to the different parameters of each data source in the future, without the need for developers to manually write and maintain a large amount of interface code, which greatly reduces the development workload and time cost.

[0084] In some examples, the first processing unit includes a first definition module and a second acquisition module, the first definition module is used to define the input parameters of the general interface and the output parameters of the general interface, the input parameters of the general interface at least include the name of the general interface, the data type of the input data of the general interface, and the output parameters of the general interface at least include the data type of the output data of the general interface; the second acquisition module is used to acquire the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on the interface description language. Through the dynamic interface generation technology, the interface code adapted to multiple data sources can be automatically generated according to the results of interface definition and data source routing.

[0085] In some instances, the determination unit includes a first determination module, a second determination module, and a third determination module. The first determination module is used to determine the request data of the target request according to the target request, and the request data at least includes: the business type of the target request, the user identity of the target request, and the geographical location of the target request; the second determination module is used to determine the parameter information of the target request according to the target request, and the parameter information at least includes: the request background address corresponding to the target request and the request header parameter corresponding to the target request; the third determination module is used to determine the corresponding target data source storing the target data based on the data source router according to the parameter information and the request data of the target request. This dynamic data source routing technology enables the system to automatically select a suitable data source according to actual needs, thereby improving the flexibility and scalability of the system.

[0086] In some examples, the second processing unit includes a third acquisition module, a fourth acquisition module, a fifth acquisition module and a first processing module, the third acquisition module is used to acquire a first mapping relationship, the first mapping relationship represents the mapping relationship between the business request and the data source; the fourth acquisition module is used to acquire a second mapping relationship, the second mapping relationship represents the mapping relationship between the business request and the input interface code of the universal interface; the fifth acquisition module is used to acquire a third mapping relationship, the third mapping relationship represents the mapping relationship between the data source and the output interface code of the universal interface; the first processing module is used to dynamically generate a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source. This interface generation technology can automatically generate corresponding interface codes according to different data sources, reducing the workload and time cost of developers.

[0087] In some instances, the second processing unit includes a first adoption module, a second adoption module and a second processing module, the first adoption module is used to identify the above-mentioned target data source by adopting a target engine according to the interface parameters of the above-mentioned general interface and the above-mentioned target data source; the second adoption module is used to dynamically generate an interface code adapted to the above-mentioned target data source by adopting a code generator according to the interface parameters of the above-mentioned general interface, the above-mentioned target request and the above-mentioned target data source; the second processing module is used to dynamically generate the above-mentioned target interface according to the above-mentioned interface code adapted to the above-mentioned target data source.

[0088] In some instances, the second processing unit includes a first input module and a third processing module, the first input module is used to input interface input data that can be recognized by the above-mentioned target interface according to the above-mentioned target request; the third processing module is used to call the above-mentioned target interface according to the above-mentioned interface input data, so that the above-mentioned target interface calls the above-mentioned target data source to query the above-mentioned target data in the above-mentioned target data source, and return the above-mentioned target data to the client.

[0089] The dynamic interface calling device based on multiple data sources includes a processor and a memory, wherein the first processing module unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.

[0090] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to solve the problems of cumbersome configuration and management, lack of flexibility and high time cost in the development of multiple data source interfaces in the prior art.

[0091] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0092] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the dynamic interface calling method based on multiple data sources.

[0093] Specifically, the dynamic interface calling method based on multiple data sources includes:

[0094] Step S201, configuring parameters of multiple data sources in the system and obtaining a general interface, where the general interface is an interface that can simultaneously call multiple different data sources, where the data sources include relational sources and / or non-relational sources;

[0095] Specifically, a relational source is a database table storing a small amount of data, and a non-relational source is a database table storing a large amount of data.

[0096] Step S202, obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source;

[0097] Specifically, in traditional interface development, the configuration and management of multiple data sources are cumbersome, and the flexibility of the system is limited. However, the above steps can dynamically select which data source to use based on the request parameters or other conditions through dynamic data source routing technology. The system can automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0098] Step S203, determining a target data source storing the target data according to the target request and based on a data source router;

[0099] Specifically, through dynamic data source routing and interface generation technology, it is possible to automatically generate interfaces that adapt to multiple data sources according to needs during runtime.

[0100] Step S204: dynamically generate a target interface based on the target request, the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0101] Specifically, through dynamic interface generation and multi-data source management technology, the interface development process is simplified and the flexibility and scalability of the system are improved. These advantages make interface development more efficient and flexible, and bring convenience to the development and maintenance of application programs.

[0102] Optionally, parameter configuration is performed on multiple data sources in the system, including: obtaining connection information of each of the above data sources, the above connection information at least including: the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source, and the access password of the above data source; storing the connection information of all the above data sources in a configuration file or a configuration database table, so as to perform parameter configuration on all the above data sources in the above system.

[0103] Optionally, obtaining a general interface includes: defining input parameters of the general interface and output parameters of the general interface, the input parameters of the general interface at least including the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface at least including the data type of the output data of the general interface; obtaining the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on an interface description language.

[0104] Optionally, according to the target request and based on the data source router, determining the target data source storing the target data includes: according to the target request, determining the request data of the target request, the request data at least including: the business type of the target request, the user identity of the target request and the geographic location of the target request; according to the target request, determining the parameter information of the target request, the parameter information at least including: the request backend address corresponding to the target request, the request header parameters corresponding to the target request; according to the parameter information and the request data of the target request, based on the data source router, determining the corresponding target data source storing the target data.

[0105] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: obtaining a first mapping relationship, wherein the first mapping relationship represents a mapping relationship between a business request and a data source; obtaining a second mapping relationship, wherein the second mapping relationship represents a mapping relationship between the business request and an input interface code of the universal interface; obtaining a third mapping relationship, wherein the third mapping relationship represents a mapping relationship between the data source and an output interface code of the universal interface; and dynamically generating a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

[0106] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: according to the interface parameters of the universal interface and the target data source, a target engine is used to identify the target data source; according to the interface parameters of the universal interface, the target request and the target data source, an interface code adapted to the target data source is dynamically generated by a code generator; according to the interface code adapted to the target data source, the target interface is dynamically generated.

[0107] Optionally, calling the target data source based on the target interface to query the target data in the target data source includes: inputting interface input data recognizable by the target interface according to the target request; calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0108] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the program executes the dynamic interface calling method based on multiple data sources when running.

[0109] Specifically, the dynamic interface calling method based on multiple data sources includes:

[0110] Step S201, configuring parameters of multiple data sources in the system and obtaining a general interface, where the general interface is an interface that can simultaneously call multiple different data sources, where the data sources include relational sources and / or non-relational sources;

[0111] Specifically, a relational source is a database table storing a small amount of data, and a non-relational source is a database table storing a large amount of data.

[0112] Step S202, obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source;

[0113] Specifically, in traditional interface development, the configuration and management of multiple data sources are cumbersome, and the flexibility of the system is limited. However, the above steps can dynamically select which data source to use based on the request parameters or other conditions through dynamic data source routing technology. The system can automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0114] Step S203, determining a target data source storing the target data according to the target request and based on a data source router;

[0115] Specifically, through dynamic data source routing and interface generation technology, it is possible to automatically generate interfaces that adapt to multiple data sources according to needs during runtime.

[0116] Step S204: dynamically generate a target interface based on the target request, the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0117] Specifically, through dynamic interface generation and multi-data source management technology, the interface development process is simplified and the flexibility and scalability of the system are improved. These advantages make interface development more efficient and flexible, and bring convenience to the development and maintenance of application programs.

[0118] Optionally, parameter configuration is performed on multiple data sources in the system, including: obtaining connection information of each of the above data sources, the above connection information at least including: the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source, and the access password of the above data source; storing the connection information of all the above data sources in a configuration file or a configuration database table, so as to perform parameter configuration on all the above data sources in the above system.

[0119] Optionally, obtaining a general interface includes: defining input parameters of the general interface and output parameters of the general interface, the input parameters of the general interface at least including the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface at least including the data type of the output data of the general interface; obtaining the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on an interface description language.

[0120] Optionally, according to the target request and based on the data source router, determining the target data source storing the target data includes: according to the target request, determining the request data of the target request, the request data at least including: the business type of the target request, the user identity of the target request and the geographic location of the target request; according to the target request, determining the parameter information of the target request, the parameter information at least including: the request backend address corresponding to the target request, the request header parameters corresponding to the target request; according to the parameter information and the request data of the target request, based on the data source router, determining the corresponding target data source storing the target data.

[0121] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: obtaining a first mapping relationship, wherein the first mapping relationship represents a mapping relationship between a business request and a data source; obtaining a second mapping relationship, wherein the second mapping relationship represents a mapping relationship between the business request and an input interface code of the universal interface; obtaining a third mapping relationship, wherein the third mapping relationship represents a mapping relationship between the data source and an output interface code of the universal interface; and dynamically generating a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

[0122] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: according to the interface parameters of the universal interface and the target data source, a target engine is used to identify the target data source; according to the interface parameters of the universal interface, the target request and the target data source, an interface code adapted to the target data source is dynamically generated by a code generator; according to the interface code adapted to the target data source, the target interface is dynamically generated.

[0123] Optionally, calling the target data source based on the target interface to query the target data in the target data source includes: inputting interface input data recognizable by the target interface according to the target request; calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0124] An embodiment of the present invention provides a device, comprising a processor, a memory, and a program stored in the memory and executable on the processor, wherein the processor implements at least the following steps when executing the program: Step S201, parameter configuration of multiple data sources in a system, and obtaining a universal interface, wherein the universal interface is an interface that can simultaneously call multiple different data sources, wherein the data sources include relational sources and / or non-relational sources;

[0125] Specifically, a relational source is a database table storing a small amount of data, and a non-relational source is a database table storing a large amount of data.

[0126] Step S202, obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source;

[0127] Specifically, in traditional interface development, the configuration and management of multiple data sources are cumbersome, and the flexibility of the system is limited. However, the above steps can dynamically select which data source to use based on the request parameters or other conditions through dynamic data source routing technology. The system can automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0128] Step S203, determining a target data source storing the target data according to the target request and based on a data source router;

[0129] Specifically, through dynamic data source routing and interface generation technology, it is possible to automatically generate interfaces that adapt to multiple data sources according to needs during runtime.

[0130] Step S204: dynamically generate a target interface based on the target request, the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0131] Specifically, through dynamic interface generation and multi-data source management technology, the interface development process is simplified and the flexibility and scalability of the system are improved. These advantages make interface development more efficient and flexible, and bring convenience to the development and maintenance of application programs.

[0132] Optionally, parameter configuration is performed on multiple data sources in the system, including: obtaining connection information of each of the above data sources, the above connection information at least including: the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source, and the access password of the above data source; storing the connection information of all the above data sources in a configuration file or a configuration database table, so as to perform parameter configuration on all the above data sources in the above system.

[0133] Optionally, obtaining a general interface includes: defining input parameters of the general interface and output parameters of the general interface, the input parameters of the general interface at least including the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface at least including the data type of the output data of the general interface; obtaining the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on an interface description language.

[0134] Optionally, according to the target request and based on the data source router, determining the target data source storing the target data includes: according to the target request, determining the request data of the target request, the request data at least including: the business type of the target request, the user identity of the target request and the geographic location of the target request; according to the target request, determining the parameter information of the target request, the parameter information at least including: the request backend address corresponding to the target request, the request header parameters corresponding to the target request; according to the parameter information and the request data of the target request, based on the data source router, determining the corresponding target data source storing the target data.

[0135] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: obtaining a first mapping relationship, wherein the first mapping relationship represents a mapping relationship between a business request and a data source; obtaining a second mapping relationship, wherein the second mapping relationship represents a mapping relationship between the business request and an input interface code of the universal interface; obtaining a third mapping relationship, wherein the third mapping relationship represents a mapping relationship between the data source and an output interface code of the universal interface; and dynamically generating a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

[0136] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: according to the interface parameters of the universal interface and the target data source, a target engine is used to identify the target data source; according to the interface parameters of the universal interface, the target request and the target data source, an interface code adapted to the target data source is dynamically generated by a code generator; according to the interface code adapted to the target data source, the target interface is dynamically generated.

[0137] Optionally, calling the target data source based on the target interface to query the target data in the target data source includes: inputting interface input data recognizable by the target interface according to the target request; calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0138] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0139] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes at least the following method steps: Step S201, parameter configuration of multiple data sources in the system, and obtaining a general interface, wherein the general interface is an interface that can simultaneously call multiple different data sources, wherein the data sources include relational sources and / or non-relational sources;

[0140] Specifically, a relational source is a database table storing a small amount of data, and a non-relational source is a database table storing a large amount of data.

[0141] Step S202, obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source;

[0142] Specifically, in traditional interface development, the configuration and management of multiple data sources are cumbersome, and the flexibility of the system is limited. However, the above steps can dynamically select which data source to use based on the request parameters or other conditions through dynamic data source routing technology. The system can automatically select the appropriate data source according to actual needs, improving the flexibility and scalability of the system.

[0143] Step S203, determining a target data source storing the target data according to the target request and based on a data source router;

[0144] Specifically, through dynamic data source routing and interface generation technology, it is possible to automatically generate interfaces that adapt to multiple data sources according to needs during runtime.

[0145] Step S204: dynamically generate a target interface based on the target request, the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

[0146] Specifically, through dynamic interface generation and multi-data source management technology, the interface development process is simplified and the flexibility and scalability of the system are improved. These advantages make interface development more efficient and flexible, and bring convenience to the development and maintenance of application programs.

[0147] Optionally, parameter configuration is performed on multiple data sources in the system, including: obtaining connection information of each of the above data sources, the above connection information at least including: the database table type of the above data source, the address of the above data source, the user name with permission to access the above data source, and the access password of the above data source; storing the connection information of all the above data sources in a configuration file or a configuration database table, so as to perform parameter configuration on all the above data sources in the above system.

[0148] Optionally, obtaining a general interface includes: defining input parameters of the general interface and output parameters of the general interface, the input parameters of the general interface at least including the name of the general interface and the data type of the input data of the general interface, and the output parameters of the general interface at least including the data type of the output data of the general interface; obtaining the general interface according to the input parameters of the general interface and the output parameters of the general interface and based on an interface description language.

[0149] Optionally, according to the target request and based on the data source router, determining the target data source storing the target data includes: according to the target request, determining the request data of the target request, the request data at least including: the business type of the target request, the user identity of the target request and the geographic location of the target request; according to the target request, determining the parameter information of the target request, the parameter information at least including: the request backend address corresponding to the target request, the request header parameters corresponding to the target request; according to the parameter information and the request data of the target request, based on the data source router, determining the corresponding target data source storing the target data.

[0150] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: obtaining a first mapping relationship, wherein the first mapping relationship represents a mapping relationship between a business request and a data source; obtaining a second mapping relationship, wherein the second mapping relationship represents a mapping relationship between the business request and an input interface code of the universal interface; obtaining a third mapping relationship, wherein the third mapping relationship represents a mapping relationship between the data source and an output interface code of the universal interface; and dynamically generating a target interface according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

[0151] Optionally, based on the target request, the universal interface and the target data source, a target interface is dynamically generated, including: according to the interface parameters of the universal interface and the target data source, a target engine is used to identify the target data source; according to the interface parameters of the universal interface, the target request and the target data source, an interface code adapted to the target data source is dynamically generated by a code generator; according to the interface code adapted to the target data source, the target interface is dynamically generated.

[0152] Optionally, calling the target data source based on the target interface to query the target data in the target data source includes: inputting interface input data recognizable by the target interface according to the target request; calling the target interface according to the interface input data, so that the target interface calls the target data source to query the target data in the target data source, and returns the target data to the client.

[0153] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0154] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0155] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0159] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0160] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0161] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0162] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:

[0163] 1) The above-mentioned dynamic interface calling method based on multiple data sources of the present application first configures parameters of multiple data sources in the system and obtains a general interface, which is an interface that can call multiple different data sources at the same time, and the data sources include relational sources and / or non-relational sources; obtains a target request, which is a request to query target data, and the target data is stored in at least one database table, and one database table is a data source; according to the target request and based on the data source router, determines the target data source storing the target data; based on the target request, the general interface and the target data source, dynamically generates a target interface, and calls the target data source based on the target interface to query the target data in the target data source. This method simplifies the interface development process. Through dynamic interface generation, there is no need to manually write and configure the interface code of multiple data sources, which reduces the workload of developers and the possibility of errors, and solves the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces.

[0164] 2) The above-mentioned dynamic interface calling device based on multiple data sources of the present application includes: a first processing unit, an acquisition unit, a determination unit and a second processing unit. The first processing unit is used to configure parameters of multiple data sources in the system and obtain a general interface. The general interface is an interface that can call multiple different data sources at the same time. The data source includes a relational source and / or a non-relational source; the acquisition unit is used to obtain a target request. The target request is a request to query target data. The target data is stored in at least one database table, and one database table is a data source; the determination unit is used to determine the target data source storing the target data according to the target request and based on the data source router; the second processing unit is used to dynamically generate a target interface based on the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source. The device simplifies the interface development process. Through dynamic interface generation, there is no need to manually write and configure the interface code of multiple data sources, which reduces the workload of developers and the possibility of errors, and solves the problems of cumbersome configuration and management, lack of flexibility and high time cost in the prior art in the development of multiple data source interfaces.

[0165] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A dynamic interface calling method based on multiple data sources, characterized in that: include: Parameter configuration is performed on multiple data sources in the system, and a general interface is obtained, where the general interface is an interface that can simultaneously call multiple different data sources, where the data sources include relational sources and / or non-relational sources; Obtaining a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source; Determine a target data source storing the target data according to the target request and based on a data source router; Based on the target request, the general interface and the target data source, a target interface is dynamically generated, and based on the target interface, the target data source is called to query the target data in the target data source.

2. The method according to claim 1, characterized in that Configure parameters for multiple data sources in the system, including: Acquire connection information of each of the data sources, the connection information including at least: a database table type of the data source, an address of the data source, a user name with permission to access the data source, and an access password of the data source; The connection information of all the data sources is stored in a configuration file or a configuration database table, so as to perform parameter configuration on all the data sources in the system.

3. The method according to claim 1, characterized in that Get the common interface, including: Define input parameters of the universal interface and output parameters of the universal interface, wherein the input parameters of the universal interface at least include the name of the universal interface and the data type of the input data of the universal interface, and the output parameters of the universal interface at least include the data type of the output data of the universal interface; The universal interface is acquired according to the input parameters of the universal interface and the output parameters of the universal interface and based on an interface description language.

4. The method according to claim 1, characterized in that: Determining a target data source storing the target data according to the target request and based on a data source router includes: Determine, according to the target request, request data of the target request, the request data including at least: a business type of the target request, a user identity of the target request, and a geographic location of the target request; Determine, according to the target request, parameter information of the target request, the parameter information at least including: a request backend address corresponding to the target request, and a request header parameter corresponding to the target request; According to the parameter information and the request data of the target request and based on the data source router, a corresponding target data source storing the target data is determined.

5. The method according to claim 1, characterized in that: Dynamically generating a target interface based on the target request, the general interface and the target data source includes: Acquire a first mapping relationship, where the first mapping relationship represents a mapping relationship between a service request and a data source; Acquire a second mapping relationship, where the second mapping relationship represents a mapping relationship between the service request and an input interface code of a universal interface; Acquire a third mapping relationship, where the third mapping relationship represents a mapping relationship between the data source and the output interface code of the universal interface; A target interface is dynamically generated according to the first mapping relationship, the second mapping relationship, the third mapping relationship, the target request, the universal interface and the target data source.

6. The method according to claim 1, characterized in that Dynamically generating a target interface based on the target request, the general interface and the target data source includes: According to the interface parameters of the universal interface and the target data source, identifying the target data source using a target engine; According to the interface parameters of the universal interface, the target request and the target data source, a code generator is used to dynamically generate an interface code adapted to the target data source; The target interface is dynamically generated according to the interface code adapted to the target data source.

7. The method according to claim 1, characterized in that Calling the target data source based on the target interface to query the target data in the target data source includes: Input interface input data recognizable by the target interface according to the target request; The target interface is called according to the interface input data, so that the target interface calls the target data source to query the target data source and return the target data to the client.

8. A dynamic interface calling device based on multiple data sources, characterized in that: include: A first processing unit is used to perform parameter configuration on multiple data sources in the system and obtain a general interface, where the general interface is an interface that can simultaneously call multiple different data sources, where the data sources include relational sources and / or non-relational sources; An acquisition unit, configured to acquire a target request, wherein the target request is a request for querying target data, the target data is stored in at least one database table, and one of the database tables is a data source; a determining unit, configured to determine a target data source storing the target data according to the target request and based on a data source router; The second processing unit is used to dynamically generate a target interface based on the general interface and the target data source, and call the target data source based on the target interface to query the target data in the target data source.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the dynamic interface calling method based on multiple data sources as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing the dynamic interface calling method based on multiple data sources as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and system for accessing multiple data sources

    CN111414391A

  • Method, system and device for quickly generating interface

    CN112131294A

  • Data source routing method and device

    CN112306984A

  • Interface creating method and related equipment

    CN115982257A

  • Interface creation method and device for multi-source heterogeneous data and electronic equipment

    CN116860859A