CN111221518A - Script generation method, device, equipment and computer storage medium - Google Patents

Script generation method, device, equipment and computer storage medium Download PDF

Info

Publication number
CN111221518A
CN111221518A CN201911089750.XA CN201911089750A CN111221518A CN 111221518 A CN111221518 A CN 111221518A CN 201911089750 A CN201911089750 A CN 201911089750A CN 111221518 A CN111221518 A CN 111221518A
Authority
CN
China
Prior art keywords
script
standard
template
special
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911089750.XA
Other languages
Chinese (zh)
Inventor
王国彬
徐晓波
胡鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Bincent Technology Co Ltd
Original Assignee
Shenzhen Bincent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Bincent Technology Co Ltd filed Critical Shenzhen Bincent Technology Co Ltd
Priority to CN201911089750.XA priority Critical patent/CN111221518A/en
Publication of CN111221518A publication Critical patent/CN111221518A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems

Abstract

The invention provides a script generation method, a device, equipment and a computer storage medium, wherein the method specifically comprises the following steps: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; and combining the universal script and the distinguishing script to generate a target script. The invention can shorten the code length of the script and is easy to maintain.

Description

Script generation method, device, equipment and computer storage medium
Technical Field
The present invention relates to the field of scripts, and in particular, to a script generation method, apparatus, device, and computer storage medium.
Background
A Script (Script) is an extension of a batch file, and is a program for storing plain text, and a general computer Script program is a definite series of combinations for controlling a computer to perform operation actions, in which certain logic branches can be implemented, and the Script can be usually called and executed temporarily by an application program.
However, in the prior art, various operations need to be continuously written into scripts for different types of operations, so that different types of scripts are run to implement different types of operations, but this method is not only cumbersome, but also needs to write a corresponding script for each type of operation to execute, so that the code length is increased, and the maintenance is not easy.
Disclosure of Invention
Embodiments of the present invention provide a script generation method, an apparatus, a device, and a computer storage medium, which mainly aim to solve the problem in the prior art that various operations need to be continuously written into a script for different types of operations, but such a method is not only cumbersome, but also results in an increase in code length for writing the script, and is not easy to maintain.
In a first aspect, an embodiment of the present invention provides a script generation method, which specifically includes:
writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule;
calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table;
and combining the general script and the special script to generate a target script.
In a second aspect, the present invention further provides a script generating apparatus, including:
the acquisition module is used for compiling corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template tables corresponding to the source data of the plurality of different scenes according to a preset rule;
the universal script generating module is used for calling the same standard table field from a preset script template to establish a universal template table and generating a universal script according to the universal template table;
the special script generating module is used for calling the distinguishing standard table fields from a preset script template to establish a special template table and generating a special script according to the special template table;
and the target script generating module is used for combining the general script and the distinguishing script to generate a target script.
In a third aspect, the present invention provides a script generating apparatus, which includes a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement part or all of the steps of any one of the script generating methods described in the above embodiments.
In a fourth aspect, the present invention further provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program implements part or all of the steps of any one of the script generation methods described in the above embodiments.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; and combining the universal script and the special script to generate a target script. In summary, the target script is generated by combining the universal script and the special script, i.e. the source data can be extracted by using the target script, the code length of the script can be shortened, and the script is easy to maintain.
These and other aspects of the invention are apparent from and will be elucidated with reference to the embodiments described hereinafter.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a script generation method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another script generation method according to a second embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating another source data extraction method according to a third embodiment of the present invention;
fig. 4 is a schematic flow chart illustrating another source data extraction method according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a source data extraction apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a source data extracting apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The following are detailed below.
The terms "first," "second," "third," and "fourth," etc. in the description and claims of the invention and in the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. The term "and/or" is used to describe an associative relationship of associated objects, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Embodiments of the present application are described below with reference to the drawings.
Example one
According to an aspect of the present invention, there is provided a script generating method, specifically including the following steps, as shown in fig. 1:
s1, writing corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template tables corresponding to the source data of the plurality of different scenes according to a preset rule;
it should be noted that the execution subject of the embodiment of the present invention is a data management server, the data management server is composed of one or more computers running in a local area network and data management system software, and the data management server provides a management service for user data.
It should be noted that, in the prior art, for the extraction method corresponding to the source data of different scenes, one script is separately written to extract the source data of a certain scene, which is cumbersome and increases the length of the script writing code, and is not easy to maintain. The method and the device for extracting the source data of the N different scenes can classify the source data of the multiple different scenes in advance to obtain the source data of the N different scenes, N is a natural number larger than 1, and N data extraction standard template tables corresponding to the source data of the N different scenes are compiled in advance based on the source data of the N different scenes, wherein the data extraction standard template tables comprise standard table fields. For example as shown in tables 1, 2 below:
Figure BDA0002266500680000051
TABLE 1
Figure BDA0002266500680000052
TABLE 2
The tables 1 and 2 are corresponding data extraction standard template tables compiled for source data of two different scenes, and are used as extraction templates, and after specific parameters are configured, the source data of the different scenes can be extracted into a data warehouse by using a python script. python is an object-oriented, transliterated computer programming language, and is also a powerful, general-purpose language that has been developed over the last two decades, mature and stable. It contains a set of well-established and easily understood standard libraries that can easily accomplish many common tasks. Its syntax is very simple and clear, unlike most other programming languages, it uses contraction to define statements.
Comparing the standard table fields in table 1 and table 2 one by one to obtain the same standard table field and the distinguishing standard table field of the two data extraction standard template tables, for example, the same standard table field in table 1 and table 2 is: task ID, running end time, running state and running date; the distinguishing criteria table fields in table 1 and table 2 above are: scheduling ID, task path, number of successful nodes, run start time, and node name.
S2, calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
as described in step S1, the same standard table fields in tables 1 and 2 are: task ID, operation end time, operation state and operation date, calling the same standard table field: task ID, run end time, run status and run date, establish a generic template table, as shown in Table 3 below:
Figure BDA0002266500680000061
TABLE 3
And establishing a universal template table shown in the table 3 in a preset script template to generate a universal script, wherein the universal template table can be understood as a branch of the task history table and the task node history table, and includes operations for extracting the same data in the task history table and the task node history table.
S3, calling the distinguishing standard table field in a preset script template to establish a special template table, and generating a special script according to the special template table;
as described in step S1, the distinguishing standard table fields in table 1 and table 2 are: scheduling ID, task path, number of successful nodes, operation start time and node name, and calling the distinguishing standard table fields as follows: scheduling ID, task path, number of successful nodes, operation start time and node name, and establishing a special template table, if the following tables 4 and 5 show that:
Figure BDA0002266500680000071
TABLE 4
Figure BDA0002266500680000072
TABLE 5
Respectively establishing a special template table 1 and a special template table 2 shown in the table 4 and the table 5 in a preset script template, and respectively generating a special script 1 and a special script 2, wherein the special template table 1 can be understood as a branch of the task history table and executes operations except for the operation corresponding to the same data extraction in the task history table, and the special template table 2 can be understood as a branch of the task node history table and executes operations except for the operation corresponding to the same data extraction in the task node history table; therefore, by combining the special script 1 and the special script 2 generated by the script template, the operation of extracting data in the task history table and the task node history table can be realized when the special script 1 and the special script 2 are combined with the general script to run. By the method, the length of script writing codes can be reduced, and the method is easy to maintain.
And S4, combining the general script and the special script to generate a target script.
The general script and the special script 1 are combined to generate an object script 1, the general script and the special script 2 are combined to generate an object script 2, the object script 1 executes a source data extraction operation after the data extraction template table configuration parameters shown in the table 1, the object script 2 executes a source data extraction operation after the data extraction template table configuration parameters shown in the table 2, and finally, the source data of the different scenes are extracted into a data warehouse.
In addition, when the distinguishing standard fields are called from the preset script template to establish the special template table, the number of the fields contained in the special template table can be randomly distributed according to actual requirements, so that the combination mode of the general script and the special script is more, more data extraction operations can be realized, and the flexibility of data extraction is improved.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; and combining the universal script and the distinguishing script to generate a target script. In summary, the target script is generated by combining the universal script and the special script, that is, the target script can be used to extract the source data, so that the functions of shortening the code length of the script to be written and facilitating maintenance are realized.
Example two
On the basis of the above embodiment, the present invention further provides a source data extraction method, which specifically includes the following steps, as shown in fig. 2:
s1, writing corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, andaccording toAcquiring the same standard table fields and the different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes by a preset rule;
preferably, on the basis of the above embodiment, the step S1 may further include the steps of:
s11, writing corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields;
it should be noted that, in the prior art, for the extraction method corresponding to the source data of different scenes, one script is separately written to extract the source data of a certain scene, which is cumbersome and increases the length of the script writing code, and is not easy to maintain. The method and the device for extracting the source data of the N different scenes can classify the source data of the multiple different scenes in advance to obtain the source data of the N different scenes, N is a natural number larger than 1, and N data extraction standard template tables corresponding to the source data of the N different scenes are compiled in advance based on the source data of the N different scenes, wherein the data extraction standard template tables comprise standard table fields. The data extraction standard template table corresponding to the source data of the N different scenes is used as a drawing template, and after specific parameters are configured, the purpose of extracting the source data of the different scenes into a data warehouse can be achieved by using a python script.
S12, calculating the occurrence times of the standard table fields in the data extraction standard template table corresponding to the source data of the plurality of different scenes;
the method comprises the steps of classifying source data of a plurality of different scenes in advance to obtain source data of N different scenes, wherein N is a natural number larger than 1, compiling N data extraction standard template tables corresponding to the source data of the N different scenes in advance based on the source data of the N different scenes, wherein each data extraction standard template table comprises at least one standard table field, and calculating the occurrence frequency of each standard table field in the data extraction standard template tables corresponding to the source data of the N different scenes. For example, as in the first embodiment, the number of occurrences of the same standard table field in the data extraction standard template table is 2, and the number of occurrences of the different standard table field in the data extraction standard template table is 1.
S13, when the number of occurrences of the standard table field is greater than or equal to a preset number threshold, obtaining the standard table field as the same standard table field of the data extraction standard template table corresponding to the source data of the multiple different scenes, or, when the number of occurrences of the standard table field is less than the preset number threshold, obtaining the standard table field as the different standard table field of the data extraction standard template table corresponding to the source data of the multiple different scenes.
For example, if the number of occurrences of the standard table field in the data extraction standard template table is "running status" is 2, the number of occurrences of the standard table field in the data extraction standard template table is "node name", and a preset number threshold is set to be 2, the same standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes, where the standard table field is "running status", and the different standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes, where the standard table field is "node name", are obtained.
S2, calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
s3, calling the distinguishing standard table field in a preset script template to establish a special template table, and generating a special script according to the special template table;
and S4, combining the general script and the distinguishing script to generate a target script.
The specific implementation of steps S2-S4 has been described in detail in the above embodiments, and will not be described herein.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises a standard table field, calculating the occurrence frequency of the standard table field in the data extraction standard template table corresponding to the source data of the plurality of different scenes, acquiring the standard table field as the same standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes under the condition that the occurrence frequency of the standard table field is greater than or equal to a preset frequency threshold, and acquiring the standard table field as a different standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes under the condition that the occurrence frequency of the standard table field is less than the preset frequency threshold; the occurrence times of the standard table fields in the data extraction standard template tables corresponding to the source data of the plurality of different scenes are calculated, so that the same standard table fields and the different standard table fields of the data extraction standard template tables corresponding to the source data of the plurality of different scenes are determined, the efficiency and the accuracy of obtaining the same standard table fields and the different standard table fields are improved, the problem that the same standard table fields are not accurately obtained, and therefore a universal script generated by using a script template cannot meet the actual requirement is solved, meanwhile, the same standard table fields are more flexibly obtained, diversified data extraction can be better met, and the practicability is enhanced; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; and combining the universal script and the distinguishing script to generate a target script. In summary, the target script is generated by combining the universal script and the special script, that is, the source data can be extracted by using the target script, so that the functions of shortening the code length of the script to be written and facilitating maintenance are realized.
EXAMPLE III
On the basis of the second embodiment, the present invention further provides a script generating method, which specifically includes the following steps, as shown in fig. 3:
s1, writing corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, andaccording toAcquiring the same standard table fields and the different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes by a preset rule;
preferably, on the basis of the above embodiment, the step S1 may further include the steps of:
s11, writing corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields;
s12, calculating the occurrence times of the standard table fields in the data extraction standard template table corresponding to the source data of the plurality of different scenes;
s13, when the number of occurrences of the standard table field is greater than or equal to a preset number threshold, obtaining the standard table field as the same standard table field of the data extraction standard template table corresponding to the source data of the multiple different scenes, or, when the number of occurrences of the standard table field is less than the preset number threshold, obtaining the standard table field as the different standard table field of the data extraction standard template table corresponding to the source data of the multiple different scenes.
The detailed implementation of steps S11-S13 has been described in detail in the above embodiments, and will not be described herein.
S2, calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
after step S2, the script generation method may further include:
s21', if the number of occurrences of the standard table field is equal to the number of data extraction standard template tables, selecting the standard table field whose number of occurrences is equal to the number of data extraction standard template tables from the same standard table field, and determining the standard table field as the substantially same standard table field;
the method comprises the steps of classifying source data of a plurality of different scenes in advance to obtain source data of N different scenes, wherein N is a natural number larger than 1, compiling N data extraction standard template tables corresponding to the source data of the N different scenes in advance based on the source data of the N different scenes, wherein each data extraction standard template table comprises at least one standard table field, and calculating the occurrence frequency of each standard table field in the data extraction standard template tables corresponding to the source data of the N different scenes. And if the number of occurrences of the standard table field is equal to the number of the data extraction standard template tables, selecting the standard table field with the number of occurrences equal to the number of the data extraction standard template tables from the same standard table field, and determining the standard table field as the basically same standard table field. That is, a certain standard table field appears in each data extraction standard template table, and the certain standard table field is determined to be substantially the same standard table field.
S22', calling the same standard table field in the preset script template, building a basic universal template table, and generating a basic universal script according to the basic universal template table.
Classifying source data of a plurality of different scenes in advance to obtain source data of different scenes in N, wherein N is a natural number greater than 1, and compiling a corresponding N-scene data extraction standard template table in advance based on the source data of the different scenes in N, and the basis of the table 1 and the table 2 is as shown in the following table 6:
Figure BDA0002266500680000111
TABLE 6
Calculating the occurrence frequency of each standard table field in the data extraction standard template table, wherein the standard table fields with the occurrence frequency equal to the number of the data extraction standard template tables are as follows: the operation end time, the operation state and the operation date are determined as the fields of the basically same standard table. And calling the fields of the basically same standard table from a preset script template, establishing a basic universal template table, and generating a basic universal script according to the basic universal template table. As shown in table 7 below:
Figure BDA0002266500680000121
TABLE 7
And establishing a basic universal template table shown in the table 7 in a preset script template to generate a basic universal script, wherein the basic universal template table can be understood as a branch of the task history table, the task node history table and the node history table, and includes operations for extracting the same data in the task history table, the task node history table and the node history table.
The method comprises the steps of selecting standard table fields with the occurrence frequency equal to the number of data extraction standard template tables from the same standard table fields, using the standard table fields as the basic same standard table fields, establishing a basic universal template table by combining a preset script template to generate a basic universal script, and storing the basic universal script independently.
S3, calling the distinguishing standard table field in a preset script template to establish a special template table, and generating a special script according to the special template table;
preferably, step S3 may further specifically include the following steps:
s31, adding scene identifiers to the distinguishing standard table fields of the data extraction standard template tables corresponding to the source data of the plurality of different scenes, respectively, where the scene identifiers are used to identify the scenes corresponding to the data extraction standard template tables to which the distinguishing standard table fields belong;
as described in step S1, the distinguishing standard table fields in table 1 and table 2 are: scheduling ID, task path, successful node number, operation start time and node name, adding scene identifier, such as scheduling ID-RL, task path-RL, successful node number-RL, operation start time-RL and node name-RJL, into each distinguishing standard table field, wherein the scene identifier RL identifies the scene corresponding to the data extraction standard template table to which the corresponding distinguishing standard table field belongs as task history, and the scene identifier RJL identifies the scene corresponding to the data extraction standard template table to which the corresponding distinguishing standard table field belongs as task node history.
S32, dividing the distinguishing standard table field into a plurality of distinguishing standard table field sets according to the scene identifier, wherein each distinguishing standard table field set corresponds to one scene identifier and comprises at least one distinguishing standard table field;
from the above-described scene identifier RL and scene identifier RJL, the above-described distinguishing criteria table field: the scheduling ID, task path, number of successful nodes, start time of operation and node name are divided into two sets of distinct standard table fields, namely set 1: scheduling ID, task path, number of successful nodes, start time of operation, set 2: node names, where set 1 corresponds to scene identifier RL and set 2 corresponds to scene identifier RJL.
And S33, based on the multiple distinguishing standard table field sets, calling the distinguishing standard table fields from preset script templates respectively to establish a special template table, and generating special scripts according to the special template table.
Based on the set 1 and the set 2, the distinguishing standard table field in the set 1 is called in the preset script template to establish the special template table corresponding to the set 1, the distinguishing standard table field in the set 2 is called in the preset script template to establish the special template table corresponding to the set 2, the special script 1 is generated according to the special template table corresponding to the set 1, and the special script 2 is generated according to the special template table corresponding to the set 2, wherein the scene identifier corresponding to the special script 1 is RL, and the scene identifier corresponding to the special script 2 is RJL. The special scripts are classified and managed according to different scenes, so that the special scripts are easy to maintain, and the use efficiency of the special scripts is improved.
And S4, combining the general script and the distinguishing script to generate a target script.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, calculating the occurrence times of the standard table fields in the data extraction standard templates corresponding to the source data of the plurality of different scenes, acquiring the standard table fields as the same standard table fields of the data extraction standard templates corresponding to the source data of the plurality of different scenes under the condition that the occurrence times of the standard table fields are greater than or equal to a preset time threshold, and acquiring the standard table fields as different standard table fields of the data extraction standard templates corresponding to the source data of the plurality of different scenes under the condition that the occurrence times of the standard table fields are less than the preset time threshold; the occurrence times of the standard table fields in the data extraction standard templates corresponding to the source data of the different scenes are calculated, so that the same standard table fields and the different standard table fields of the data extraction standard templates corresponding to the source data of the different scenes are determined, the efficiency and the accuracy of obtaining the same standard table fields and the different standard table fields are improved, the problem that the same standard table fields are not accurately obtained and accordingly a universal script generated by using a script template cannot meet actual requirements is solved, the same standard table fields are more flexibly obtained, diversified data extraction can be better met, and the practicability is enhanced; determining the standard table fields with the occurrence times equal to the number of the data extraction standard template tables as the basically same standard table fields, calling the basically same standard table fields from a preset script template, establishing a basic universal template table, generating a basic universal script according to the basic universal template table, and improving the target script generation efficiency and the source data extraction efficiency; adding scene identifiers into the distinguishing standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes respectively, dividing the distinguishing standard table fields into a plurality of distinguishing standard table field sets according to the scene identifiers, wherein each distinguishing standard table field set corresponds to one scene identifier and comprises at least one distinguishing standard table field, calling the distinguishing standard table fields in a preset script template respectively based on the distinguishing standard table field sets to establish a special template table, generating a special script according to the special template table, managing the special script in a classified mode according to the different scenes, facilitating maintenance and improving the use efficiency of the special script at the same time; and combining the universal script and the distinguishing script to generate a target script. In summary, the target script is generated by combining the universal script and the special script, that is, the source data can be extracted by using the target script, so that the functions of shortening the code length of the script to be written and facilitating maintenance are realized.
Example four
On the basis of any of the above embodiments, an embodiment of the present invention further provides a script generating method, as shown in fig. 4, specifically including:
s1, writing corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, andaccording toAcquiring the same standard table fields and the different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes by a preset rule;
s2, calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
s3, calling the distinguishing standard table field in a preset script template to establish a special template table, and generating a special script according to the special template table;
s4, combining the general script and the special script to generate a target script.
Preferably, on the basis of the above embodiment, the step S4 may further include the steps of:
s41, acquiring the associated information corresponding to the triggering operation of the user based on the triggering operation of the user, and matching the associated information with a preset associated information base;
it should be noted that the triggering operation of the user may include a data extraction instruction input by the user, and obtain associated information corresponding to the data extraction instruction input by the user, where the associated information may include, for example, identity information of the user, and specifically, the obtained associated information corresponding to the triggering operation of the user may be obtained according to an IP address of the data extraction instruction input by the user, and is matched with a preset associated information library.
Preferably, the matching the associated information with a preset associated information base specifically includes:
and the associated information comprises the identity information of the user, the identity information contained in the associated information is matched with prestored identity information in a preset associated information base, and if the identity information contained in the associated information is the same as the prestored identity information in the preset associated information base, the associated information is determined to be successfully matched with the preset associated information base.
S42, if the matching is successful, selecting a target general script and a target special script corresponding to the standard associated information of the preset associated information base, wherein the associated information is successfully matched;
by checking the identity information of the user triggering operation, the corresponding universal script and the distinguishing script can be obtained only after the identity information passes the verification, and the safety of script management is improved.
Preferably, if the identity information included in the associated information is the same as pre-stored identity information in a preset associated information base, it is determined that the associated information is successfully matched with the preset associated information base, and the selecting a target general script and a target distinguishing script corresponding to standard associated information of the preset associated information base, which is successfully matched with the associated information, may specifically include:
s421, presetting the priority level of the identity information of the user, and respectively establishing a corresponding relation table of the priority level and the universal script and a corresponding relation table of the priority level and the special script according to the priority level;
s422, according to the corresponding relation table of the priority levels and the universal scripts, selecting a target universal script corresponding to the priority level of the pre-stored identity information successfully matched with the identity information of the user, and according to the corresponding relation table of the priority levels and the special scripts, selecting a target special script corresponding to the priority level of the pre-stored identity information successfully matched with the identity information of the user.
The method comprises the steps of presetting the priority level of the identity information of a user, and establishing a corresponding relation table of the priority level and a general script and a corresponding relation table of the priority level and a special script according to the priority level of the identity information of the user. When the user identity information is determined according to the user trigger operation in step S41, the priority level of the user identity information is obtained, so that the target universal script and the target special script corresponding to the user identity information are obtained according to the correspondence table between the priority level and the universal script and the correspondence table between the priority level and the special script.
The authority management script of the user identity information priority level is utilized, the script management safety is further improved, the script management is easy to maintain, meanwhile, the authority management is carried out on the script, the authority management on the source data is enhanced, and the risk caused by random extraction of the source data is avoided.
S43, the target general script and the target special script are combined to generate the target script.
Matching the associated information corresponding to the trigger operation of the user with a preset associated information base, and if the matching is successful, selecting a target general script and a target special script corresponding to the standard associated information of the preset associated information base, which is successfully matched with the associated information, so as to combine the target general script and the target special script to generate the target script. The generation efficiency of the target script is improved, and the target general script and the target special script which are matched with the target general script and the target special script can be obtained only by matching the trigger operation of the user, so that the safety of script management is improved.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; based on the trigger operation of a user, obtaining the associated information corresponding to the trigger operation of the user, matching the associated information with a preset associated information base, if the matching is successful, selecting a target general script and a target special script corresponding to the standard associated information of the preset associated information base successfully matched with the associated information, and combining the target general script and the target special script to generate the target script, thereby improving the safety of script management. In summary, the target script is generated by combining the universal script and the special script, that is, the target script can be used to extract the source data, so that the functions of shortening the code length of the script to be written and facilitating maintenance are realized.
EXAMPLE five
An embodiment of the present invention provides a script generating apparatus 500, as shown in fig. 5, the apparatus includes: :
an obtaining module 510, configured to compile a corresponding data extraction standard template table in advance for source data of multiple different scenes, where the data extraction standard template table includes standard table fields, and obtain, according to a preset rule, the same standard table field and the different standard table field of the data extraction standard template table corresponding to the source data of the multiple different scenes;
a universal script generating module 520, configured to call the same standard table field from a preset script template to establish a universal template table, and generate a universal script according to the universal template table;
a special script generating module 530, configured to invoke the distinguishing standard table field in a preset script template to establish a special template table, and generate a special script according to the special template table;
and the target script generating module 540 is configured to combine the universal script and the special script to generate a target script.
The script generating device 500 provided by the embodiment of the present invention is a script generating method corresponding to the above embodiment, and the script generating device 500 further includes several units, which are used for implementing corresponding functions corresponding to corresponding steps of the script generating method. Since the steps of the script generation method have been described in detail in the above embodiments, they are not described in detail in the apparatus 500.
Has the advantages that: writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule; calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table; calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table; and combining the universal script and the special script to generate a target script. In summary, the target script is generated by combining the universal script and the special script, i.e. the source data can be extracted by using the target script, the code length of the script can be shortened, and the script is easy to maintain.
EXAMPLE six
The embodiment of the present invention further provides a script generating device 600, where the device includes a memory 610, a processor 620, and a computer program 630 stored in the memory 610 and executable on the processor 620, and is characterized in that when the processor 620 executes the computer program 630, the steps of any one of the script generating methods described in the above embodiments are implemented.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium may store a program, and when the program is executed, the program includes some or all of the steps of any one of the script generation methods described in the above method embodiments.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a memory and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above embodiments of the present invention are described in detail, and the principle and the implementation of the present invention are explained by applying specific embodiments, and the above description of the embodiments is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for script generation, the method comprising:
writing a corresponding data extraction standard template table aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template table comprises standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule;
calling the same standard table field from a preset script template to establish a universal template table, and generating a universal script according to the universal template table;
calling the distinguishing standard table field from a preset script template to establish a special template table, and generating a special script according to the special template table;
and combining the general script and the special script to generate a target script.
2. The script generating method according to claim 1, wherein the writing of the corresponding data extraction standard template table in advance for the source data of the plurality of different scenes includes a standard table field, and the obtaining of the same standard table field and the different standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes according to a preset rule specifically includes:
writing corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields;
calculating the occurrence times of the standard table fields in the data extraction standard template table corresponding to the source data of the plurality of different scenes;
and under the condition that the occurrence frequency of the standard table field is greater than or equal to a preset frequency threshold, acquiring the standard table field as the same standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes, or under the condition that the occurrence frequency of the standard table field is less than the preset frequency threshold, acquiring the standard table field as the different standard table field of the data extraction standard template table corresponding to the source data of the plurality of different scenes.
3. The script generating method according to claim 2, wherein said calling said same standard table field in a preset script template to create a universal template table, and generating a universal script according to said universal template table, further comprising:
if the number of occurrences of the standard table field is equal to the number of the data extraction standard template tables, selecting the standard table field with the number of occurrences equal to the number of the data extraction standard template tables from the same standard table field, and determining the standard table field as the basically same standard table field;
and calling the fields of the basically same standard table from a preset script template, establishing a basic universal template table, and generating a basic universal script according to the basic universal template table.
4. The method for generating scripts according to claim 3, wherein the step of calling the distinguishing criteria table field from a preset script template to create a special template table and generating a special script according to the special template table specifically includes:
adding scene identifiers into distinguishing standard table fields of data extraction standard template tables corresponding to source data of the plurality of different scenes respectively, wherein the scene identifiers are used for identifying scenes corresponding to the data extraction standard template tables to which the distinguishing standard table fields belong;
dividing the distinguishing standard table fields into a plurality of distinguishing standard table field sets according to the scene identifiers, wherein each distinguishing standard table field set corresponds to one scene identifier and comprises at least one distinguishing standard table field;
based on the multiple distinguishing standard table field sets, calling the distinguishing standard table fields from a preset script template respectively to establish a special template table, and generating a special script according to the special template table.
5. The script generating method according to claim 1, wherein the combining the universal script and the special script to generate the target script specifically comprises:
acquiring associated information corresponding to the triggering operation of the user based on the triggering operation of the user, and matching the associated information with a preset associated information base;
if the matching is successful, selecting a target general script and a target special script corresponding to the standard associated information of the preset associated information base, the associated information of which is successfully matched;
and combining the target general script and the target special script to generate the target script.
6. The script generation method according to claim 5, wherein the matching the associated information with a preset associated information base specifically comprises:
and the associated information comprises the identity information of the user, the identity information contained in the associated information is matched with prestored identity information in a preset associated information base, and if the identity information contained in the associated information is the same as the prestored identity information in the preset associated information base, the associated information is determined to be successfully matched with the preset associated information base.
7. The script generating method according to claim 6, wherein if the identity information included in the associated information is the same as pre-stored identity information in a preset associated information base, it is determined that the associated information is successfully matched with the preset associated information base, and the selecting a target universal script and a target distinguishing script corresponding to standard associated information of the preset associated information base, which is successfully matched with the associated information, specifically comprises: :
presetting the priority level of the identity information of the user, and respectively establishing a corresponding relation table of the priority level and the universal script and a corresponding relation table of the priority level and the special script according to the priority level;
and selecting a target general script corresponding to the priority level of the pre-stored identity information successfully matched with the identity information of the user according to the corresponding relation table of the priority level and the general script, and selecting a target special script corresponding to the priority level of the pre-stored identity information successfully matched with the identity information of the user according to the corresponding relation table of the priority level and the special script.
8. A script generation apparatus, the apparatus comprising:
the acquisition module is used for compiling corresponding data extraction standard template tables aiming at source data of a plurality of different scenes in advance, wherein the data extraction standard template tables comprise standard table fields, and acquiring the same standard table fields and different standard table fields of the data extraction standard template tables corresponding to the source data of the plurality of different scenes according to a preset rule;
the universal script generating module is used for calling the same standard table field from a preset script template to establish a universal template table and generating a universal script according to the universal template table;
the special script generating module is used for calling the distinguishing standard table fields from a preset script template to establish a special template table and generating a special script according to the special template table;
and the target script generating module is used for combining the general script and the special script to generate a target script.
9. A script generation apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of a script generation method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of a script generation method according to any one of claims 1 to 7.
CN201911089750.XA 2019-11-08 2019-11-08 Script generation method, device, equipment and computer storage medium Pending CN111221518A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911089750.XA CN111221518A (en) 2019-11-08 2019-11-08 Script generation method, device, equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911089750.XA CN111221518A (en) 2019-11-08 2019-11-08 Script generation method, device, equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN111221518A true CN111221518A (en) 2020-06-02

Family

ID=70810171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911089750.XA Pending CN111221518A (en) 2019-11-08 2019-11-08 Script generation method, device, equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN111221518A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131850A (en) * 2020-09-02 2020-12-25 中国平安人寿保险股份有限公司 Intelligent bill raising template management method, device, terminal and storage medium
CN112395343A (en) * 2020-11-18 2021-02-23 浪潮卓数大数据产业发展有限公司 DSG-based field change data acquisition and extraction method
CN112749219A (en) * 2021-01-04 2021-05-04 拉卡拉支付股份有限公司 Data extraction method, data extraction device, electronic equipment, storage medium and program product
CN114025027A (en) * 2021-11-02 2022-02-08 浙江三维万易联科技有限公司 Data transmission script running method and device, storage medium and electronic device
CN116610308A (en) * 2023-07-13 2023-08-18 支付宝(杭州)信息技术有限公司 Code management method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002289A (en) * 2017-06-07 2018-12-14 北京京东尚科信息技术有限公司 A kind of method and apparatus constructing data model
WO2019127837A1 (en) * 2017-12-28 2019-07-04 平安科技(深圳)有限公司 Method, apparatus, and device for generating table creation script, and computer readable storage medium
CN110222104A (en) * 2019-04-30 2019-09-10 中国人民财产保险股份有限公司 Data extraction method, equipment and storage medium
CN110347984A (en) * 2019-05-20 2019-10-18 中国平安财产保险股份有限公司 Declaration form page variation, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002289A (en) * 2017-06-07 2018-12-14 北京京东尚科信息技术有限公司 A kind of method and apparatus constructing data model
WO2019127837A1 (en) * 2017-12-28 2019-07-04 平安科技(深圳)有限公司 Method, apparatus, and device for generating table creation script, and computer readable storage medium
CN110222104A (en) * 2019-04-30 2019-09-10 中国人民财产保险股份有限公司 Data extraction method, equipment and storage medium
CN110347984A (en) * 2019-05-20 2019-10-18 中国平安财产保险股份有限公司 Declaration form page variation, device, computer equipment and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131850A (en) * 2020-09-02 2020-12-25 中国平安人寿保险股份有限公司 Intelligent bill raising template management method, device, terminal and storage medium
CN112395343A (en) * 2020-11-18 2021-02-23 浪潮卓数大数据产业发展有限公司 DSG-based field change data acquisition and extraction method
CN112395343B (en) * 2020-11-18 2022-07-26 浪潮卓数大数据产业发展有限公司 DSG-based field change data acquisition and extraction method
CN112749219A (en) * 2021-01-04 2021-05-04 拉卡拉支付股份有限公司 Data extraction method, data extraction device, electronic equipment, storage medium and program product
CN114025027A (en) * 2021-11-02 2022-02-08 浙江三维万易联科技有限公司 Data transmission script running method and device, storage medium and electronic device
CN114025027B (en) * 2021-11-02 2023-10-03 三维通信股份有限公司 Method and device for running data transmission script, storage medium and electronic device
CN116610308A (en) * 2023-07-13 2023-08-18 支付宝(杭州)信息技术有限公司 Code management method and device, electronic equipment and storage medium
CN116610308B (en) * 2023-07-13 2023-11-03 支付宝(杭州)信息技术有限公司 Code management method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111221518A (en) Script generation method, device, equipment and computer storage medium
US9397910B2 (en) Marking program files as belonging to an application
US11163877B2 (en) Method, server, and computer storage medium for identifying virus-containing files
CN109828780B (en) Open source software identification method and device
CN111026404A (en) Method and device for generating parameter configuration code, electronic product and storage medium
CN111249736A (en) Code processing method and device
CN115794202A (en) Data configuration method and engine, file system and computer storage medium
CN111047434A (en) Operation record generation method and device, computer equipment and storage medium
CN114201756A (en) Vulnerability detection method and related device for intelligent contract code segment
WO2020006911A1 (en) Hybrid app interface calling method and device, and computer-readable storage medium
CN112434831A (en) Troubleshooting method and device, storage medium and computer equipment
CN110119429B (en) Data processing method, data processing device, computer equipment and storage medium
CN112069052A (en) Abnormal object detection method, device, equipment and storage medium
CN110555185A (en) Page customization method and system based on PC client
CN107015787B (en) Method and device for designing interactive application framework
US20190196810A1 (en) Systems and methods for automated renumbering, reformatting, and re-referencing of branching statements or go-to instruction line referencing within modified code using a dual-pass approach that includes operations using predicted new line numbers, error detection/correction, and alignment correction processing
CN114706586A (en) Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium
CN114281402A (en) Software version management method and device
CN112966974A (en) Project configuration method, device, equipment and medium
CN114356342A (en) Compiling method and device
CN114253595A (en) Code warehouse management method and device, computer equipment and storage medium
CN112835901A (en) File storage method and device, computer equipment and computer readable storage medium
TW202217640A (en) Method and system for labeling object and generating security policy in operating system
CN112199092A (en) Application development method and device and electronic equipment
CN110825363B (en) Intelligent contract acquisition method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518000 R & D building 3501, block a, building 7, Vanke Cloud City Phase I, Xingke 1st Street, Xili community, Xili street, Nanshan, Shenzhen, Guangdong

Applicant after: Tubatu Group Co.,Ltd.

Address before: 1001-a, 10th floor, bike technology building, No.9, Keke Road, high tech Zone, Nanshan District, Shenzhen, Guangdong 518000

Applicant before: SHENZHEN BINCENT TECHNOLOGY Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200602