Script execution method, device, electronic device and storage medium

By executing and verifying the data script in the test database in multiple environments, and then automatically transferring it to the production database, the problem of low data script execution efficiency and consistency in multiple environments is solved, and efficient and automated data script execution is achieved. .

CN113377468BActive Publication Date: 2024-10-01AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110745716.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-30
Publication Date
2024-10-01
Estimated Expiration
2041-06-30

AI Technical Summary

Technical Problem

During the development process of software projects, the execution efficiency of data scripts in multiple environments is low, and execution consistency cannot be guaranteed, which increases the workload of developers and involves manual operation risks.

Method used

By obtaining the target script during the running of the software, it is first executed in the test database according to the specified execution process. If the result meets the preset conditions, the script is transferred to the production database and executed to ensure the execution consistency of the scripts in each database and to achieve automation. implement.

Benefits of technology

It improves the execution efficiency of data scripts, ensures execution consistency between databases, reduces manual operation risks, and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113377468B_ABST
    Figure CN113377468B_ABST
Patent Text Reader

Abstract

The present application provides a script execution method, device, electronic device and storage medium. The method includes: during the software running process, obtaining a target script for modifying the function of the software, wherein the running environment of the software includes a test database and a production database; executing the target script in the test database according to a specified execution process to obtain an execution result; if the execution result meets a preset condition, transferring the target script to the production database, and executing the target script in the production database according to the specified execution process to modify the function of the software. The present application can ensure the consistency of data scripts when they are executed in various databases, and can automatically execute data scripts in various databases, thereby improving the execution efficiency of data scripts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a script execution method, device, electronic device and storage medium. Background Art

[0002] At present, the development process of general software projects involves multiple environments. First, the development environment (DEV) is used by developers to carry out code development work for corresponding requirements, followed by the test environment (TEST) for testers to test, then the pre-production environment (PREPROD) for trial operation, and finally the production environment (PROD), which is the formal operation environment. The database is also the basic software required when the application software runs in multiple environments, and each environment needs to contain the corresponding database.

[0003] During the iterative development of a project or the operation of application software, it is often necessary to add, delete, or modify the application data in the database to modify some functions of the software. These addition, deletion, and modification operations are implemented by executing data scripts in the database.

[0004] However, since there are multiple operating environments in the project, it is often necessary to execute the same data script in these multiple environments, and the execution order of the scripts must also be consistent. However, in the development environment, test environment, and quasi-production environment, data deployment is implemented manually by developers.

[0005] Therefore, in the whole process, developers need to repeat the above steps to deploy resources to multiple environments. This greatly increases the workload of developers and causes low efficiency in data script execution. Moreover, these operations are independent of each other, the consistency of resources deployed in each environment cannot be guaranteed, resource versions cannot be strictly traced, and manual operations also have many unavoidable risks. Summary of the invention

[0006] The present application provides a script execution method, device, electronic device and storage medium to solve the problem that the execution efficiency of data scripts used to modify software functions is low and the execution consistency cannot be guaranteed.

[0007] In a first aspect, an embodiment of the present application provides a script execution method, comprising:

[0008] During the software running process, obtaining a target script for modifying the function of the software, wherein the running environment of the software includes a test database and a production database;

[0009] Execute the target script in the test database according to the specified execution process to obtain an execution result;

[0010] If the execution result meets the preset condition, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the function of the software.

[0011] In an optional implementation manner, the test database includes a plurality of sub-databases, and executing the target script in the test database according to a specified execution process to obtain an execution result includes:

[0012] Acquire a current sub-database that is executing the target script according to the specified execution process from the multiple sub-databases;

[0013] Obtaining an initial execution result of the current sub-database for the target script;

[0014] If the initial execution result is normal, obtaining the alias corresponding to the current sub-database;

[0015] If the alias corresponding to the current sub-database is a specified alias, it is determined that the execution result meets a preset condition.

[0016] In an optional implementation manner, executing the target script in the test database according to a specified execution process to obtain an execution result further includes:

[0017] If the alias corresponding to the current sub-database is not the designated alias, obtaining a sub-database associated with the alias corresponding to the current sub-database from the multiple sub-databases as a new current sub-database;

[0018] Obtaining an initial execution result of the new current sub-database for the target script;

[0019] If the initial execution result of the new current sub-database for the target script is normal, obtaining an alias corresponding to the new current sub-database;

[0020] If the alias corresponding to the new current sub-database is the specified alias, it is determined that the execution result meets the preset condition.

[0021] In an optional implementation manner, executing the target script in the test database according to a specified execution process to obtain an execution result further includes:

[0022] If the initial execution result is abnormal, the target script is re-uploaded to the current sub-database.

[0023] In an optional embodiment, the multiple sub-databases include a development sub-database, a test sub-database and a pre-production sub-database, wherein the development sub-database, the test sub-database, the pre-production sub-database and the production database are associated with each other in an execution order through aliases, and the execution order is the development sub-database, the test sub-database, the pre-production sub-database and the production database.

[0024] In an optional implementation, the test database includes a development sub-database, a test sub-database, and a pre-production sub-database, and executing the target script in the test database according to a specified execution process to obtain an execution result includes:

[0025] Execute the target script in the development sub-database according to the specified execution process to obtain a first execution result;

[0026] If the first execution result is normal, executing the target script in the test sub-database according to the specified execution process to obtain a second execution result;

[0027] If the second execution result is normal, executing the target script in the pre-production sub-database according to the specified execution process to obtain a third execution result;

[0028] If the third execution result is normal, it is determined that the execution result meets a preset condition.

[0029] In an optional implementation manner, executing the target script in the test database according to a specified execution process to obtain an execution result includes:

[0030] Execute the target script in the test database in sequence according to the process of data resource preparation, data pre-backup, data execution and data back-up;

[0031] If any process of the data resource preparation, the data backup, the data execution and the data backup fails, it is determined that the execution result does not satisfy the preset condition.

[0032] In an optional implementation manner, the obtaining of a target script for modifying a function of the software includes:

[0033] In response to a change operation made by a user, a target script corresponding to the change operation is generated, wherein the change operation includes at least one of a deletion operation, an addition operation, and a modification operation.

[0034] In a second aspect, an embodiment of the present application provides a script execution device, the device comprising:

[0035] A target script acquisition module, used to acquire a target script for modifying the functions of the software during the software running process, wherein the running environment of the software includes a test database and a production database;

[0036] A pre-execution module, used to execute the target script in the test database according to a specified execution process to obtain an execution result;

[0037] The execution module transfers the target script to the production database if the execution result meets the preset condition, and executes the target script in the production database to modify the function of the software.

[0038] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;

[0039] A memory for storing instructions executable by the processor;

[0040] The processor is configured to execute the method provided in the above embodiment.

[0041] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-readable storage medium is stored computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method provided in the above embodiment.

[0042] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method provided in the above embodiment is implemented.

[0043] The script execution method, device, electronic device and storage medium provided by the present application obtain a target script for modifying the function of the software during the software operation process, wherein the software operation environment includes a test database and a production database, and then executes the target script in the test database according to the specified execution process to obtain the execution result. Finally, if the execution result meets the preset conditions, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the function of the software. In other words, in each database, the target script is executed according to the execution process, thereby ensuring the consistency of the target script when it is executed in each database. In addition, when the execution result of the target script in the test database meets the preset conditions, it can automatically jump to the production database to execute the target script, thereby realizing the automatic execution of the target script in each database and improving the execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Figure 1 A schematic diagram of the development process of a software project in the related technology provided in the embodiment of the present application;

[0046] Figure 2 A schematic diagram of the process of data change performed by development and operation and maintenance personnel in the related technology provided in the embodiment of the present application;

[0047] Figure 3 A flowchart of a script execution method provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of the topology map editing interface provided in the embodiment of the present application;

[0049] Figure 5 A flowchart of another script execution method provided in an embodiment of the present application;

[0050] Figure 6 Based on Figure 5 A schematic diagram of the flow chart of step 215 to step 218 provided in the embodiment;

[0051] Figure 7 A schematic diagram of the execution process of implementing data changes through a database deployment tool provided in an embodiment of the present application;

[0052] Figure 8 A schematic diagram of the database alias configuration interface provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of the data script interface provided in the embodiment of the present application;

[0054] Fig.10 A flowchart of another script execution method provided in an embodiment of the present application;

[0055] Fig.11 A schematic diagram of the structure of a script execution device provided in an embodiment of the present application;

[0056] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0057] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0059] like Figure 1 As shown in the figure above, the current R&D process of general software projects is as shown in the figure above. There will be multiple environments in the entire iteration process. First, the development environment (DEV) is used by developers to carry out code development work for corresponding requirement items, followed by the test environment (TEST) for testers to test, then the quasi-production environment (PREPROD) for trial operation, and finally the production environment (PROD), which is the formal operation environment. The database is also the basic software required when the application software runs in multiple environments, and each environment needs to contain the corresponding database.

[0060] During the iterative development of a project or the operation of an application software, it is often necessary to add, delete, or modify the application data in the database to modify some of the software's functions, and these addition, deletion, and modification operations are implemented by executing data scripts in the database. Since a project has multiple operating environments, it is often necessary to execute the same data script in these multiple environments, and the execution order of the scripts must also be consistent.

[0061] As far as data changes are concerned, the relevant technologies have realized the automation of data deployment in the production environment, but in the development environment, test environment and quasi-production environment, data deployment is implemented manually by developers. The specific steps are as follows: developers need to log in to the database client, manually arrange the job steps, then search and copy the script from FTP, fill it into the arranged tasks, and then manually execute them one by one according to the order of the job steps. During the whole process, developers need to repeat the above steps to deploy resources to three environments. This completely increases the workload of developers and is inefficient. In addition, these operations are independent of each other, the consistency of resources deployed in each environment cannot be guaranteed, and the resource versions cannot be strictly traced. Manual operations also have many unavoidable risks.

[0062] Specifically, Figure 2As shown in the figure, when the data scripts of multiple environments involved in the project iteration process are executed, the process of data change by development and operation and maintenance personnel is roughly as follows: It can be seen that currently, development and operation and maintenance personnel generally log in or connect to databases of different operating environments by using data from the library software (clients such as sqlplus). DEV corresponds to the development environment database, TEST corresponds to the test environment database, PREPROD corresponds to the quasi-production environment database, and PROD corresponds to the production environment database. After copying the data script, the implementation personnel manually click to execute. After clicking to execute, the client will connect to the database and execute according to the input data script, and return the execution result.

[0063] For example, during the execution of a data script through a database client, the implementer needs to perform the following manual operations:

[0064] In one example, a user opens database client software and logs in or connects to a database in a corresponding environment.

[0065] In this example, the implementation personnel need to enter the database name and database password when connecting to the database. In actual operation, there is a risk of entering the wrong database name or password. This risk will result in failure to connect or connecting to the wrong database, affecting the implementation efficiency and the serious consequence of executing the wrong database environment.

[0066] In one example, the user needs to copy the data script that needs to be implemented and click a button to execute it.

[0067] In this example, because the implementers have to manually copy the data scripts many times during the execution in multiple environments, copying errors and omissions are prone to occur during manual copying, which will ultimately affect the execution results of the data scripts.

[0068] It can be seen that during the entire process, the implementers need to repeat the same data change operation in four application software operating environments. This manual operation method is inefficient and increases the workload of the implementers. Moreover, since the data change operations before each environment are independent of each other, the consistency of the data script cannot be guaranteed, and the data products cannot be strictly traced. At the same time, manual operations also have many unavoidable risks.

[0069] The embodiments of the present application provide a script execution method, device, electronic device and storage medium, aiming to solve the above technical problems of the prior art. The script execution method, device, electronic device and storage medium provided in the embodiments of the present application can ensure the consistency of data scripts when they are executed in various databases, and can automatically execute data scripts in various databases, thereby improving the execution efficiency of data scripts.

[0070] The following is an explanation of the professional data involved in the application examples:

[0071] Data change: Data change refers to the operation of changing the application data in the database, mainly referring to the operation of adding, deleting, and modifying data, which is usually completed by executing SQL scripts.

[0072] Data products: refers to the SQL script file when data changes are executed. After connecting to the database, the data products are used to implement the operations of adding, deleting, and modifying data into the production database. A step represents an automated operation, and the step of "data execution" represents the execution of the data script on the database.

[0073] Job arrangement: It means arranging the implementation steps of data change by dragging and dropping job steps to realize the visualization of the data change process.

[0074] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0075] Figure 3 A flowchart of a script execution method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the method provided in this embodiment includes:

[0076] 101. During software operation, a target script for modifying functions of the software is obtained, wherein the software operation environment includes a test database and a production database.

[0077] For example, the execution subject of this embodiment may be an electronic device, or a terminal device, or a processing device or device that can execute a data script, or other devices or equipment that can execute this embodiment, without limitation. This embodiment is described with the execution subject being an electronic device.

[0078] In some implementations, the user can configure and save the target script in advance through the database deployment tool installed in the electronic device, and during the software running process, the electronic device can call and execute the target script to modify some functions of the software. For example, add, delete, modify, etc. the application data in the database of the software running to modify some functions of the software.

[0079] The test database may include a database corresponding to the development environment (DEV), a database corresponding to the test environment (TEST), and a database corresponding to the pre-production environment (PREPROD). The development environment is mainly used for developers to carry out code development work for corresponding requirement items, the test environment is mainly used for testers to test the modified software, and the pre-production environment is mainly used to test the modified software.

[0080] Among them, the production database corresponds to the production environment of the software, that is, the environment in which the modified software is officially run.

[0081] 102. Execute the target script in the test database according to the specified execution process to obtain the execution result.

[0082] In some implementations, a specific implementation of step 102 is as follows: first, the target script is executed in the test database in sequence according to the processes of data resource preparation, data backup, data execution, and data backup.

[0083] As an example, Figure 4 As shown, the designated execution process of the target script can be implemented by topology arrangement. Specifically, the user can edit the designated execution process in advance through the topology editing interface of the database deployment tool. In the topology editing interface, the user can select the icons corresponding to the four processes of data resource preparation, data backup, data execution and data backup, and edit the execution order of the four processes by dragging the icons in the topology editing interface. Finally, the edited designated execution process is data resource preparation, data backup, data execution and data backup. Among them, data resource preparation includes the entry and filling of the target script, data backup includes the backup of the target script before execution, data execution includes the execution of the target script, and data backup includes the backup of the target script after execution.

[0084] Secondly, if any process in data resource preparation, data backup, data execution and data backup fails, it is determined that the execution result does not meet the preset conditions.

[0085] As an example, the electronic device can implement the detection of the progress of each process in data resource preparation, data backup, data execution and data backup. If no error occurs in any of the four processes, it can be determined that the execution result meets the preset conditions. If an error occurs in any of the processes in data resource preparation, data backup, data execution and data backup, it is determined that the execution result does not meet the preset conditions.

[0086] It can be understood that when the test database includes a database corresponding to the development environment, a database corresponding to the test environment, and a database corresponding to the pre-production environment, executing the target script in the test database according to the specified execution process includes executing the target script in the database corresponding to the development environment, the database corresponding to the test environment, and the database corresponding to the pre-production environment according to the specified execution process. When each of the three databases executes the four processes of data resource preparation, data backup, data execution, and data backup without error, it can be determined that the execution result meets the preset conditions.

[0087] 103. If the execution result meets the preset conditions, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the function of the software.

[0088] In some embodiments, the test database and the production database can be pre-associated. When the execution result meets the preset conditions, it indicates that the test result of the target script when tested in the test database is passed. At this time, the production database associated with the test database can be automatically connected, and the target script can be executed in the production database by reusing the topology diagram of the specified execution process and filling in the target script, thereby modifying the software function.

[0089] In this embodiment, a target script for modifying the functions of the software is obtained during the software operation, wherein the software operation environment includes a test database and a production database, and then the target script is executed in the test database according to a specified execution process to obtain an execution result. Finally, if the execution result meets the preset conditions, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the functions of the software. That is to say, in each database, the target script is executed according to the execution process, thereby ensuring the consistency of the target script when it is executed in each database. In addition, when the execution result of the target script in the test database meets the preset conditions, it can automatically jump to the production database to execute the target script, thereby realizing the automatic execution of the target script in each database and improving the execution efficiency.

[0090] Figure 5 A flowchart of another script execution method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method provided in this embodiment includes:

[0091] 201. During software operation, a target script for modifying functions of the software is obtained, wherein the software operation environment includes a test database and a production database, and the test database includes a plurality of sub-databases.

[0092] In some implementations, a specific implementation of step 201 includes: in response to a change operation made by a user, generating a target script corresponding to the change operation, wherein the change operation includes at least one of a deletion operation, an addition operation, and a modification operation.

[0093] As an example, an interface for modifying software functions may be displayed on an electronic device, and the interface may include icons for deleting, adding, changing, etc. software functions. By operating the above icons (for example, clicking on a delete icon of a software function), an operation corresponding to the icon may be implemented. When the electronic device detects the operation, a target script corresponding to the operation may be generated. Optionally, the deletion operation, the addition operation, and the change operation include but are not limited to single click, multiple clicks, long press, sliding, and other operations.

[0094] 202. Obtain a current sub-database that is executing a target script according to a specified execution process from multiple sub-databases.

[0095] In some embodiments, the plurality of sub-databases include a development sub-database, a test sub-database, and a pre-production sub-database, wherein the development sub-database corresponds to the development environment, the test sub-database corresponds to the test environment, and the pre-production sub-database corresponds to the pre-production environment, wherein the development sub-database, the test sub-database, the pre-production sub-database, and the production database are associated in execution order through aliases, and the execution order is the development sub-database, the test sub-database, the pre-production sub-database, and the production database. Among them, the plurality of sub-databases may be pre-configured with database aliases (hereinafter referred to as aliases). Among them, the database alias is equivalent to giving the database another name, and this alias can replace the real path and name of the database. The user does not have to consider where the database is stored during programming. If the absolute path or name of the database is modified, only the configuration information of the alias needs to be modified, and the user's program does not need to be modified. Therefore, the alias corresponds to the database, and the user can find the corresponding database through the alias.

[0096] As an example, if the electronic device detects that the pre-production sub-database that is executing the target script according to the specified execution process is a pre-production sub-database, the pre-production sub-database may be determined as the current sub-database.

[0097] 203. Obtain the initial execution result of the current sub-database for the target script.

[0098] Following the above example, the electronic device can detect the execution result of the target script when it is executed in the pre-production sub-database according to the specified execution process, thereby obtaining the initial execution result. Among them, the specific method of obtaining the initial execution result can refer to the method of judging the execution result by detecting whether each process in data resource preparation, data backup, data execution and data backup is wrong in step 102 of the above embodiment. When the electronic device detects that when the above four processes are executed in sequence in the pre-production sub-database, no error message appears in each process, the initial execution result is determined to be normal, otherwise, the initial execution result is determined to be abnormal.

[0099] 204. If the initial execution result is normal, obtain the alias corresponding to the current sub-database.

[0100] Continuing with the above example, since each sub-database is pre-configured with an alias, if the initial execution result is determined to be normal, the alias corresponding to the pre-production sub-database can be directly obtained.

[0101] In some implementations, if the initial execution result is abnormal, the target script is re-uploaded into the current sub-database.

[0102] 205. If the alias corresponding to the current sub-database is the specified alias, determine that the execution result meets the preset condition.

[0103] Continuing with the above example, if the specified alias is the alias corresponding to the pre-production sub-database, it can be determined that the execution result meets the preset conditions.

[0104] In some embodiments, Figure 6 As shown, the method also includes:

[0105] 215. If the alias corresponding to the current sub-database is not the specified alias, obtain a sub-database associated with the alias corresponding to the current sub-database from multiple sub-databases as a new current sub-database.

[0106] As an example, for example, the alias corresponding to the current sub-database is the alias corresponding to the test sub-database, and the specified alias is the alias corresponding to the pre-production sub-database. Then, it can be determined through the association order of the aliases that the next database associated with the test sub-database is the pre-production sub-database, and therefore the pre-production sub-database can be used as the new current sub-database.

[0107] 216. Obtain the initial execution result of the new current sub-database for the target script.

[0108] Continuing with the above example, you can execute the target script in the pre-production sub-database according to the specified execution process and obtain the initial execution result again.

[0109] 217. If the initial execution result of the new current sub-database for the target script is normal, obtain the alias corresponding to the new current sub-database.

[0110] 218. If the alias corresponding to the new current sub-database is the specified alias, determine that the execution result meets the preset condition.

[0111] Continuing with the above example, since the specified alias is the alias corresponding to the pre-production sub-database, it can be determined that the execution result meets the preset conditions.

[0112] 206. If the execution result meets the preset conditions, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the function of the software.

[0113] The specific implementation of step 206 may refer to step 103, so it will not be described here in detail.

[0114] The steps of this embodiment are described as a whole below. In practical applications, users can use database deployment tools to implement data changes in the database. The database deployment tool can be Nebula Pipeline, which has a one-stop deployment function. Figure 7 As shown, the specific implementation of this method can be as follows:

[0115] In the first step, users can use the database deployment tool to configure the database alias to effectively associate the four operating environments with the corresponding databases (dev library, test library, preprod library, and prod library). As an example, Figure 8 As shown, the database alias configuration interface may include an alias input box for each database, so that the user can input the database alias in the alias input box.

[0116] In the second step, users can enter the data script interface of the database deployment tool, select the database alias in the dev environment, associate each database through the alias, and then the tool will automatically correspond to the database of the dev environment, that is, the dev library. Users can continue to select data products under the corresponding dev library, where the data products can be data sets that include the target script. In addition, users can determine the order of script execution by arranging job steps in the topology diagram editing interface and filling in data scripts, that is, setting the specified execution process of the target script. As an example, Fig. 9 As shown, the data script interface includes configuration interfaces such as editing tasks, data scripts, program configuration, job scheduling, execution, and order transfer. Users can configure different data in different configuration interfaces. Among them, the data script configuration interface can display information such as task order type, database alias, current environment, etc., and can also display buttons for upgrading or resetting the current environment.

[0117] In the third step, the database deployment tool can automatically implement the job arrangement topology diagram in the third step, thereby realizing the pre-execution of the target script. Pre-execution refers to the process of executing the target script in a sub-database in the dev library, test library, or preprod library. For example, the process of executing the target script in the test library.

[0118] In the fourth step, if the result of the pre-execution of the target script in the current sub-database is successful, it can be determined whether the current sub-database is a preprod library. If it is a preprod library, it can be indicated that the highest level test library has been tested and passed. The target script can be directly transferred to the production environment (prod library) for execution according to the associated alias. When the target script is transferred to the production environment, the arranged topology map will also be transferred to the production environment. If it is not a preprod library, you can go back to the second step. The user can click the promotion button in the data script interface, or the system will automatically promote. For example, the current operating environment DEV is promoted to the TEST environment. After the promotion, it is the test environment. The system will retain the arranged topology map and the correspondence between the job steps and resource scripts in the topology map, but will automatically replace the database information, data resource package path, and the script filled in the job step with the corresponding one in the test environment. The way to promote to the preprod library is the same as above. After promoting to the test environment, you can directly enter the execution interface to execute the script on the test library of the test environment, without repeating the operations such as creating a new task order and arranging job steps.

[0119] If the result of the target script pre-execution in the current sub-database is not successful, you can re-upload the data resource package to the data script interface in the second step for re-execution. The data resource package includes the set target script, the arranged topology map, and the configured database alias.

[0120] Optionally, in order to ensure the consistency of products deployed in multiple test environments, the system does not support package selection in the test library and preprod library, and can only be mapped by the resource package of the dev library. At the same time, the system can be configured with a reset function. Clicking the reset button in any environment will return to the dev environment, keeping the selected database alias and the orchestration of the job steps. The executor can modify it on this basis and advance again after execution. After the execution of the three test environments is completed, the order can be transferred to the production library. The production environment will also reuse the previous resource package and orchestration topology diagram to implement the full-process tool implementation of the test environment and the production environment.

[0121] Among them, the one-stop deployment method of the Nebula pipeline allows the project team to avoid repeating the operation steps in multiple test environments, and also ensures the consistency of resource deployment in each environment. After sufficient testing, the test quality is also guaranteed, and the full process of multiple test environments is realized on the pipeline.

[0122] It can be seen that the script execution method provided in this embodiment associates the databases of multiple environments by configuring the database alias, and uniformly manages the database users and passwords. This method can effectively avoid the connection failure and connection error caused by the wrong database address input when manually connecting to the database. A unified product management method is adopted, and the data scripts are stored in the product library. The product libraries of multiple environments correspond to multiple project environments, which ensures the effective flow of data scripts when they are executed in different environments, avoids the "landing" of data scripts, and avoids the risks brought by manually copying data scripts. And when executing data scripts in multiple environments, the consistency of the entire operation process is achieved by reusing the unified topological map of the operation process, mainly including the consistency of the data script execution steps and the consistency of the data script source. Using the "promotion" function, when upgrading from the development (DEV) environment to the test (TEST) environment, the test (TEST) environment will reuse the operation process (topological map) and data script when the development (DEV) environment executes the data script, and according to the database alias configuration, the database is synchronously upgraded to the corresponding TEST library. Through automated execution, the consistency of the data script operation process in multiple environments is effectively guaranteed.

[0123] Fig.10 A flowchart of another script execution method provided in an embodiment of the present application is shown as follows: Fig.10 As shown, the method provided in this embodiment includes:

[0124] 301. During software operation, a target script for modifying software functions is obtained, wherein the software operation environment includes a test database and a production database, and the test database includes a development sub-database, a test sub-database, and a pre-production sub-database.

[0125] 302. Execute the target script in the development sub-database according to the specified execution process to obtain a first execution result.

[0126] 303. If the first execution result is normal, execute the target script in the test sub-database according to the specified execution process to obtain a second execution result.

[0127] The specific method of determining the first execution result may refer to step 203 .

[0128] In some implementations, if the first execution result is abnormal, the target script may be re-uploaded to the development sub-database, and the target script may be re-executed in the development sub-database.

[0129] 304. If the second execution result is normal, execute the target script in the pre-production sub-database according to the specified execution process to obtain a third execution result.

[0130] The specific method for determining the second execution result may refer to step 203 .

[0131] In some implementations, if the second execution result is abnormal, the target script may be re-uploaded to the test sub-database, and the target script may be re-executed in the test sub-database.

[0132] 305. If the third execution result is normal, determine that the execution result meets the preset condition.

[0133] The specific method of determining the first execution result may refer to step 203 .

[0134] In some implementations, if the third execution result is abnormal, the target script may be re-uploaded to the pre-production sub-database, and the target script may be re-executed in the pre-production sub-database.

[0135] 306. If the execution result meets the preset conditions, the target script is transferred to the production database, and the target script is executed in the production database according to the specified execution process to modify the function of the software.

[0136] In this embodiment, the test database includes a development sub-database, a test sub-database and a pre-production sub-database, and the target script is executed in the development sub-database according to the specified execution process to obtain a first execution result; if the first execution result is normal, the target script is executed in the test sub-database according to the specified execution process to obtain a second execution result; if the second execution result is normal, the target script is executed in the pre-production sub-database according to the specified execution process to obtain a third execution result; if the third execution result is normal, it is determined that the execution result meets the preset conditions, so that the three sub-databases execute the target scripts one by one according to the preset execution order, so that it can efficiently determine whether the execution result meets the preset conditions.

[0137] Fig.11 A schematic diagram of the structure of a script execution device provided in an embodiment of the present application is shown in FIG. Fig.11 As shown, the device comprises:

[0138] The target script acquisition module 31 is used to acquire a target script for modifying the functions of the software during the software running process, wherein the software running environment includes a test database and a production database.

[0139] The pre-execution module 32 is used to execute the target script in the test database according to the specified execution process to obtain the execution result.

[0140] The execution module 33 transfers the target script to the production database if the execution result meets the preset condition, and executes the target script in the production database to modify the function of the software.

[0141] In some implementations, the test database includes multiple sub-databases, and the pre-execution module 32 includes:

[0142] The first current sub-database determining unit is used to obtain, from multiple sub-databases, a current sub-database that is executing a target script according to a specified execution process.

[0143] The first initial execution result obtaining unit is used to obtain the initial execution result of the current sub-database for the target script.

[0144] The first alias obtaining unit is used to obtain the alias corresponding to the current sub-database if the initial execution result is normal.

[0145] The first determining unit is configured to determine that the execution result satisfies a preset condition if the alias corresponding to the current sub-database is a specified alias.

[0146] In some implementations, the pre-execution module 32 further includes:

[0147] The second current sub-database determining unit is configured to obtain a sub-database associated with the alias corresponding to the current sub-database from the multiple sub-databases as a new current sub-database if the alias corresponding to the current sub-database is not the designated alias.

[0148] The second initial execution result obtaining unit is used to obtain the initial execution result of the new current sub-database for the target script.

[0149] The second alias obtaining unit is used to obtain the alias corresponding to the new current sub-database if the initial execution result of the new current sub-database for the target script is normal.

[0150] The second determining unit is configured to determine that the execution result satisfies a preset condition if the alias corresponding to the new current sub-database is a specified alias.

[0151] In some implementations, the pre-execution module 32 is further configured to re-upload the target script to the current sub-database if the initial execution result is abnormal.

[0152] In some embodiments, the multiple sub-databases include a development sub-database, a test sub-database, and a pre-production sub-database, wherein the development sub-database, the test sub-database, the pre-production sub-database, and the production database are associated with each other in an execution order through aliases, and the execution order is development sub-database, test sub-database, pre-production sub-database, and production database.

[0153] In some implementations, the test database includes a development sub-database, a test sub-database, and a pre-production sub-database pre-execution module 32, and is further used to:

[0154] Execute the target script in the development sub-database according to the specified execution process to obtain a first execution result.

[0155] If the first execution result is normal, the target script is executed in the test sub-database according to the specified execution process to obtain a second execution result.

[0156] If the second execution result is normal, the target script is executed in the pre-production sub-database according to the specified execution process to obtain a third execution result.

[0157] If the third execution result is normal, it is determined that the execution result meets the preset condition.

[0158] In some implementations, the pre-execution module 32 is specifically configured to:

[0159] In the test database, the target script is executed in sequence according to the process of data resource preparation, data backup, data execution and data backup.

[0160] If any error occurs in any process of data resource preparation, data backup, data execution, and data backup, it is determined that the execution result does not meet the preset conditions.

[0161] In some implementations, the target script acquisition module 31 is specifically used to:

[0162] In response to a change operation performed by a user, a target script corresponding to the change operation is generated, wherein the change operation includes at least one of a deletion operation, an addition operation, and a modification operation.

[0163] For example, this embodiment can refer to the above method embodiment, and its principles and technical effects are similar and will not be described in detail.

[0164] Fig.12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.12 As shown, the electronic device includes a memory 43 and a processor 42 .

[0165] The memory 43 is a memory used for storing instructions executable by the processor 42 .

[0166] The processor 42 is configured to execute the method provided in the above embodiment.

[0167] The electronic device further includes a receiver 40 and a transmitter 41. The receiver 40 is used to receive instructions and data sent by an external device, and the transmitter 41 is used to send instructions and data to the external device.

[0168] The electronic device may be a mobile phone, a computer, a tablet computer, etc.

[0169] Specifically, the electronic device may also include one or more of the following components: a processing component, a power component, a multimedia component, and an input / output (I / O) interface. The processing component may be equivalent to the processor 42 in the above embodiment.

[0170] The processing component generally controls the overall operation of the electronic device, such as operations associated with display and recording operations. The processing component may include one or more processors to execute instructions to complete all or part of the steps of the above method. In addition, the processing component may include one or more modules to facilitate interaction between the processing component and other components. For example, the processing component may include a multimedia module to facilitate interaction between the multimedia component and the processing component.

[0171] The memory is configured to store various types of data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, etc.

[0172] The power supply assembly provides power to various components of the electronic device. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.

[0173] The multimedia component includes a screen that provides an output interface between the electronic device and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0174] The I / O interface provides an interface between the processing component and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0175] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of an electronic device to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0176] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method provided in the above embodiment.

[0177] An embodiment of the present application provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0178] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0179] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A script execution method, characterized in that: include: During the software running process, obtaining a target script for modifying the function of the software, wherein the running environment of the software includes a test database and a production database; Execute the target script in the test database according to the specified execution process to obtain an execution result; If the execution result satisfies the preset condition, transferring the target script to the production database, and executing the target script in the production database according to the specified execution process to modify the function of the software; The test database includes a plurality of sub-databases, and the plurality of sub-databases include a development sub-database, a test sub-database, and a pre-production sub-database, wherein the development sub-database, the test sub-database, the pre-production sub-database, and the production database are associated with each other in an execution order through aliases, and the execution order is the development sub-database, the test sub-database, the pre-production sub-database, and the production database; Executing the target script in the test database according to the specified execution process to obtain the execution result includes: Acquire a current sub-database that is executing the target script according to the specified execution process from the multiple sub-databases; Obtaining an initial execution result of the current sub-database for the target script; If the initial execution result is normal, obtaining the alias corresponding to the current sub-database; If the alias corresponding to the current sub-database is a specified alias, determining that the execution result meets a preset condition; If the alias corresponding to the current sub-database is not the designated alias, obtaining a sub-database associated with the alias corresponding to the current sub-database from the multiple sub-databases as a new current sub-database; Obtaining an initial execution result of the new current sub-database for the target script; If the initial execution result of the new current sub-database for the target script is normal, obtaining an alias corresponding to the new current sub-database; If the alias corresponding to the new current sub-database is the specified alias, determining that the execution result meets a preset condition; The step of executing the target script in the test database according to the specified execution process to obtain the execution result also includes: Execute the target script in the development sub-database according to the specified execution process to obtain a first execution result; If the first execution result is abnormal, uploading the target script to the development sub-database, and re-executing the target script in the development sub-database; If the first execution result is normal, executing the target script in the test sub-database according to the specified execution process to obtain a second execution result; If the second execution result is abnormal, uploading the target script to the test sub-database, and re-executing the target script in the test sub-database; If the second execution result is normal, executing the target script in the pre-production sub-database according to the specified execution process to obtain a third execution result; If the third execution result is abnormal, uploading the target script to the pre-production sub-database, and re-executing the target script in the pre-production sub-database; If the third execution result is normal, it is determined that the execution result meets a preset condition.

2. The method according to claim 1, characterized in that Executing the target script in the test database according to the specified execution process to obtain the execution result includes: Execute the target script in the test database in sequence according to the process of data resource preparation, data pre-backup, data execution and data back-up; If any process of the data resource preparation, the data backup, the data execution and the data backup fails, it is determined that the execution result does not satisfy the preset condition.

3. The method according to claim 1, characterized in that The step of obtaining a target script for modifying the function of the software includes: In response to a change operation made by a user, a target script corresponding to the change operation is generated, wherein the change operation includes at least one of a deletion operation, an addition operation, and a modification operation.

4. A script execution device, characterized in that: The device comprises: A target script acquisition module, used to acquire a target script for modifying the functions of the software during the software running process, wherein the running environment of the software includes a test database and a production database; A pre-execution module, used to execute the target script in the test database according to a specified execution process to obtain an execution result; An execution module, configured to transfer the target script to the production database and execute the target script in the production database to modify the function of the software if the execution result meets a preset condition; The test database includes a plurality of sub-databases, and the plurality of sub-databases include a development sub-database, a test sub-database, and a pre-production sub-database, wherein the development sub-database, the test sub-database, the pre-production sub-database, and the production database are associated with each other in an execution order through aliases, and the execution order is the development sub-database, the test sub-database, the pre-production sub-database, and the production database; The pre-execution module is specifically used to obtain from the multiple sub-databases the current sub-database that is executing the target script according to the specified execution process; obtain the initial execution result of the current sub-database for the target script; if the initial execution result is normal, obtain the alias corresponding to the current sub-database; if the alias corresponding to the current sub-database is the specified alias, determine that the execution result meets the preset condition; if the alias corresponding to the current sub-database is not the specified alias, obtain the sub-database associated with the alias corresponding to the current sub-database from the multiple sub-databases as a new current sub-database; obtain the initial execution result of the new current sub-database for the target script; if the initial execution result of the new current sub-database for the target script is normal, obtain the alias corresponding to the new current sub-database; if the alias corresponding to the new current sub-database is the specified alias, determine that the execution result meets the preset condition; The pre-execution module is also specifically used to execute the target script in the development sub-database according to the specified execution process to obtain a first execution result; if the first execution result is abnormal, upload the target script to the development sub-database, and re-execute the target script in the development sub-database; if the first execution result is normal, execute the target script in the test sub-database according to the specified execution process to obtain a second execution result; if the second execution result is abnormal, upload the target script to the test sub-database, and re-execute the target script in the test sub-database; if the second execution result is normal, execute the target script in the pre-production sub-database according to the specified execution process to obtain a third execution result; if the third execution result is abnormal, upload the target script to the pre-production sub-database, and re-execute the target script in the pre-production sub-database; if the third execution result is normal, determine that the execution result meets the preset condition.

5. An electronic device, characterized in that: include: Memory and processor; A memory for storing instructions executable by the processor; The processor is configured to execute the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 3 when executed by a processor.

7. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 3 when being executed by a processor.