Call configuration method, system and device based on SQL template release interface and medium
By creating a data source connection interface, defining a multi-data source adapter and SQL template in the interface call configuration, configuring a request parameter list, and generating and verifying interface parameters, the problem of accuracy and inefficiency of interface parameter identification in the existing technology is solved, and the system stability and compatibility improvement is achieved.
Patent Information
- Application Number
- CN202510375552.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-07-04
AI Technical Summary
The existing calling and configuration process based on the SQL template publishing interface cannot meet the diverse business needs, and the data format requirements are not fully considered, resulting in the accuracy and inefficiency of interface parameter identification.
By creating a front-end interface for data source connection, defining multi-data source adapters and SQL templates, configuring a request parameter list, generating a data model for request parameters and defining response parameters, and performing verification to ensure that the interface data structure is clear.
It improves the stability of the system and the reusability of the interface, ensures the quality and availability of the interface, and enhances the compatibility of the system with different databases and the flexibility of the interface.
Smart Images

Figure CN120255869A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network data processing, and particularly relates to a method, system, device and medium for call configuration based on an SQL template publishing interface. Background Art
[0002] With the development of digitization, the demand for data processing and interaction in various application systems is increasing day by day. As the core of data storage and management, the efficient configuration and call of the operation interface of the database are crucial. In database application development, the method based on the SQL template publishing interface is widely used in scenarios where different business logics interact with the database due to its flexibility and reusability.
[0003] However, in the existing call configuration process based on the SQL template publishing interface, only a single fixed interface configuration is provided, which cannot meet diverse business needs. The prior art does not consider the requirements of the model for the input data format and directly passes the interface item information to the model, resulting in the model being unable to process effectively. In the process of data transmission and processing, there are problems such as inconsistent data formats and redundancy in the original interface item information. In terms of the processing of interface item information and interaction with the model, the prior art often does not fully consider the requirements of subsequent model processing for data formats. Directly passing the interface item information to the model may cause the model to be unable to effectively understand and process this data, thus affecting the accuracy and efficiency of interface parameter recognition. Summary of the Invention
[0004] The present invention provides a method for call configuration based on an SQL template publishing interface. The method generates a data model for request parameters and defines response parameters, standardizing the input and output of the interface. Through the definition of the data model, the interface data structure is made clear. Debugging, validating and publishing the interface improve the stability of the system.
[0005] The method includes: Create a data source connection front-end interface and configure database information; Define a multi-data source adapter and create a corresponding database connection according to the database information configured in the front-end interface; Define the basic information of the interface and the corresponding SQL template; Configure the request parameter list and define the parameters and parameter types corresponding to the placeholders in the SQL template; Generate request parameters according to the request parameter list and define a data model to describe the response parameters of the interface; Debug and validate the interface and publish the validated interface.
[0006] Further, it should be noted that in the method, the step of defining the basic information of the interface and the corresponding SQL template further includes: Obtain an initial SQL template and configure the initial SQL template through a preset definition method to obtain interface information; Perform configuration processing on the interface information to obtain multiple interface item information; Input each interface item information into the trained interface information recognition model for item information recognition, and output multiple interface parameters. The trained interface information recognition model is trained based on the basic interface training information under the preset definition method; Determine the interface attributes corresponding to each interface parameter, and define interface service information in each interface parameter according to the interface attributes.
[0007] It should be further noted that the steps of obtaining the initial SQL template and configuring the initial SQL template through a preset definition method to obtain interface information also include: defining a template engine; using a configuration management tool to define the interface information of the SQL template and configure the SQL precompiled statement.
[0008] It should be further noted that the steps of performing configuration processing on the interface information to obtain multiple interface item information also include: Determine the preset configuration parameters corresponding to the preset parameters in the interface information; perform configuration processing on the interface information according to the preset configuration parameters to obtain multiple interface item information.
[0009] It should be further noted that the steps of performing interface placeholder configuration on each interface item information to generate the interface item information corresponding to each interface item information also include: Parse the interface item information to identify the parameter information therein; Define placeholder rules according to the structure and requirements of the interface item information; Use the defined placeholder rules to replace the parameter information in the interface item information with corresponding placeholders; Convert the interface item information containing placeholders into a machine language that the trained interface information recognition model can understand by mapping each placeholder and other text in the interface item information to a high-dimensional vector space; Store the generated vector representation.
[0010] It should be further noted that the steps of inputting each interface item information into the trained interface information recognition model for item information recognition and outputting multiple interface parameters also include: Determine the corresponding interface parameter interface information for each interface item information, and combine each interface item information with the interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information; Input each target interface item information into the trained interface information recognition model for item information recognition, and output multiple interface parameters; After obtaining multiple interface parameters, configure the call of the interface based on the SQL template.
[0011] It should be further noted that the method further includes: obtaining an initial SQL template, and configuring the initial SQL template through a preset definition method to obtain interface information; Determine the preset configuration parameters corresponding to the preset parameters in the interface information; Perform configuration processing on the interface information according to the preset configuration parameters to obtain multiple interface item information; Determine the arrangement order of each interface item information corresponding to the interface item information in the interface information; Perform a first preset interface parameter configuration on each interface item information according to the arrangement order to obtain first interface parameter interface information; Perform a second preset interface parameter configuration on each interface item information according to the arrangement order to obtain second interface parameter interface information; Combine each interface item information, the first interface parameter interface information and the second interface parameter interface information corresponding to each interface item information to generate target interface item information corresponding to each interface item information; Input each target interface item information into the first long short-term memory network to obtain sub-interface response features output by the first long short-term memory network; Input the sub-interface response features output by the first long short-term memory network into the subsequent long short-term memory network to obtain sub-interface response features output by the subsequent long short-term memory network; Repeat inputting the sub-interface response features output by the previous long short-term memory network into the subsequent long short-term memory network until the interface response features corresponding to each target interface item information are output by the last long short-term memory network; Obtain the task text and the task interface item information corresponding to the task text; Input the task interface item information and each interface response feature into the trained interface information identification model, and output the interface parameters corresponding to the target interface item information.
[0012] This application also provides a call configuration system for an interface published based on an SQL template. The system includes: An information configuration module, used to create a data source connection front-end interface and configure database information; An information creation definition module, used to define a multi-data source adapter and create a corresponding database connection according to the database information configured in the front-end interface; A template configuration module, used to define basic interface information and the corresponding SQL template; A parameter definition module, used to configure a request parameter list and define parameters and parameter types corresponding to placeholders in the SQL template; A parameter response module, which is used to generate request parameters according to a list of request parameters and define a data model to describe the response parameters of the interface; A verification and release module, which is used to debug and verify the interface and release the verified interface.
[0013] According to another embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the method for calling and configuring an interface based on an SQL template are implemented.
[0014] According to still another embodiment of the present application, a storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for calling and configuring an interface based on an SQL template are implemented.
[0015] As can be seen from the above technical solutions, the present invention has the following advantages: The method for calling and configuring an interface based on an SQL template provided by the present application collects database information by creating a front-end interface, creates a database connection using a multi-data source adapter, standardizes and visualizes the configuration and creation process of the database connection, and improves the compatibility of the system with different databases. Define the basic information of the interface and the SQL template, as well as configure the list of request parameters, separate the definition of the interface from the parameter configuration, and make the business logic and input parameters of the interface clearer. This separation method is convenient for maintenance and modification, and also improves the reusability of the interface. Generate a data model for request parameters and define response parameters, further standardize the input and output of the interface. Through the definition of the data model, the data structure returned by the interface is clear. Debug and verify the interface and release the interface, ensuring the quality and usability of the interface and improving the stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It is a flowchart of a method for calling and configuring an interface based on an SQL template; Figure 2 It is a schematic diagram of the definition of an SQL template interface; Figure 3 It is a schematic diagram of a data source connection configuration interface; Figure 4Schematic diagram of a call configuration system based on an SQL template publishing interface; Figure 5 Schematic diagram of an electronic device. Specific implementation manners
[0018] The call configuration method based on the SQL template publishing interface proposed in this application quickly configures the publishing interface through a function interface. Users can flexibly define SQL templates through the function interface to quickly develop, debug, and publish interfaces. In theory, the interface can implement basic operations such as adding, updating, deleting, and querying for multiple types of databases. At the same time, the flexibility of SQL statements can meet the implementation of complex business requirements. Using this design method can achieve the functions of online debugging and dynamic publishing, and can also extend additional functions such as automatically generating interface documents.
[0019] The following will describe in detail the specific process of the call configuration method based on the SQL template publishing interface. For the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are proposed to thoroughly understand the embodiments of this application. However, those skilled in the art should clearly understand that this application can also be implemented in other embodiments without these specific details.
[0020] It should be understood that when used in the specification of this application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations. The terms "comprising", "including", "having", and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0021] The statements such as "in one embodiment" or "in some embodiments" described in this application mean that the specific features, structures, or characteristics described in that embodiment are included in one or more embodiments of this application. Thus, the statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" that appear in different places in this application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0022] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0023] Please refer to Figure 1The following is a flowchart of a method for calling and configuring an SQL template publishing interface in a specific embodiment. The method includes: S101: Create a front - end interface for data source connection and configure database information.
[0024] In this embodiment, HTML front - end development technology or JavaScript can be used to create a visual interface, which contains form elements for inputting database - related information, such as input boxes for database address, port number, username, password, database name, etc.
[0025] As Figure 2 shown in the form, there is corresponding SQL template interface definition information, which defines the interaction logic between data, such as input verification, to ensure that the format of the database information entered by the user is correct. For example, check whether the database address conforms to the IP address format and whether the port number is a valid number, etc. This can provide a convenient way for users to configure database connection information and improve the accuracy of configuration.
[0026] As Figure 3 shown, it is a schematic diagram of developing a front - end interface for data source connection configuration. Configuring the data source connection mainly configures key information such as database type, database server IP, port, database name, username, password, etc. In this process, a multi - data source adapter for connecting multiple types of databases, the system's local database or external system databases, is developed. When the interface is called, the adapter creates a database connection according to the configured database information for executing the SQL template configured in the next - step interface definition.
[0027] S102: Define a multi - data source adapter and create a corresponding one according to the database information configured in the front - end interface. In this embodiment, in the back - end code, define a multi - data source adapter class or module. The adapter class is used to handle the connection logic of databases such as MySQL, Oracle, SQL Server, etc.
[0028] In the adapter class, the database information transmitted from the front - end interface can be received as a parameter, and according to the database type, use the JDBC driver for MySQL, the OCI driver for Oracle, etc. to create a database connection object. It realizes the unified connection management of multiple types of databases and improves the scalability of the system.
[0029] S103: Define the basic information of the interface and the corresponding SQL template.
[0030] This embodiment can create a data structure to define the basic information of the interface, including information such as the interface name, interface description, and interface version. For each interface, write the corresponding SQL template. The SQL template contains SQL statements corresponding to business requirements and uses placeholders to represent the parameters that need to be dynamically passed in.
[0031] S104: Configure the request parameter list and define the parameters and parameter types corresponding to the placeholders in the SQL template.
[0032] This embodiment creates a list or array to store the request parameter information. For each placeholder in the SQL template, define the corresponding parameter name in the request parameter list and clarify its data type (such as integer, string, date, etc.). At the same time, other attributes of the parameter can also be set, such as whether it is required, default value, etc. This can define the input parameters required by the interface, including the type and other constraints of the parameters, ensuring that the parameters passed in when the interface is called are accurate and improving the stability of the interface.
[0033] S105: Generate request parameters according to the request parameter list and define a data model to describe the response parameters of the interface.
[0034] This embodiment generates an actual request parameter object according to the parameter names, types, and other attributes in the request parameter list. A data model can be defined to describe the response parameters of the interface. The data model should clarify information such as the name, type, and data format of the response parameters, which is used to standardize the data structure returned by the interface. It is convenient for the front-end or other callers to parse and process, improving the usability of the interface.
[0035] S106: Debug and verify the interface and publish the verified interface.
[0036] This embodiment can call the interface and check the return results for different input situations of the interface. A unit test framework can be used to automate the execution of these test cases. During the test, performance metrics of the interface, such as response time, throughput, etc., can be checked to ensure that the interface can meet the performance requirements in the actual usage scenario.
[0037] When the interface passes the debugging and verification, deploy it to the system in use for users to call.
[0038] Combined with the above steps, by creating a front-end interface to collect database information and using a multi-data source adapter to create a database connection, the configuration and creation process of the database connection are standardized and visualized, improving the compatibility of the system with different databases. Define the basic information of the interface and the SQL template, as well as configure the request parameter list, separating the definition of the interface from the parameter configuration, making the business logic and input parameters of the interface clearer. This separation method is convenient for maintenance and modification, and also improves the reusability of the interface. Generate a data model for request parameters and define response parameters, further standardizing the input and output of the interface. Through the definition of the data model, the data structure returned by the interface is clear. Debug, verify and publish the interface, ensuring the quality and usability of the interface and improving the stability of the system.
[0039] Compared with the prior art, in this method, the basic information of the interface, the SQL template and the request parameter list are defined separately, making the code structure clearer and improving the reusability and scalability of the interface. By writing test cases and performance checks to ensure that the interface meets the requirements in terms of both function and performance before publishing, the overall quality and stability of the system are improved.
[0040] In an embodiment of the present invention, based on S103: after defining the basic information of the interface and the corresponding SQL template, the following possible embodiment is also involved, and its specific implementation scheme is described non-restrictively below.
[0041] Step 111: Obtain the initial SQL template and configure the initial SQL template through a preset definition method to obtain interface information.
[0042] Step 112: Configure the interface information to obtain multiple interface item information.
[0043] Step 113: Configure interface placeholders for each interface item information to generate corresponding interface item information for each interface item information.
[0044] Step 114: Input each interface item information into the trained interface information identification model for item information recognition, and output multiple interface parameters. The trained interface information identification model is trained based on the basic training information of the interface under the preset definition method.
[0045] Step 115: Determine the interface attributes corresponding to each interface parameter, and define interface business information in each interface parameter according to the interface attributes.
[0046] In some embodiments, a preset definition method is adopted to configure the initial SQL template to obtain interface information, and the following method can be specifically adopted: Step 1011: Define a template engine.
[0047] The defined template engine can use the Jinja2 template engine or the FreeMarker template engine to parse and render the initial SQL template. The template engine embeds variables and logical control structures in the SQL template. By passing in interface data, the template engine can generate specific SQL statements.
[0048] The template engine itself can be regarded as a kind of model, which defines how to combine the template and context data to generate the final SQL statement.
[0049] Step 1012: Use the configuration management tool to define the interface information of the SQL template and configure the SQL pre-compiled statement.
[0050] The configuration management tool can adopt the YAML configuration management tool or the JSON configuration management tool to define the interface information of the SQL template. These interface information can include variable names, data types, default values, etc., which are used to replace the placeholders in the template in subsequent steps.
[0051] The structure and syntax of the interface configuration file can be regarded as a kind of model, which defines how to organize and store the interface information of the SQL template.
[0052] Step 1013: Configure the SQL pre-compiled statement.
[0053] Replace the variable parts in the SQL template with placeholders, and then create a pre-compiled statement. When executing, specific parameter values are passed in to replace the placeholders, thereby generating specific SQL statements.
[0054] The pre-compiled statement itself can be regarded as a kind of model, which defines how to combine the template and parameters to generate the final SQL statement. In addition, the database management system also provides APIs or tools that support pre-compiled statements, which can also be regarded as part of the model.
[0055] Taking the SQL pre-compiled statement as an example, the specific execution method is as follows: Define an SQL template and create a prepared statement. You can use the prepare method of the database connection object to create a prepared statement object. For example, in Python, use the mysql.connector library. Use the bind_param method of the prepared statement object to bind parameters to placeholders. The parameters can be of types such as strings, integers, floating-point numbers, etc. Set specific values for each parameter. These values can be obtained from user input, interface configuration files, other database query results, etc. Use the execute method of the prepared statement object to execute the query operation. When executing, the database will replace the placeholders with the bound parameter values and execute the corresponding query operation. Obtain the query results through methods such as fetchall of the prepared statement object and perform corresponding processing.
[0056] In step 111, the preset definition method can be implemented by means of a template engine, a configuration management tool, or an SQL prepared statement, etc. Variable parts can be embedded in the SQL template, and the final SQL statement can be generated by passing in specific parameter values.
[0057] In step 112, perform configuration processing on the interface information to obtain multiple interface item information, specifically including the following methods: Determine the preset configuration parameters corresponding to the preset parameters in the interface information; perform configuration processing on the interface information according to the preset configuration parameters to obtain multiple interface item information.
[0058] For this embodiment, in step 112, first, parse the interface information to identify the preset parameters therein. These preset parameters usually exist in the interface information in a specific marker or format.
[0059] Match the parsed preset parameters with the preset configuration parameters. The preset configuration parameters are stored in an interface configuration file, and the interface configuration file defines the configuration values or configuration logics corresponding to each preset parameter. These configuration values or configuration logics can be static or dynamic, depending on specific requirements.
[0060] According to the matching result, apply the corresponding configuration logic to perform configuration processing on the interface information. Specifically, it includes replacing the preset parameters with specific configuration values, dynamically generating interface item information according to the values of the preset parameters, or selecting different configuration paths according to the values of the preset parameters, etc.
[0061] After the configuration processing, multiple interface item information is generated. These interface item information may include different configuration values, different interface paths, or different interface parameters, etc., depending on the configuration logic and the values of the preset parameters.
[0062] In this embodiment, by matching and applying preset parameters and preset configuration parameters, multiple interface item information can be quickly generated, improving the configuration efficiency. Compared with manually configuring each interface item information, this method is more efficient. The preset configuration parameters usually go through verification and testing to ensure their correctness and reliability. By applying these preset configuration parameters, errors and omissions that may occur during the manual configuration process can be reduced, and the accuracy and stability of the interface information can be improved. The preset configuration parameters can be dynamically adjusted and optimized according to specific requirements. When the business requirements change, only the preset configuration parameters need to be modified to quickly adapt to the new requirements, without the need to make a large number of modifications and reconstructions to the interface information.
[0063] In this embodiment, the configuration logic of the interface information is separated from the specific business logic, making the configuration of the interface information clearer and easier to maintain. When it is necessary to modify or update the interface information, only the modification of the preset configuration parameters needs to be concerned, without the need to deeply understand the specific business logic.
[0064] Generally speaking, in step 112, by determining the specific implementation methods of preset parameters, matching preset configuration parameters, applying configuration logic, and generating multiple interface item information, the configuration efficiency can be improved and errors can be reduced.
[0065] For step 112, the interface information can be configured to obtain multiple interface item information, and multiple methods can be used to execute it. This embodiment can determine the preset configuration parameters corresponding to the preset parameters and configure the interface information according to these parameters. The following gives a method that can be executed: Step 1021: Parse the interface information, parse the initial interface information, and extract the preset parameters therein. These preset parameters exist in the interface information in a specific marker or format.
[0066] Step 1022: Match the parsed preset parameters with the preset configuration parameters.
[0067] The preset configuration parameters are usually stored in an interface configuration file, which defines the configuration values or configuration logic corresponding to each preset parameter.
[0068] Step 1023: According to the matching result, apply the configuration logic to configure the interface information.
[0069] This embodiment can include replacing the preset parameters with specific configuration values, dynamically generating interface item information according to the values of the preset parameters, or selecting different configuration paths according to the values of the preset parameters, etc.
[0070] Step 1024: After configuration processing, multiple interface item information is generated. The interface item information may include different configuration values, different interface paths, or different interface parameters, etc., specifically depending on the configuration logic and the values of the preset parameters.
[0071] One possible example of this embodiment is: Initial interface information: Interface description or definition containing preset parameters. Preset configuration parameters: Mapping relationship between parameters and configuration values stored in the interface configuration file.
[0072] Use regular expressions or parsers to parse the initial interface information and extract the preset parameters. Traverse the preset configuration parameters and match the parsed preset parameters with the preset configuration parameters. If a match is found, extract the corresponding configuration value or configuration logic.
[0073] According to the matching results and configuration logic, perform configuration processing on the interface information. This includes replacing the preset parameters with specific configuration values, dynamically generating interface item information, or selecting different configuration paths, etc. Generate multiple interface item information, and each interface item information may include different configuration values, interface paths, or interface parameters.
[0074] Through the above method, the configuration of the interface information can be realized, thereby obtaining multiple interface item information.
[0075] In step 113 of this embodiment, interface placeholder configuration is performed on each interface item information to generate interface item information corresponding to each interface item information.
[0076] Among them, each interface item information corresponds to parameter information, and each interface item information can be configured to generate machine language that the trained interface information recognition model can understand, such as generating a corresponding vector, and this vector is the interface item information corresponding to the interface item information.
[0077] Exemplarily, use a neural network, such as a convolutional neural network (CNN) or a recurrent neural network (RNN), to configure the parameter information. Take the parameter information as input and, through the layers of processing of the network, obtain a fixed-length vector as output. After configuring each interface item information, the interface item information corresponding to each interface item information is obtained.
[0078] In step 113, interface placeholder configuration is performed on each interface item information to generate interface item information corresponding to each interface item information, that is, the parameter information is converted into machine language that the trained interface information recognition model can understand, such as a vector. The following specific execution methods can be adopted: Step 1031: Parse the interface item information to identify the parameter information therein. These parameter information may exist in the interface item information in a specific format or mark.
[0079] Step 1032: Define placeholder rules according to the structure and requirements of the interface item information. The placeholder rules are used to specify which parts need to be replaced with placeholders and the specific format of the placeholders.
[0080] Step 1033: Use the defined placeholder rules to replace the parameter information in the interface item information with the corresponding placeholders. In this way, the interface item information becomes a template containing placeholders.
[0081] Step 1034: Convert the interface item information containing placeholders into a machine language that the trained interface information recognition model can understand, such as a vector. This can be achieved by mapping each placeholder and other text in the interface item information to a high-dimensional vector space.
[0082] Step 1035: Store the generated vector representation for use in subsequent steps. At the same time, the vector representation can also be passed to other systems or components for further processing.
[0083] It can be seen that using placeholders to configure interface item information can improve the flexibility of configuration. When the structure or parameters of the interface item information change, only the placeholder rules need to be modified to quickly adapt to new requirements, without the need to make a large number of modifications to the interface item information. Converting the interface item information into a vector representation can enhance the model's understanding ability. The trained interface information recognition model can directly process the vector representation without the need for complex parsing and processing of the interface item information. Using placeholders and vector representations can facilitate the extension and integration of other systems or components. For example, the generated vector representation can be passed to other machine learning models for further analysis or prediction.
[0084] In summary, the specific execution methods of parsing interface item information, defining placeholder rules, replacing with placeholders, generating vector representations, and storing and passing in step 113 can improve the flexibility of configuration, enhance the model's understanding ability, improve processing efficiency, and facilitate extension and integration. These beneficial effects make the call configuration method for SQL template-based publishing interfaces more efficient, flexible, and reliable.
[0085] It should be noted that on the above basis, the execution method of step 113 in this embodiment also involves lexical analysis and feature extraction.
[0086] Before performing interface placeholder configuration and vector generation, lexical analysis needs to be performed on the interface item information to extract the key features therein.
[0087] For example, split the interface item information (such as SQL statements, parameter information, etc.) into individual words or tokens. To convert the text information into vectors, build a vocabulary and map all possible words or tokens to unique integer indices. Traverse all the interface item information, collect all the words or tokens, and assign a unique integer index to each word or token.
[0088] Replace the placeholder in the interface item information with the actual parameter value. Here, traverse the SQL statement in the interface item information to find the placeholder. According to the parameter information in the interface item information, replace the placeholder with the actual parameter value. Convert the processed interface item information into a vector representation so that the trained interface information recognition model can understand it. After converting the interface item information into a vector representation, the trained interface information recognition model can directly process these vectors.
[0089] In step 114, input each interface item information into the trained interface information recognition model for item information recognition, and output multiple interface parameters. The trained interface information recognition model is trained based on the interface basic training information under a preset definition method.
[0090] This application provides a trained multi - language configuration model, which consists of two parts: a trained configuration model and a trained interface information recognition model. The input of the trained configuration model is the interface item information, and then the trained configuration model inputs the output interface response features into the trained interface information recognition model, and the trained interface information recognition model outputs interface parameters.
[0091] In step 114, input each interface item information into the trained interface information recognition model for item information recognition, and output multiple interface parameters. The specific execution method is as follows: Obtain each interface item information from step 113. Since the interface item information has gone through interface placeholder configuration, a corresponding vector representation can be generated.
[0092] Combined with the appendix Figure 2 Speaking of which, the interface item information can be the interface number, interface name, interface URL, and data source connection, etc. The corresponding interface parameters are the parameters that need to be set inside the relevant dialog boxes corresponding to the interface number, interface name, interface URL, and data source.
[0093] Load the trained interface information recognition model. The interface information recognition model is trained based on the interface basic training information under a preset definition method and can identify and parse the parameters and features in the interface item information. Input the vector representation of each interface item information into the trained interface information recognition model.
[0094] The interface information recognition model performs inference on the input vector representation to identify the parameters and features in the interface item information. This process may involve calculations of multi-layer neural networks, including operations such as convolution, pooling, and fully connected. After the model inference is completed, multiple interface parameters are output. The interface parameters are recognized by the model based on the input interface item information and may include the name, type, parameter values, etc. of the interface. Post-processing is performed on the output interface parameters, such as format conversion, data verification, etc., to ensure that they meet the requirements of subsequent business logic.
[0095] It can be seen that the trained interface information recognition model can accurately identify the parameters and features in the interface item information, thereby improving the output accuracy of the interface parameters. By training different interface information recognition models, it is possible to adapt to the identification of interface item information in different scenarios and requirements. This enables the scalability of the call configuration method for SQL template-based published interfaces.
[0096] In some embodiments, each interface item information is input into the trained interface information recognition model for item information recognition, and multiple interface parameters are output, including: Step 1141: Determine the corresponding interface parameter interface information for each interface item information, and combine each interface item information with the interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information; Step 1142: Input each target interface item information into the trained interface information recognition model for item information recognition, and output multiple interface parameters.
[0097] In this embodiment, the corresponding interface parameter interface information is determined for each interface item information, and each interface item information is combined with the interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information.
[0098] After obtaining multiple interface parameters, the following steps can be further performed to improve the call configuration of the SQL template-based published interface. Specifically, it involves the following methods: Verify the output multiple interface parameters to ensure that the parameters meet the business rules and data integrity requirements. For example, check whether the data type of the parameter is correct, whether the value range is reasonable, etc.
[0099] Determine the interface attributes corresponding to each interface parameter, and define the interface business information in each interface parameter according to the interface attributes. The interface attributes may include the purpose, business meaning, relationship with other parameters, etc. of the parameter.
[0100] Generate the interface call configuration according to the verified interface parameters and the defined business information. The configuration may include information such as the call address, request method, request headers, request body, etc. of the interface.
[0101] Invoke the interface using the generated interface call configuration and process the result returned by the interface. The result can be parsed, stored, or displayed according to business requirements.
[0102] Based on the above embodiments, in order to further improve the reliability of item information recognition provided by the above embodiments, this embodiment also determines corresponding interface parameter interface information for each interface item information, and combines each interface item information with the interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information. The interface parameter interface information can include information such as the data type, value range, default value, and whether it is required of the parameter.
[0103] Here, according to the SQL statement structure and keywords in the interface item information, rules are formulated to infer the interface information of the parameter. Create an interface configuration file to record the parameter interface information corresponding to each interface item information. During execution, find the corresponding interface information from the interface configuration file according to the identifier of the interface item information. Merge the interface item information and the corresponding interface parameter interface information into a new target interface item information. A dictionary can be used to store this information, with the interface item information and the parameter interface information as different fields of the dictionary.
[0104] Input each target interface item information into the trained interface information identification model for item information recognition, and output multiple interface parameters.
[0105] This embodiment can be based on a trained interface information identification model, which can be a neural network, a decision tree, etc. The model analyzes and identifies the input target interface item information based on the learned knowledge and outputs multiple interface parameters.
[0106] Through the above steps, the recognition from interface item information to interface parameters can be completed, and further operations such as parameter verification, business information definition, interface call configuration generation, and interface call can be carried out to achieve a complete call configuration for publishing an interface based on an SQL template.
[0107] After completing the steps mentioned above, in order to further improve the call configuration for publishing an interface based on an SQL template, record the timestamps before and after the interface call, calculate the difference between the two to obtain the interface response time, and promptly detect interface performance anomalies.
[0108] Enable SQL execution logs at the database end to record information such as the execution time and scanned row count of each SQL statement. The built-in performance analysis tool of the database can be used to analyze the SQL statements to find SQL statements with poor performance and improve the response speed of the interface.
[0109] In step 105, determine the interface attributes corresponding to each interface parameter, and define interface service information in each interface parameter according to the interface attributes.
[0110] In some embodiments of the present application, the specific implementation manner of step 105 is to create a data dictionary to record the detailed information of each field in the database, including field name, data type, meaning, constraint conditions, etc. For each interface parameter, find the corresponding field information in the data dictionary through the parameter name, so as to determine its interface attributes.
[0111] In this embodiment, infer the interface attributes according to the characteristics of the interface parameter name, position in the SQL statement, relationship with other parameters, etc. For example, if the parameter name contains an interface number and an interface name, it can be inferred the interface URL and data source connection.
[0112] In this embodiment, after determining the interface attributes, match the name of the interface parameter with a predefined data dictionary or rule to obtain its corresponding interface attributes. In addition to parameter name matching, context information such as the SQL template and business scenario of the interface can also be combined to further determine the interface attributes.
[0113] According to the interface attributes, associate them with specific business rules and business logics to define interface service information. Considering the actual needs and business goals of users, transform the interface attributes and business rules into clear business information. In this embodiment, by clarifying the interface attributes and business information of each interface parameter, developers and other relevant personnel can understand the function and usage method of the interface.
[0114] Based on the above steps 111 to 115, the following is a detailed implementation manner of the present application, and the method may include the following steps: Step 201, obtain an initial SQL template, and configure the initial SQL template through a preset definition method to obtain interface information.
[0115] Obtain the initial SQL template from the database. Add interface-related information to the SQL template through a preset definition method, including interface name, description, input and output parameters, etc. In this way, the original SQL template can be transformed into interface information with clear business meanings and call rules, which is convenient for subsequent management and call.
[0116] Step 202, determine the preset configuration parameters corresponding to the preset parameters in the interface information.
[0117] In this embodiment, analyze the preset parameters in the interface information to clarify the name and function of the parameters. According to the preset rules or interface configuration files, find the preset configuration parameters corresponding to each preset parameter, such as data type, value range, default value, etc.
[0118] Step 203: Configure and process the interface information according to the preset configuration parameters to obtain multiple interface item information.
[0119] In this embodiment, different value combinations of the preset parameters are made according to the preset configuration parameters. Each value combination can be substituted into the SQL template of the interface information to generate different SQL statements, and each SQL statement corresponds to an interface item information. Multiple different interface item information can be generated to meet different business query requirements and improve the applicability of the interface.
[0120] Step 204: Determine the arrangement order of each interface item information corresponding to the interface item information in the interface information.
[0121] In this embodiment, the interface item information can be sorted according to a preset rule (such as according to the parameter value size, alphabetical order, etc.). An arrangement order number is assigned to each interface item information.
[0122] Step 205: Perform preset interface parameter configuration on each interface item information according to the arrangement order to obtain the first interface parameter interface information.
[0123] Process each interface item information in sequence according to the arrangement order. According to the first preset interface parameter configuration rule, operations such as modifying, adding, or deleting parameters in the interface item information are performed to obtain the first interface parameter interface information. Perform the first customization configuration on the interface item information to meet specific business requirements and enhance the function of the interface.
[0124] Step 206: Perform second preset interface parameter configuration on each interface item information according to the arrangement order to obtain the second interface parameter interface information.
[0125] In this embodiment, each interface item information is also processed in the arrangement order. According to the second preset interface parameter configuration rule, the parameters in the interface item information are further adjusted to obtain the second interface parameter interface information.
[0126] Step 207: Combine each interface item information, the first interface parameter interface information and the second interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information.
[0127] Integrate the interface item information, the first interface parameter interface information and the second interface parameter interface information. Package the integrated information into a new target interface item information object. Combine the interface information at different stages to form a complete and customized target interface item information, which is convenient for subsequent model processing.
[0128] Step 208: Input each piece of target interface item information into the first long short-term memory network to obtain the sub-interface response features output by the first long short-term memory network.
[0129] In this embodiment, the target interface item information is converted into an input format (such as a vector, matrix, etc.) that the first sub-configuration model can accept. The converted input data is input into the first sub-configuration model for processing. The sub-interface response features output by the first sub-configuration model are obtained. Through model processing, valuable sub-interface response features are extracted from the target interface item information.
[0130] Step 209: Input the sub-interface response features output by the first long short-term memory network into the subsequent long short-term memory network to obtain the sub-interface response features output by the subsequent long short-term memory network.
[0131] In this embodiment, the sub-interface response features output by the first sub-configuration model are used as the input of the subsequent sub-configuration model. Necessary format conversion and preprocessing are performed on the input data. The processed input data is input into the subsequent sub-configuration model for processing to obtain new sub-interface response features. Through the cascaded processing of multiple sub-configuration models, the interface response features are gradually extracted and transformed, improving the expression ability of the features.
[0132] Step 210: Repeat the process of inputting the sub-interface response features output by the previous long short-term memory network into the subsequent long short-term memory network until the interface response features corresponding to each piece of target interface item information are output by the last long short-term memory network.
[0133] Set the number and order of the sub-configuration models. Sequentially use the output of the previous sub-configuration model as the input of the next sub-configuration model, and repeat the model processing. Until the interface response features corresponding to each piece of target interface item information are output by the last sub-configuration model. Through the in-depth processing of multiple-level models, the potential features in the interface item information are fully mined, improving the accuracy and representativeness of the interface response features.
[0134] Step 211: Obtain the task text and the task interface item information corresponding to the task text.
[0135] In this embodiment, the task interface item information and the interface response features are integrated to form input data. The input data is converted into a format that the interface information identification model can accept. The converted input data is input into the trained interface information identification model for processing. The interface parameters corresponding to the target interface item information output by the interface information identification model are obtained. Through the interface information identification model, the required interface parameters are accurately identified based on the task interface item information and the interface response features, providing information for interface calls.
[0136] Step 212: Input the task interface item information and each interface response feature into the trained interface information identification model, and output the interface parameters corresponding to the target interface item information.
[0137] In this embodiment, starting from obtaining the initial SQL template, interface information is obtained through preset configuration, and then multiple interface item information is generated according to the preset parameter configuration. The conversion from the static SQL template to diverse interface item information is realized. Determine the arrangement order of the interface item information, and perform two preset interface parameter configurations. Finally, the target interface item information is integrated and generated. The interface item information is customized and integrated, improving the applicability of the interface. Through the cascaded processing of multiple sub-configuration models, the interface response features are gradually extracted and transformed, and finally high-quality interface response features are obtained. Input the task interface item information and the interface response features into the interface information identification model, and output the interface parameters. This step combines the task requirements and the interface features, and accurately identifies the required interface parameters. Combine the task interface item information with the interface response features, input them into the interface information identification model for parameter identification, making the identification of the interface parameters more in line with the actual task requirements and improving the accuracy of interface calls.
[0138] In some specific embodiments, steps 208 to 210 involve long short-term memory networks. The long short-term memory network LSTM can handle long-term dependencies in sequential data and is suitable for processing SQL interface item information with time series characteristics.
[0139] The specific execution method is as follows: Step 401: Data preprocessing.
[0140] Convert the target interface item information into sequential data. For example, split the SQL statement into a word sequence. Use word embedding techniques (such as Word2Vec, GloVe) to convert each word into a fixed-length vector to obtain the input sequence. Pad or truncate the input sequence to make it have the same length to meet the input requirements of the model.
[0141] Step 402: Model construction. Determine the dimension of the input layer, that is, the dimension of the word embedding vector. Select the number of hidden units and the number of layers of the LSTM layer. The selection of the number of hidden units and the number of layers will affect the expressive ability and computational complexity of the model. Add a fully connected layer to map the output of the LSTM layer to the dimension of the required sub-interface response features.
[0142] Step 403: Model training.
[0143] Prepare the training data, which is also divided into a training set and a validation set. Select an appropriate loss function according to the specific task. Select an optimizer and train the model through multiple iterations. In each iteration, input the input sequence into the LSTM model, calculate the loss function, and update the model parameters. Use the validation set to evaluate the model performance and adjust the hyperparameters to avoid overfitting.
[0144] Step 404: Model inference.
[0145] Convert the information of each target interface item into an input sequence and input it into the trained LSTM model. The model calculates based on the input sequence and outputs the sub-interface response features.
[0146] In this application, based on the above-mentioned call configuration method for SQL template-based published interfaces, after the interface definition is completed, it can be tested and verified through the debugging function provided by the front-end function interface. If an exception is found during the test, return to the editing interface for modification and then re-debug and verify. After the test verification is okay and meets the requirements, it can be dynamically published through the publish function on the interface and then go online for use. If the business requirements of this interface change, the service can be disabled through the front-end interface for corresponding modification and then republished. The enabling and disabling of the service are both dynamic, so there is no need to disable the entire application server for redeployment, which can greatly improve the development efficiency.
[0147] Based on the method of this application, interface documents can be automatically generated for the callers according to the information of the interface definition (number, name, url address, parameter list, etc.); access control over interface calls can also be implemented based on the interface's interface management function. It can be extended and developed according to actual needs.
[0148] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0149] The following are embodiments of a call configuration system for SQL template-based published interfaces provided by the embodiments of the present disclosure. This system and the call configuration method for SQL template-based published interfaces in the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiments of the call configuration system for SQL template-based published interfaces, reference can be made to the embodiments of the call configuration method for SQL template-based published interfaces.
[0150] As Figure 4 shown, the system includes: An information configuration module for creating a data source connection front-end interface and configuring database information; An information creation definition module, which is used to define a multi-data source adapter and create a corresponding database connection according to the database information configured in the front-end interface.
[0151] A template configuration module, which is used to define basic interface information and corresponding SQL templates.
[0152] A parameter definition module, which is used to configure a list of request parameters and define parameters and parameter types corresponding to placeholders in the SQL template.
[0153] A parameter response module, which is used to generate request parameters according to the list of request parameters and define a data model to describe the response parameters of the interface.
[0154] A verification and release module, which is used to debug and verify the interface and release the verified interface.
[0155] As Figure 5 shown, the present application further provides an electronic device, including a display module 103, a memory 102, a processor 101, and a computer program stored on the memory and executable on the processor 101. When the processor 101 executes the program, it implements the steps of the method for calling and configuring an interface published based on an SQL template.
[0156] In the embodiments of the present invention, the electronic device includes, but is not limited to, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described herein and / or claimed.
[0157] In the embodiments of the present application, the processor 101 may be implemented by using at least one of an application specific integrated circuit (ASIC), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microprocessor, and an electronic unit designed to execute the functions described herein. In some cases, such an implementation may be implemented in a controller. For a software implementation, an implementation of a process or function may be implemented with a separate software module that allows execution of at least one function or operation. The software code may be implemented by a software application (or program) written in any suitable programming language. The software code may be stored in a memory and executed by a controller.
[0158] The display module 103 is used to display information input by the user or information provided to the user. The display module 103 may include a display panel, and the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0159] The memory 102 may be used to store software programs and various data. The memory 102 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0160] The present application also provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for calling and configuring an SQL template publishing interface are implemented.
[0161] The storage medium may be any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0162] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for call configuration based on an SQL template publishing interface, characterized in that, The method includes: Create a data source connection front-end interface and configure database information; Define a multi-data source adapter and create corresponding database connections according to the database information configured in the front-end interface; Define the basic interface information and the corresponding SQL templates; Configure the request parameter list and define the parameters and parameter types corresponding to the placeholders in the SQL templates; Generate request parameters based on the request parameter list and define a data model to describe the response parameters of the interface; Debug and verify the interface and publish the verified interface.
2. The invocation configuration method based on the SQL template publishing interface according to claim 1, wherein In the method, the step of defining the basic interface information and the corresponding SQL templates further includes: Obtain the initial SQL template and configure the initial SQL template through a preset definition method to obtain interface information; Perform configuration processing on the interface information to obtain multiple interface item information; Input each interface item information into the trained interface information identification model for item information identification, and output multiple interface parameters. The trained interface information identification model is trained based on the basic interface training information under the preset definition method; Determine the interface attributes corresponding to each interface parameter and define interface business information in each interface parameter according to the interface attributes.
3. The call configuration method based on the SQL template publishing interface according to claim 2, wherein, The step of obtaining the initial SQL template and configuring the initial SQL template through a preset definition method to obtain interface information further includes: defining a template engine; using a configuration management tool to define the interface information of the SQL template and configure the SQL pre-compiled statement.
4. The call configuration method based on the SQL template publishing interface according to claim 2, characterized in that The step of performing configuration processing on the interface information to obtain multiple interface item information further includes: Determine the preset configuration parameters corresponding to the preset parameters in the interface information; perform configuration processing on the interface information according to the preset configuration parameters to obtain multiple interface item information.
5. The invocation configuration method based on the SQL template publishing interface according to claim 2, wherein The step of performing interface placeholder configuration on each interface item information to generate the interface item information corresponding to each interface item information further includes: Parse the interface item information and identify the parameter information therein; Define placeholder rules according to the structure and requirements of the interface item information; Use the defined placeholder rules to replace the parameter information in the interface item information with corresponding placeholders; Convert the interface item information containing placeholders into a machine language that the trained interface information identification model can understand by mapping each placeholder and other texts in the interface item information to a high-dimensional vector space; Store the generated vector representation.
6. The invocation configuration method based on the SQL template publishing interface according to claim 2, characterized in that The step of inputting each interface item information into the trained interface information identification model for item information identification and outputting multiple interface parameters further includes: Determine the corresponding interface parameter interface information for each interface item information, and combine each interface item information and the interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information; Input each target interface item information into the trained interface information identification model for item information identification, and output multiple interface parameters; After obtaining multiple interface parameters, publish the call configuration of the interface based on the SQL template.
7. The invocation configuration method based on the SQL template publishing interface according to claim 1 or 2, characterized in that, The method further includes: obtaining the initial SQL template and configuring the initial SQL template through a preset definition method to obtain interface information; Determine the preset configuration parameters corresponding to the preset parameters in the interface information; Perform configuration processing on the interface information according to the preset configuration parameters to obtain multiple interface item information; Determine the arrangement order of each interface item information corresponding to the interface item information in the interface information; Perform the first preset interface parameter configuration on each interface item information according to the arrangement order to obtain the first interface parameter interface information; Perform the second preset interface parameter configuration on each interface item information according to the arrangement order to obtain the second interface parameter interface information; Combine each interface item information, the first interface parameter interface information and the second interface parameter interface information corresponding to each interface item information to generate the target interface item information corresponding to each interface item information; Input each target interface item information into the first long short-term memory network to obtain the sub-interface response features output by the first long short-term memory network; Input the sub-interface response features output by the first long short-term memory network into the next long short-term memory network to obtain the sub-interface response features output by the next long short-term memory network; Repeat inputting the sub-interface response features output by the previous long short-term memory network into the next long short-term memory network until the last long short-term memory network outputs the interface response features corresponding to each target interface item information; Obtain the task text and the task interface item information corresponding to the task text; Input the task interface item information and each interface response feature into the trained interface information identification model to output the interface parameters corresponding to the target interface item information.
8. A call configuration system based on an SQL template publishing interface, characterized in that, The system is used to implement the call configuration method of the SQL template-based publishing interface as described in any one of claims 1 to 7; The system includes: An information configuration module for creating a data source connection front-end interface and configuring database information; An information creation definition module for defining a multi-data source adapter and creating a corresponding database connection according to the database information configured in the front-end interface; A template configuration module for defining the basic interface information and the corresponding SQL template; A parameter definition module for configuring a request parameter list and defining the parameters and parameter types corresponding to the placeholders in the SQL template; A parameter response module for generating request parameters according to the request parameter list and defining a data model to describe the response parameters of the interface; A verification and publishing module for performing debug verification on the interface and publishing the verified interface.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the call configuration method of the SQL template-based publishing interface as described in any one of claims 1 to 7.
10. A storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements the steps of the call configuration method of the SQL template-based publishing interface as described in any one of claims 1 to 7.