CN110392068B - Data transmission method, device and equipment - Google Patents

Data transmission method, device and equipment Download PDF

Info

Publication number
CN110392068B
CN110392068B CN201810342332.6A CN201810342332A CN110392068B CN 110392068 B CN110392068 B CN 110392068B CN 201810342332 A CN201810342332 A CN 201810342332A CN 110392068 B CN110392068 B CN 110392068B
Authority
CN
China
Prior art keywords
request message
api
sql
data corresponding
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810342332.6A
Other languages
Chinese (zh)
Other versions
CN110392068A (en
Inventor
陶智
王慧康
朱哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201810342332.6A priority Critical patent/CN110392068B/en
Publication of CN110392068A publication Critical patent/CN110392068A/en
Application granted granted Critical
Publication of CN110392068B publication Critical patent/CN110392068B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The application provides a data transmission method, a device and equipment thereof, wherein the method comprises the following steps: receiving a request message aiming at an API (application program interface), and acquiring service data corresponding to the request message; wherein the API is generated according to SQL information and provides a service by using the API, and the request message is a request message for accessing the service; and returning a response message aiming at the request message, wherein the response message carries the service data. According to the technical scheme, after the service platform receives the SQL information, the API can be generated according to the SQL information, and the API is deployed on the server, so that the server provides service by using the API, and the SQL information is quickly converted into the API service.

Description

Data transmission method, device and equipment
Technical Field
The present application relates to the field of internet technologies, and in particular, to a data transmission method, apparatus, and device.
Background
At the beginning of the development of cloud computing, there are three Service modes, which are SaaS (Software as a Service), PaaS (Platform as a Service) and IaaS (Infrastructure as a Service). SaaS is an innovative software application mode, and can rapidly develop services belonging to enterprises, so that the SaaS is widely applied. With the development of cloud computing and the expansion of services, the development mode of SaaS also changes, and a Backend-as-a-Service (basas a Service) mode with separated front and back ends appears, that is, the back end provides an Application Program Interface (API), and the front end develops and calls, so that the front end and the back end are decoupled, development dependence and waiting are reduced, and development efficiency is improved.
In the BaaS mode, all APIs cannot be transversely extended for a single API in the same application, so that the back-end service pressure is increased, and therefore, a MicroService (MicroService) mode is introduced, the granularity of the API is refined by the MicroService mode, and the transverse extension can be performed for the single API. However, in the deployment of the MicroService mode, developers are required to implement service codes, maintain hardware resources, and increase labor cost.
Disclosure of Invention
The application provides a data transmission method, which is applied to a service platform and comprises the following steps:
receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
and returning a response message aiming at the request message, wherein the response message carries the service data.
The application provides a data transmission method, which is applied to a configuration platform and comprises the following steps:
acquiring Structured Query Language (SQL) information;
and sending the SQL information to a service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by using the API, and sends service data according to the API.
The application provides a data transmission device, is applied to service platform, the device includes:
the receiving module is used for receiving a request message aiming at an Application Program Interface (API);
the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
an obtaining module, configured to obtain service data corresponding to the request message;
and the sending module is used for returning a response message carrying the service data aiming at the request message.
The application provides a data transmission device, is applied to configuration platform, the device includes:
the acquisition module is used for acquiring Structured Query Language (SQL) information;
and the sending module is used for sending the SQL information to the service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by utilizing the API and sends the business data according to the API.
The application provides a service platform, including: a processor and a machine-readable storage medium having computer instructions stored thereon, the processor when executing the computer instructions performs: receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
and returning a response message aiming at the request message, wherein the response message carries the service data.
The present application provides a configuration platform comprising: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs: acquiring Structured Query Language (SQL) information; and sending the SQL information to a service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by using the API, and sends service data according to the API.
Based on the above technical solution, in the embodiment of the present application, a method for implementing SQL As a Service (SQL As a Service) is provided, so that developers may only provide SQL (Structured Query Language) information, do not need to sense the existence of a server, maintain hardware resources, care about the deployment, extension, and maintenance of SQL in the server, and only pay attention to the SQL of their own services, thereby greatly reducing development cost. After receiving the SQL information, the service platform may generate an API (Application Programming Interface) according to the SQL information, and deploy the API in the server, so that the server provides a service by using the API, quickly converts the SQL information into an API service, provides a dynamic publishing function, accelerates system development efficiency, and has the advantages of smaller granularity, lighter weight, faster speed, and the like.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments of the present application or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings of the embodiments of the present application.
FIGS. 1A-1D are schematic diagrams of a system architecture in one embodiment of the present application;
FIG. 2 is a flow chart of a data transmission method in one embodiment of the present application;
FIG. 3 is a flow chart of a data transmission method in another embodiment of the present application;
FIG. 4 is a block diagram of a data transfer device according to an embodiment of the present application;
fig. 5 is a block diagram of a data transfer device according to an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Depending on the context, moreover, the word "if" may be used is interpreted as "at … …," or "when … …," or "in response to a determination.
The embodiment of the application provides a data transmission method which can be applied to a system comprising a service platform and a configuration platform. The configuration platform is configured to manage SQL information and send the SQL information to the service platform, and the type of the configuration platform is not limited, for example, the configuration platform may be a Personal Computer (PC), a notebook Computer, a mobile terminal, a server, or the like. In addition, the service platform is used for generating an API according to the SQL information and deploying the API to a service server to provide services to the outside, and the type of the service platform is not limited, for example, the service platform may be a PC, a notebook computer, a mobile terminal, a server, and the like.
Referring to fig. 1A, a schematic view of an application scenario according to an embodiment of the present application may include a front-end interface, a configuration platform, a Service server, and a database, and through cooperation of the front-end interface, the configuration platform, the Service server, and the database, SQL As a Service (SQL As a Service) may be implemented.
In order to implement SQL as a service, as shown in fig. 1B, a developer inputs SQL information on a front-end interface, and a configuration platform obtains the SQL information from the front-end interface and outputs the SQL information to a service platform. The service platform can generate the API according to the SQL information and deploy the API to the service server, so that the service server can provide services according to the API, and the user can access the services provided by the API through the client.
In the process that the user accesses the service, the user can send a request message to the service server through the client, the service server can send the request message to the service platform, the service platform can obtain service data corresponding to the request message from the database and return the service data to the service server, and the service server can return the service data to the user. At this point, SQL as a service may be completed.
Obviously, as can be seen from fig. 1B, in the implementation process of SQL as a service, developers may only provide SQL information, do not need to sense the existence of a server, maintain hardware resources, do not need to care about the deployment, extension, and maintenance of SQL on the server, and only pay attention to the SQL of their own services, thereby greatly reducing the development cost. In addition, after receiving the SQL information, the service platform may generate an API according to the SQL information, and deploy the API on the server, so that the server provides a service by using the API, quickly converts the SQL information into an API service, and provides a dynamic publishing function (i.e., the service platform may publish the API to the service server dynamically), thereby accelerating system development efficiency, and having advantages of smaller granularity, lighter weight, faster speed, and the like.
The SQL is a service implementation process, functions of a BaaS mode can be achieved, namely front-end and back-end separation can be achieved, the API is provided through the back end, and development and calling are performed through the front end, so that the front end and the back end are decoupled, development dependence and waiting are reduced, and development efficiency is improved. SQL is the realization process of the service, and can realize the function of the MicroService mode, namely, the granularity of the API can be refined, and the transverse extension is carried out aiming at a single API. For example, the API may only aim at a single resource, the service layer then relies on multiple microservices to combine into a service API required by the service, and the bottom microservices may be rapidly laterally expanded and individually deployed according to the request quantity. The SQL is a service implementation process, and can implement the function of Serverless (without a server), that is, developers only need to concern about specific API codes, but do not concern about deployment, extension, maintenance, and the like of the API codes on the server.
The functions of the front-end interface, the configuration platform, the service server and the database are described below with reference to specific examples, but of course, on the basis of the front-end interface, the configuration platform, the service server and the database, other auxiliary devices or auxiliary modules may be provided, which is not limited to this.
1. Front end interface (Editor). The front-end interface is a user interaction system, a developer can log in the front-end interface and input SQL information on the front-end interface, the SQL information is SQL software codes written by the developer, the SQL information is used for generating an API, and the content of the SQL information is not limited.
The developer can also input test information (such as a test case, a one-key test code, and the like) on the front-end interface, where the test information is a test code written by the developer, and the test information is used to test the API, such as whether the test API is abnormal or not, whether a bug exists, and the like, and the content of the test information is not limited.
2. The configuration platform, which may also be referred to as a configuration Center (Config Center), is described herein as an example of the configuration platform. The configuration platform interacts with the front-end interface and is used for receiving SQL information input by developers through the front-end interface, storing the SQL information locally and sending the SQL information to the service platform.
The configuration platform can also receive test information input by a developer through a front-end interface, and test the API deployed to the service server by the service platform by using the test information; if the test is successful, the configuration platform can receive SQL information; if the test fails, the configuration platform may reject the SQL message.
After the configuration platform acquires the SQL information each time, the SQL information of the previous version can be recorded to the operation log, and the SQL information of the current version is stored. Based on this, after testing the API deployed by the service platform to the service server, if the test is successful, the configuration platform can delete the SQL information of the previous version from the operation log on the basis of receiving the SQL information; if the test fails, the configuration platform can roll back to the SQL information of the previous version according to the operation log on the basis of rejecting the SQL information.
For example, when the configuration platform receives SQL information 1 (i.e. SQL information of version 1) for the first time, the configuration platform stores SQL information 1 in the local memory; when receiving the SQL information 2 (i.e. the version 2 SQL information) for the second time, the configuration platform records the SQL information 1 to the operation log, deletes the SQL information 1 from the local memory, stores the SQL information 2 in the local memory, and sends the SQL information 2 to the service platform.
After the service platform generates the API2 according to the SQL information 2, the configuration platform can also test the API2 by using the test information; if the test is successful, the configuration platform receives the SQL information 2 and deletes the SQL information 1 from the operation log; if the test fails, the configuration platform rejects the SQL information 2, namely deletes the SQL information 2 from the local memory, reads the SQL information 1 from the operation log, stores the SQL information 1 in the local memory, and sends the SQL information 1 to the service platform again, thereby realizing the rollback of the SQL information.
The configuration platform can record all operations of a developer on a front-end interface and store information of the operations. For example, SQL information and test information input by a developer on the front-end interface is one operation, and the configuration platform may store the SQL information and test information input by the developer on the front-end interface.
3. The Service platform may also be referred to as a Service Center (Service Center), and the Service platform is described herein as an example. The service platform interacts with the configuration platform and is used for receiving SQL information provided by the configuration platform, generating an API according to the SQL information and deploying the API to the service server so that the service server provides services according to the API. In addition, the service platform has a checking function, a white list function and a dynamic publishing function.
Wherein, the dynamic release function means: after the service platform generates the API, the API may be deployed to the service server, so that the service server provides a service according to the API, thereby implementing a dynamic publishing function.
Wherein, the check function means: when a developer inputs SQL information through a front-end interface, verification data can also be input, for the convenience of distinguishing, the verification data is called first verification data (such as token information) and the service platform records the first verification data corresponding to the API after generating the API. Based on this, after receiving the request message for the API, the service platform parses the check data from the request message, for convenience of differentiation, refers to the check data as second check data (such as token information), and queries the first check data corresponding to the API. If the second check data is consistent with the first check data, the check of the request message is passed, and the request message is allowed to be processed; and if the second check data is inconsistent with the first check data, the check of the request message is not passed, the request message is rejected, and the check is prompted to be not matched.
Wherein, the white list function means: when the developer inputs SQL information through the front-end interface, the developer may also input an address white list, where the address white list may include address ranges that can access the API, such as an address segment a and an address segment B, and after the service platform generates the API, the service platform may record the address white list corresponding to the API. Based on this, after receiving the request message for the API, the service platform may parse out the source address from the request message; if the source address is in the address white list, the source address is in accordance with the address requirement of the address white list, and the request message is allowed to be processed; if the source address is not in the address white list, the source address is not in accordance with the address requirement of the address white list, the request message can be rejected, and the verification is prompted to be unmatched.
In an example, referring to fig. 1C, the service platform may further include a Cache layer (Cache), and the service platform may perform data storage through the Cache layer, so as to improve response efficiency of the API. For example, the service platform may store the service data in the cache layer, so that after receiving the request message, if the cache layer has the service data corresponding to the request message, the service platform directly obtains the service data from the cache layer, instead of obtaining the service data from the database, thereby improving the response efficiency of the API. And if the cache layer does not have the service data corresponding to the request message, acquiring the service data corresponding to the request message from the database.
In one example, as shown in fig. 1D, the service platform may further include a data source Adapter (e.g., DataBase-Adapter), and the service platform may perform format conversion on the SQL statements through the data source Adapter so as to adapt to the type of the DataBase and enable the DataBase to support the processing of the SQL statements.
For example, there are a MySQL-type database 1, an Oracle-type database 2, and a PostgresQL-type database 3, and if the database corresponding to the API is the MySQL-type database 1, the service platform converts the SQL statement into a MySQL-type SQL statement through the data source adapter, so that the database 1 can process the MySQL-type SQL statement. If the database corresponding to the API is the database 2 of the Oracle type, the SQL statement is converted into the SQL statement of the Oracle type by the data source adapter, so that the database 2 can process the SQL statement of the Oracle type, and so on.
4. And a service server. The service server is used for providing service for the user, and the user can obtain service data required by the user, such as commodity identification, commodity price, commodity pictures and the like, by accessing the service server.
5. A database. The database is used for storing business data, such as commodity identification, commodity price, commodity pictures and the like. The type is MySQL type, Oracle type, PostgresQL type, etc., which is not limited thereto.
In the application scenario, referring to fig. 2, a flowchart of a data transmission method provided in the embodiment of the present application is shown, where the method may be applied to a service platform, and the method may include the following steps:
step 201, the service platform acquires SQL information. Wherein the SQL information may be dynamically assembled.
The acquiring, by the service platform, the SQL information may include: the service platform obtains SQL information from the configuration platform that the user (e.g., developer) entered into.
Referring to the above embodiment, a developer may log in to the front-end interface and input SQL information on the front-end interface, where the SQL information is a software code written by the developer to generate an API; the configuration platform can receive SQL information input by a developer through a front-end interface and output the SQL information to the service platform. Based on this, the service platform can acquire the SQL information from the configuration platform.
Step 202, the service platform generates an API according to the SQL information.
The SQL information may include an identifier of the database, and when the service platform generates the API according to the SQL information, the service platform may generate the API that accesses the database, which is not limited in the API generation process. For example, SQL information is used to query the database 1 for commodity information with a commodity price less than a parameter value, and the API generated according to the SQL information is used to query the database 1 for commodity information with a commodity price less than a parameter value.
Since the service platform is an API for generating access to the database (e.g., database 1), the service platform may also establish a connection with the database 1, so as to access the database 1 through the connection. In summary, when an API is newly created, the service platform first determines the database corresponding to the API, and establishes a connection with the database.
For example, application a includes API 1 and API2, and in order to add API 1 and API2 to application a, the SQL information may further include an application identifier (e.g., application a). Based on this, when the service platform generates an API (assumed to be API 1) from the SQL information, it determines that API 1 belongs to application a, and adds API 1 to application a. Similarly, when the service platform generates the API2 from another SQL message, it determines that API2 belongs to application a, and thus adds API2 to application a.
Of course, the above process is only an example of generating the API according to the SQL information by the service platform, and the generation process is not limited, and is related to the content of the SQL information, and the API can be generated according to actual needs.
The service platform provides services using the API, step 203, i.e. provides services to the user.
The service platform provides services by using the API, and may include: the service platform has a dynamic publishing function, so after the API is generated, the API can be deployed to the service server, so that the service server provides services according to the API, and a user can access the services provided by the API through the client.
Through the processing, the service platform can generate the API according to the SQL information and deploy the API on the server, so that the server provides service by using the API, the SQL information is quickly converted into the API service, a dynamic publishing function is provided, the system development efficiency is accelerated, and the method has the advantages of being smaller in granularity, lighter in weight, faster and the like. In subsequent processes, the user may access the service through the API, as described below.
In step 204, the service platform receives a request message for the API, where the request message is a request message for accessing the service.
When a user accesses a service provided by the API, the user may send a request message to the service server through the client, where the request message may carry a parameter value to be queried, such as 100 yuan. The service server may send the request message to the service platform, which may then receive the request message.
Step 205, the service platform acquires the service data corresponding to the request message.
The obtaining, by the service platform, the service data corresponding to the request message may include: the service platform can directly acquire the service data corresponding to the request message from the database; or, the service platform may query whether the service data corresponding to the request message exists in the cache; if yes, the service data corresponding to the request message can be obtained from the cache; if not, the service data corresponding to the request message can be obtained from the database, and the corresponding relation between the request message and the service data is recorded in the cache.
The service platform may record a correspondence between the request message (e.g., a data identifier carried by the request message) and the service data in a local cache (e.g., a cache layer shown in fig. 1C). Based on this, after receiving the request message, the service platform may first query whether the cache layer has the service data corresponding to the request message. If the request message exists, the service platform can directly acquire the service data corresponding to the request message from the cache layer without acquiring the service data corresponding to the request message from the database, so that the response efficiency of the API can be improved. And if the request message does not exist, the service platform acquires the service data corresponding to the request message from the database.
In one example, the step of obtaining, by the service platform, the service data corresponding to the request message from the database may include: the service platform analyzes the query parameters from the request message, generates SQL sentences according to the query parameters and the API, and acquires the business data corresponding to the SQL sentences from the database.
For example, since the API is used to query the database 1 for the commodity information with the commodity price less than the parameter value, and the parameter value carried in the request message is 100 yuan, that is, the query parameter is 100 yuan, an SQL statement may be generated according to the query parameter and the API, such as querying the database 1 for the commodity information with the commodity price less than 100 yuan. After sending the SQL statement to the database 1, the database 1 may execute the SQL statement and return the commodity information, i.e., the business data, with the commodity price less than 100 yuan to the service platform.
In one example, the service platform acquiring business data corresponding to the SQL statement from the database may include: the service platform analyzes the database identification from the API, determines a database corresponding to the database identification, converts the SQL statement into an SQL statement supported by the database, and sends the converted SQL statement to the database. And the service platform receives the business data which is returned by the database and corresponds to the converted SQL statement.
For example, because the API includes a database identifier, the service platform may parse the database identifier from the API and determine a database, such as database 1, corresponding to the database identifier. Assuming that the database 1 is a MySQL-type database 1, the service platform may convert the SQL statement into a MySQL-type SQL statement and send the MySQL-type SQL statement to the database 1. After receiving the MySQL-type SQL statement, the database 1 may execute the MySQL-type SQL statement, and return the service data corresponding to the MySQL-type SQL statement to the service platform, so that the service platform receives the service data.
After the service platform generates the API according to the SQL information, first verification data corresponding to the API can be recorded. Based on this, after the service platform receives the request message aiming at the API, the second check-up data can be analyzed from the request message; if the second check data is consistent with the first check data, acquiring the service data corresponding to the request message; otherwise, the request message is rejected and the verification is prompted to be unmatched.
After the service platform generates the API according to the SQL information, an address white list corresponding to the API can be recorded; wherein the address whitelist may include address ranges that can access the API. Based on this, after receiving the request message for the API, the service platform may further parse out the source address from the request message; if the source address is in the address white list, the service data corresponding to the request message can be acquired; if the source address is not on the address white list, the request message may be rejected and the check is prompted for a mismatch.
And step 206, the service platform returns a response message aiming at the request message, and the response message carries the service data. For example, the service platform returns the response message to the service server, and the service server may return the response message to the user, so as to return the service data to the user, thereby completing the data transmission process.
In an example, the execution sequence is only an example given for convenience of description, and in practical applications, the execution sequence between steps may also be changed, and the execution sequence is not limited. Moreover, in other embodiments, the steps of the respective methods do not have to be performed in the order shown and described herein, and the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
In the application scenario, referring to fig. 3, another flowchart of the data transmission method provided in the embodiment of the present application is shown, where the method may be applied to a configuration platform, and the method may include the following steps:
in step 301, the configuration platform obtains SQL information that is input to the configuration platform by a user (e.g., a developer). Referring to the above embodiment, a developer may log in to the front-end interface and input SQL information on the front-end interface, where the SQL information is a software code written by the developer to generate an API; based on the method, the configuration platform can receive SQL information input by a developer through a front-end interface.
Step 302, the configuration platform sends the SQL information to the service platform, so that the service platform generates an API according to the SQL information, provides a service using the API, and sends the service data according to the API.
The SQL information can be dynamically assembled, and the configuration platform sends the SQL information dynamic assembly process flow to the service platform.
In one example, the configuration platform may also obtain test information, such as test information input to the configuration platform by a developer through a front-end interface, where the test information is code written by the developer to test the API. Then, the configuration platform tests the API deployed by the service platform to the service server by using the test information; if the test is successful, the SQL information is accepted; if the test fails, the SQL information is rejected.
After the configuration platform acquires the SQL information each time, the SQL information of the previous version can be recorded to the operation log, and the SQL information of the current version is stored. Based on this, after testing the API deployed by the service platform to the service server, if the test is successful, the configuration platform can delete the SQL information of the previous version from the operation log on the basis of receiving the SQL information; if the test fails, the configuration platform can roll back to the SQL information of the previous version according to the operation log on the basis of rejecting the SQL information.
Based on the same application concept as the method, an embodiment of the present application further provides a data transmission apparatus, which can be applied to a service platform, and is shown in fig. 4 as a structural diagram of the apparatus, where the apparatus includes:
a receiving module 401, configured to receive a request message for an application program interface API;
the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
an obtaining module 402, configured to obtain service data corresponding to the request message;
a sending module 403, configured to return a response message carrying service data for the request message.
The obtaining module 402, when obtaining the service data corresponding to the request message, is specifically configured to:
acquiring service data corresponding to the request message from a database; alternatively, the first and second electrodes may be,
inquiring whether business data corresponding to the request message exists in a cache or not; if so, acquiring the service data corresponding to the request message from a cache; if not, acquiring the service data corresponding to the request message from a database, and recording the corresponding relation between the request message and the service data in a cache.
The obtaining module 402, when obtaining the service data corresponding to the request message from the database, is specifically configured to: analyzing the query parameter from the request message; generating an SQL statement according to the query parameter and the API; acquiring business data corresponding to the SQL statement from the database;
the obtaining module 402 is specifically configured to, when obtaining the business data corresponding to the SQL statement from the database: analyzing a database identifier from the API, and determining a database corresponding to the database identifier; converting the SQL statement into an SQL statement supported by the database; sending the converted SQL statement to the database; and receiving the business data which is returned by the database and corresponds to the converted SQL statement.
Based on the same application concept as the method, an embodiment of the present application further provides a service platform, including: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs:
receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
and returning a response message aiming at the request message, wherein the response message carries the service data.
Based on the same application concept as the method, the embodiment of the present application further provides a machine-readable storage medium, where a plurality of computer instructions are stored on the machine-readable storage medium, and when executed, the computer instructions perform the following processes: receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
and returning a response message aiming at the request message, wherein the response message carries the service data.
Based on the same application concept as the method described above, an embodiment of the present application further provides a data transmission apparatus, which can be applied to a configuration platform, and is shown in fig. 5 as a structural diagram of the apparatus, where the apparatus includes:
an obtaining module 501, configured to obtain Structured Query Language (SQL) information;
the sending module 502 is configured to send the SQL information to the service platform, so that the service platform generates an API according to the SQL information, provides a service by using the API, and sends the service data according to the API.
Based on the same application concept as the method, the embodiment of the present application further provides a configuration platform, a processor, and a machine-readable storage medium, where a plurality of computer instructions are stored on the machine-readable storage medium, and when the processor executes the computer instructions, the processor performs the following processing: acquiring SQL information; and sending the SQL information to a service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by using the API, and sends service data according to the API.
Based on the same application concept as the method, the embodiment of the present application further provides a machine-readable storage medium, where a plurality of computer instructions are stored on the machine-readable storage medium, and when executed, the computer instructions perform the following processes: acquiring SQL information; and sending the SQL information to a service platform so that the service platform generates an API according to the SQL information, provides services by using the API, and sends business data according to the API.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (16)

1. A data transmission method is applied to a service platform, and the method comprises the following steps:
receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
returning a response message aiming at the request message, wherein the response message carries the service data;
wherein the acquiring the service data corresponding to the request message includes: acquiring service data corresponding to the request message from a database; the obtaining of the service data corresponding to the request message from the database includes: analyzing the query parameter from the request message; generating an SQL statement according to the query parameter and the API; and acquiring the business data corresponding to the SQL statement from a database.
2. The method of claim 1,
the acquiring the service data corresponding to the request message further includes:
inquiring whether business data corresponding to the request message exists in a cache or not; if so, acquiring the service data corresponding to the request message from a cache; if not, acquiring the service data corresponding to the request message from a database, and recording the corresponding relation between the request message and the service data in a cache.
3. The method of claim 1,
the obtaining of the business data corresponding to the SQL statement from the database includes:
analyzing a database identifier from the API, and determining a database corresponding to the database identifier;
converting the SQL statement into an SQL statement supported by the database;
sending the converted SQL statement to the database;
and receiving the business data which is returned by the database and corresponds to the converted SQL statement.
4. The method of claim 1, further comprising:
after an API is generated according to SQL information, first check data corresponding to the API is recorded;
after receiving a request message for API, parsing out second check-up data from the request message; if the second check data is consistent with the first check data, executing operation of acquiring service data corresponding to the request message; otherwise, rejecting the request message and prompting the verification to be unmatched.
5. The method of claim 1, further comprising:
after an API is generated according to SQL information, an address white list corresponding to the API is recorded; wherein the address whitelist includes address ranges that can access the API;
after receiving a request message for API, analyzing a source address from the request message; if the source address is in the address white list, executing operation of acquiring service data corresponding to the request message; otherwise, rejecting the request message and prompting the verification to be unmatched.
6. The method of claim 1, further comprising:
SQL information is obtained from a configuration platform, the SQL information being input to the configuration platform by a user.
7. The method of claim 1,
the providing the service by using the API comprises the following steps:
and deploying the API to a business server so that the business server provides services according to the API.
8. A data transmission method is applied to a configuration platform, and the method comprises the following steps:
acquiring Structured Query Language (SQL) information;
sending the SQL information to a service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by using the API and sends service data according to the API;
the service platform receives a request message aiming at the API, and acquires service data corresponding to the request message; the acquiring the service data corresponding to the request message includes: acquiring service data corresponding to the request message from a database; the obtaining of the service data corresponding to the request message from the database includes: parsing query parameters from the request message; generating an SQL statement according to the query parameter and the API; and acquiring the business data corresponding to the SQL statement from a database.
9. The method of claim 8,
after sending the SQL information to the service platform, the method further includes:
acquiring test information;
testing the API deployed to the service server by the service platform by using the test information;
if the test is successful, the SQL information is accepted;
and if the test fails, rejecting the SQL information.
10. The method of claim 9, further comprising:
after the SQL information is obtained, recording the SQL information of the previous version to an operation log;
after the SQL information is received, deleting the previous version of the SQL information from the operation log;
and after rejecting the SQL information, rolling back to the SQL information of the previous version according to the operation log.
11. A data transmission apparatus, applied to a service platform, the apparatus comprising:
the receiving module is used for receiving a request message aiming at an Application Program Interface (API);
the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
an obtaining module, configured to obtain service data corresponding to the request message;
a sending module, configured to return a response message carrying the service data for the request message;
the obtaining module is specifically configured to, when obtaining the service data corresponding to the request message: acquiring service data corresponding to the request message from a database;
the obtaining module is specifically configured to, when obtaining the service data corresponding to the request message from the database: parsing query parameters from the request message; generating an SQL statement according to the query parameter and the API; and acquiring the business data corresponding to the SQL statement from the database.
12. The apparatus of claim 11,
the obtaining module is further configured to, when obtaining the service data corresponding to the request message:
inquiring whether business data corresponding to the request message exists in a cache or not; if so, acquiring the service data corresponding to the request message from a cache; if not, acquiring the service data corresponding to the request message from a database, and recording the corresponding relation between the request message and the service data in a cache.
13. The apparatus of claim 11,
the obtaining module is specifically configured to, when obtaining the business data corresponding to the SQL statement from the database: analyzing a database identifier from the API, and determining a database corresponding to the database identifier; converting the SQL statement into an SQL statement supported by the database; sending the converted SQL statement to the database; and receiving the business data which is returned by the database and corresponds to the converted SQL statement.
14. A data transmission apparatus, applied to a configuration platform, the apparatus comprising:
the acquisition module is used for acquiring Structured Query Language (SQL) information;
the sending module is used for sending the SQL information to the service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by utilizing the API and sends business data according to the API;
the service platform receives a request message aiming at the API and acquires service data corresponding to the request message; the acquiring the service data corresponding to the request message includes: acquiring service data corresponding to the request message from a database; the obtaining of the service data corresponding to the request message from the database includes: analyzing the query parameter from the request message; generating an SQL statement according to the query parameter and the API; and acquiring the business data corresponding to the SQL statement from a database.
15. A service platform, comprising: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs: receiving a request message aiming at an Application Program Interface (API), and acquiring service data corresponding to the request message; the API is generated according to Structured Query Language (SQL) information and provides services by utilizing the API, and the request message is used for accessing the services;
returning a response message aiming at the request message, wherein the response message carries the service data;
wherein the acquiring the service data corresponding to the request message includes: acquiring service data corresponding to the request message from a database; the obtaining of the service data corresponding to the request message from the database includes: analyzing the query parameter from the request message; generating an SQL statement according to the query parameter and the API; and acquiring business data corresponding to the SQL statement from a database.
16. A configuration platform, comprising: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs: acquiring Structured Query Language (SQL) information; sending the SQL information to a service platform so that the service platform generates an Application Program Interface (API) according to the SQL information, provides services by using the API and sends service data according to the API;
the service platform receives a request message aiming at the API, and acquires service data corresponding to the request message; the acquiring the service data corresponding to the request message includes: acquiring service data corresponding to the request message from a database; the obtaining of the service data corresponding to the request message from the database includes: analyzing the query parameter from the request message; generating an SQL statement according to the query parameter and the API; and acquiring the business data corresponding to the SQL statement from a database.
CN201810342332.6A 2018-04-17 2018-04-17 Data transmission method, device and equipment Active CN110392068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810342332.6A CN110392068B (en) 2018-04-17 2018-04-17 Data transmission method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810342332.6A CN110392068B (en) 2018-04-17 2018-04-17 Data transmission method, device and equipment

Publications (2)

Publication Number Publication Date
CN110392068A CN110392068A (en) 2019-10-29
CN110392068B true CN110392068B (en) 2022-06-21

Family

ID=68283066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810342332.6A Active CN110392068B (en) 2018-04-17 2018-04-17 Data transmission method, device and equipment

Country Status (1)

Country Link
CN (1) CN110392068B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825388B (en) * 2019-11-15 2021-08-31 中科大数据研究院 Method for directly converting SQL statement into corresponding REST interface
CN114153864A (en) * 2020-09-07 2022-03-08 华为云计算技术有限公司 Method and device for generating API
CN112256452A (en) * 2020-10-21 2021-01-22 上海商汤智能科技有限公司 Service item determination method, device, equipment and storage medium of cloud service platform
CN112328917A (en) * 2020-11-04 2021-02-05 浪潮云信息技术股份公司 SQL (structured query language) writing oriented method for generating http interface service and data display page
CN112650481A (en) * 2020-12-23 2021-04-13 航天信息股份有限公司 Method and system for processing data

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475517A (en) * 2013-09-04 2013-12-25 青岛海信宽带多媒体技术有限公司 Optical network terminal equipment and hardware configuration parameter saving method thereof
CN103593443A (en) * 2013-11-18 2014-02-19 南京新模式软件集成有限公司 Method for electronic file metadata expansion
CN104168333A (en) * 2014-09-01 2014-11-26 广东电网公司信息中心 Working method of PROXZONE service platform
CN105677875A (en) * 2016-01-11 2016-06-15 清华大学 Visual modeling platform based on unified constraint of normal data elements
CN106874371A (en) * 2016-12-30 2017-06-20 新华三技术有限公司 A kind of data processing method and device
CN107222542A (en) * 2017-06-08 2017-09-29 东华大学 A kind of construction method of cloud service management system
CN107329900A (en) * 2017-07-06 2017-11-07 携程计算机技术(上海)有限公司 The method for generating test data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475517A (en) * 2013-09-04 2013-12-25 青岛海信宽带多媒体技术有限公司 Optical network terminal equipment and hardware configuration parameter saving method thereof
CN103593443A (en) * 2013-11-18 2014-02-19 南京新模式软件集成有限公司 Method for electronic file metadata expansion
CN104168333A (en) * 2014-09-01 2014-11-26 广东电网公司信息中心 Working method of PROXZONE service platform
CN105677875A (en) * 2016-01-11 2016-06-15 清华大学 Visual modeling platform based on unified constraint of normal data elements
CN106874371A (en) * 2016-12-30 2017-06-20 新华三技术有限公司 A kind of data processing method and device
CN107222542A (en) * 2017-06-08 2017-09-29 东华大学 A kind of construction method of cloud service management system
CN107329900A (en) * 2017-07-06 2017-11-07 携程计算机技术(上海)有限公司 The method for generating test data

Also Published As

Publication number Publication date
CN110392068A (en) 2019-10-29

Similar Documents

Publication Publication Date Title
CN110392068B (en) Data transmission method, device and equipment
CN108346028B (en) Business approval processing method, device and system
US11093232B2 (en) Microservice update system
WO2020185330A1 (en) Solution for implementing computing service based on structured query language statement
US10992780B1 (en) Microservices as a microservice
CN108572970B (en) Structured data processing method and distributed processing system
CN109831466B (en) Micro-service business processing method and nginx server
US20220058181A1 (en) Distributed transaction processing method and system based on message queue and database
CN112380401B (en) Service data checking method and device
CN111553652B (en) Service processing method and device
CN112800134A (en) Data synchronization method and system
CN111698233A (en) Message processing method and device
CN111831713A (en) Data processing method, device and equipment
CN111241189A (en) Method and device for synchronizing data
CN110580212B (en) Data export method and device of application program, electronic equipment and storage medium
CN109389271B (en) Application performance management method and system
CN111080250B (en) Flow backspacing compensation method and device, storage medium and electronic equipment
CN110928895A (en) Data query method, data table establishing method, device and equipment
JP6372350B2 (en) Definition file generation program, definition file generation method, and information processing apparatus
CN116431523B (en) Test data management method, device, equipment and storage medium
CN111324732B (en) Model training method, text processing device and electronic equipment
CN117689132A (en) Processing method and device of flow form, electronic equipment and storage medium
CN117319394A (en) Transaction arrangement implementation method, transaction arrangement platform, transaction processing method and device
CN116701152A (en) Database performance determining method, device, equipment and medium
CN114281550A (en) Request processing method and device, computer equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant