Cross-database data processing method and device, computer equipment and medium

Generate target program statements by analyzing and assigning language template paths, solving the problem of inefficient data generation across databases, realizing code decoupling and flexibility improvement, and is suitable for data processing of multiple databases.

CN120336171APending Publication Date: 2025-07-18HANGZHOU FENGCHANG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510375781.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In complex business scenarios with multi-table association or cross-databases, data generation in the prior art is inefficient and SQL logic needs to be repeatedly modified.

Method used

By obtaining pre-configured language text data, parsing the language template path to generate a path instance list, determining a variable mapping set, and assigning variables to the original program statement based on the set, generating the target program statement, and finally generating test data in the target database.

Benefits of technology

It realizes decoupling of code and configuration, improves the flexibility and efficiency of data generation, reduces maintenance costs, and supports syntax adaptation of multiple databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336171A_ABST
    Figure CN120336171A_ABST
Patent Text Reader

Abstract

The invention provides a cross-database data processing method and device, computer equipment and a medium, and the method comprises the steps: obtaining pre-configured language text data, the language text data comprising a language template path corresponding to a test instance; analyzing the language template path to obtain a path instance list corresponding to the language template path; based on a path instance list corresponding to the language template path, determining a variable mapping set corresponding to the test instance; performing variable assignment on each original program statement included in the path instance list based on a variable mapping set corresponding to the test instance to obtain a target program statement; and after establishing data connection with the target database based on the data source information corresponding to the current instance, generating test data corresponding to the business data in the target database by executing the target program statement. Therefore, the data generation efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the technical field of data processing, and more particularly, to a data processing method, apparatus, computer device, and medium applicable to cross-database data. Background Art

[0002] Data-driven testing plays an important role in the field of software testing. By analyzing test data, it is possible to identify the defective parts of the software and the software functions that need to be focused on, and thus allocate test resources more reasonably.

[0003] In the related art, in a data-driven test scenario, testers usually need to write multiple SQL statements to generate test data and insert them into the source database to verify the accuracy of data synchronization logic and business metric calculations. However, for complex operations such as multi-table association or cross-database dependencies, the SQL logic needs to be modified repeatedly.

[0004] However, with the existing method, the data generation efficiency is low. Summary of the Invention

[0005] Embodiments described herein provide a data processing method, apparatus, computer device, and medium for cross-database data, which overcome the above problems.

[0006] In a first aspect, according to the content of the present disclosure, there is provided a data processing method for cross-database data, including:

[0007] Obtain pre-configured language text data, where the language text data includes: a language template path corresponding to a test instance, and the language template path is used to describe the storage location of business data in the device memory;

[0008] Parse the language template path to obtain a list of path instances corresponding to the language template path, where the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders;

[0009] Based on the list of path instances corresponding to the language template path, determine a variable mapping set corresponding to the test instance, where the variable mapping set corresponding to the test instance stores multiple business variables and variable values corresponding to each business variable in the form of key-value pairs;

[0010] Perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain target program statements;

[0011] After establishing a data connection with the target database based on the data source information corresponding to the current instance, the test data corresponding to the service data is generated in the target database by executing the target program statement.

[0012] In a second aspect, according to the content of the present disclosure, a data processing apparatus for cross-database is provided, including:

[0013] An acquisition module, configured to acquire pre-configured language text data, where the language text data includes: a language template path corresponding to a test instance, and the language template path is used to describe the storage location of service data in the device memory;

[0014] A parsing module, configured to perform parsing processing on the language template path to obtain a list of path instances corresponding to the language template path, where the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders;

[0015] A determination module, configured to determine a variable mapping set corresponding to the test instance based on the list of path instances corresponding to the language template path, where the variable mapping set corresponding to the test instance stores multiple service variables and variable values corresponding to each service variable in the form of key-value pairs;

[0016] An assignment module, configured to perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain a target program statement;

[0017] An execution module, configured to generate test data corresponding to the service data in the target database by executing the target program statement after establishing a data connection with the target database based on the data source information corresponding to the current instance.

[0018] In a third aspect, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of the data processing method for cross-database in any of the above embodiments are implemented.

[0019] In a fourth aspect, a computer-readable storage medium is provided. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps of the data processing method for cross-database in any of the above embodiments are implemented.

[0020] The data processing method for cross-database provided by the embodiment of the present application obtains pre-configured language text data, where the language text data includes: the language template path corresponding to the test instance, and the language template path is used to describe the storage location of business data in the device memory; perform parsing processing on the language template path to obtain a list of path instances corresponding to the language template path, and the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders; based on the list of path instances corresponding to the language template path, determine the variable mapping set corresponding to the test instance, and the variable mapping set corresponding to the test instance stores multiple business variables and the variable values corresponding to each business variable in the form of key-value pairs; perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain target program statements; after establishing a data connection with the target database based on the data source information corresponding to the current instance, execute the target program statements to generate test data corresponding to the business data in the target database. In this way, by abstracting program statements into language templates, the decoupling of code and configuration is achieved, the flexibility of scripts is improved, and the data generation efficiency is effectively enhanced.

[0021] The above description is only an overview of the technical solution of the embodiment of the present application. In order to be able to understand the technical means of the embodiment of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and understandable, the following specifically illustrates the embodiments of the present application. Brief Description of the Drawings

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be understood that the following described drawings only relate to some embodiments of the present disclosure and do not limit the present disclosure, where:

[0023] Figure 1 is a schematic flowchart of a data processing method for cross-database provided by the present disclosure.

[0024] Figure 2 is a schematic structural diagram of a data processing device for cross-database provided by the present disclosure.

[0025] Figure 3 is a schematic structural diagram of a computer device provided by the present disclosure.

[0026] It should be noted that the elements in the drawings are schematic and not drawn to scale. Detailed Embodiments

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of the present disclosure without creative efforts also fall within the scope of protection of the present disclosure.

[0028] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the subject matter of the present disclosure pertains. Further, it will be understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the specification and the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are directly joined together or joined through one or more intermediate components.

[0029] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase "embodiments" appearing in various places in the specification does not necessarily refer to the same embodiment, nor are they independent or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.

[0030] As used herein, the term "and / or" is merely a description of an association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: the existence of A, the simultaneous existence of A and B, and the existence of B. Additionally, the character " / " herein generally represents an "or" relationship between the associated objects before and after. Terms such as "first" and "second" are only used to distinguish one component (or a part of a component) from another component (or another part of a component).

[0031] In the description of the present application, unless otherwise specified, the meaning of "a plurality" refers to two or more (including two). Similarly, "a plurality of groups" refers to two or more groups (including two groups).

[0032] To enable those skilled in the art of this technology to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0033] Figure 1 is a schematic flowchart of a data processing method for cross-database provided by an embodiment of the present disclosure, as Figure 1As shown, the specific process of the data processing method for cross-database includes:

[0034] S110. Obtain the pre-configured language text data, which includes the language template path corresponding to the test instance.

[0035] Among them, the language template path can be used to describe the storage location of business data in the device memory, and the language template path is pre-defined and configured in the language text data in a sequence form. The test instance can be used to describe the business information in the enterprise system, such as business orders, etc. The language text data can correspond to YAML text.

[0036] In some embodiments, the language text data further includes the data source information corresponding to the test instance. The data source information corresponding to the test instance is pre-configured in the language text data in a key mapping definition and can be used to provide the information required when the program connects to the target database.

[0037] The language template path corresponding to the test instance can be an SQL template path. The pre-configured language text data can be as follows.

[0038]

[0039] Among them, 'Template 1' and 'Template 2' are SQL template paths; url (Uniform Resource Locator), username, password, and data source type (driver) are the data source information corresponding to the test instance.

[0040] The method of this embodiment further includes:

[0041] Generate test program statements based on the data source type corresponding to the test instance; after establishing a data connection with the target database based on the data source information corresponding to the current instance, perform configuration verification on the language text data by executing the test program statements.

[0042] Among them, the basic test SQL statements can be assembled according to the data source type, the driver class can be loaded, and the target database can be connected and the test SQL statements can be executed based on information such as the URL, username, and password for configuration verification to facilitate ensuring the configuration validity of the language text data.

[0043] S120. Perform parsing processing on the language template path to obtain a list of path instances corresponding to the language template path.

[0044] For example, convert the YAML text into a Token stream, identify elements such as scalars (e.g., Title), lists (e.g., insert), and maps (e.g., datesource) in the Token stream, and construct a node graph based on this to represent the data structure of the YAML text; convert the node graph into a Java object through a conversion tool, and instantiate the target type through the reflection mechanism, parsing the data source information into the nested objects of the instance to facilitate parsing the YAML text into data that can be used by the program; parse the SQL template path into a list of instances to facilitate obtaining a list of path instances corresponding to the language template path.

[0045] Among them, the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders. It can be understood that the list of path instances includes multiple SQL templates, and each SQL template can be regarded as an SQL statement. There may be information marked with placeholders in the SQL statement. For example, placeholders can be used in the SQL statement to mark time, date, etc.

[0046] S130. Determine the variable mapping set corresponding to the test instance based on the list of path instances corresponding to the language template path.

[0047] Among them, the variable mapping set corresponding to the test instance stores multiple business variables and the variable values corresponding to each business variable in the form of key-value pairs. The variable mapping set corresponding to the test instance can be used as a temporary memory in the program to temporarily store business variables and corresponding variable values.

[0048] In some embodiments, the original program statement corresponds to a program variable; determining the variable mapping set corresponding to the test instance based on the list of path instances corresponding to the language template path includes:

[0049] Generate a first mapping set based on the program variables included in the original program statement; update the variables of the first mapping set based on the template text data corresponding to the original program statement in the list of path instances to obtain a second mapping set; perform matching assignment on each business variable in the second mapping set to obtain the variable mapping set corresponding to the test instance.

[0050] Among them, the program variables included in the original program statement are the variables used in the original program statement. The first mapping set stores multiple business variables in the form of key-value pairs, and the business variables correspond to the program variables. It can be understood that the business variables stored in the first mapping set are also the program variables in the original program statement, or can be other variables.

[0051] Thus, by updating variables in the first mapping set, a second mapping set is obtained, and business variables in the second mapping set are assigned values, facilitating the filling of missing variable values of the business variables in the second mapping set, thereby obtaining a variable mapping set with complete variable data.

[0052] In some embodiments, based on the template text data corresponding to the original program statements in the path instance list, variables in the first mapping set are updated to obtain a second mapping set, including:

[0053] Read the template text data corresponding to the original program statements in the path instance list, where the template text data includes: placeholders and program representation statements; parse to obtain the represented variables corresponding to the placeholders included in the template text data; based on the represented variables corresponding to the placeholders included in the template text data, update variables in the first mapping set to obtain a second mapping set.

[0054] Among them, by traversing the path instance list, the text data of the SQL template is read, and regular expressions can be used to parse the placeholders in the text data, such as "{{variable - name}}", and the represented variables corresponding to the placeholders included in the template text data, such as "variable - name", are parsed, and the represented variables corresponding to the placeholders included in the template text data are added to the first mapping set to update variables in the first mapping set to obtain a second mapping set.

[0055] In some embodiments, each business variable in the second mapping set is matched and assigned a value to obtain a variable mapping set corresponding to the test instance, including:

[0056] If a preset character identifier corresponds to a business variable in the second mapping set, a variable value corresponding to the business variable is generated and assigned based on a preset built - in policy.

[0057] Among them, the preset character identifier can be, for example: UUID, SUID, ID7, ID9, DATE. If a specified character prefix is included in the variable name of a business variable in the second mapping set, the variable value corresponding to the business variable can be regularized and assigned through a preset built - in policy rule.

[0058] For example, if the business variable in the second mapping set corresponds to a preset character identifier UUID, the corresponding variable value can be represented by a combination of numbers and hyphens, such as "11111-22222-33333"; if the business variable in the second mapping set corresponds to a preset character identifier SUID, the corresponding variable value can be represented by numbers, such as "111112222233333"; if the business variable in the second mapping set corresponds to a preset character identifier ID7, the corresponding variable value can be represented by 7 digits, such as "1111122"; if the business variable in the second mapping set corresponds to a preset character identifier ID9, the corresponding variable value can be represented by 9 digits, such as "111112222"; if the business variable in the second mapping set corresponds to a preset character identifier DATE, the corresponding variable value can be represented by the current date, such as "20200520".

[0059] If the business variable in the second mapping set corresponds to the program variable in the original program statement, the business variable is matched and assigned a value based on the variable mapping set corresponding to the current instance.

[0060] For example, if the business variable in the second mapping set corresponds to the program variable A (A has no corresponding variable value) in the original program statement, and there is a business variable B in the variable mapping set corresponding to the current instance that has the same variable name as the program variable A, and the variable value of B is 11, then the variable value of B can be assigned to A to obtain the variable value of A as 11.

[0061] If the business variable in the second mapping set corresponds to a preset prefix identifier, the variable value corresponding to the business variable is determined and assigned based on the data source type corresponding to the business variable.

[0062] Among them, the preset prefix identifier is such as "SEQ_".

[0063] In some embodiments, determining the variable value corresponding to the business variable and assigning a value based on the data source type corresponding to the business variable includes:

[0064] If the data source type corresponding to the business variable is a preset type, a corresponding sequence query statement is generated to query the variable value corresponding to the business variable from the database corresponding to the preset type according to the sequence query statement and assign a value; if the data source type corresponding to the business variable is a non-preset type, a variable sequence value is generated through the database corresponding to the non-preset type, and the business variable is assigned a value based on the variable sequence value.

[0065] Among them, the preset type is the type to which the Oracle database or the PostgreSQL database belongs, and the non-preset type is the type to which the Mysql database belongs.

[0066] For example, if the data source type corresponding to the business variable is the type to which the Oracle database belongs, generate a sequence query statement corresponding to the Oracle database, and query and assign the variable value corresponding to the business variable from the Oracle database according to the sequence query statement; if the data source type corresponding to the business variable is the type to which the PostgreSQL database belongs, generate a sequence query statement corresponding to the PostgreSQL database, and query and assign the variable value corresponding to the business variable from the PostgreSQL database according to the sequence query statement; if the data source type corresponding to the business variable is the type to which the Mysql database belongs, the Mysql database automatically generates a sequence value to assign to the business variable.

[0067] Based on the business variables and corresponding identification variables in the second mapping set, determine the variable mapping set corresponding to the test instance.

[0068] Among them, the business variable and its corresponding identification variable only have different variable names. For example, if the business variable is A, its corresponding identification variable is -A.

[0069] The variable mapping set corresponding to the test instance can be obtained by copying the business variables in the second mapping set, adding a "-" identifier before the variable name of the copied business variable, and forming all variables and their corresponding variable values in the form of key-value pairs.

[0070] S140. Based on the variable mapping set corresponding to the test instance, perform variable assignment on each original program statement included in the path instance list to obtain the target program statement.

[0071] Among them, by performing variable assignment on the placeholders included in each original program statement included in the path instance list, a complete SQL statement is obtained.

[0072] In some embodiments, performing variable assignment on each original program statement included in the path instance list based on the variable mapping set corresponding to the test instance to obtain the target program statement includes:

[0073] Match the variable values corresponding to the placeholders included in each original program statement from the variable mapping set corresponding to the test instance; based on the variable values corresponding to the placeholders included in each original program statement, replace the placeholders in the corresponding original program statement to obtain the target program statement.

[0074] Among them, traverse the SQL template list, match the placeholders through regular expressions, find the corresponding variable values in the variable mapping set, and replace the placeholders with them to generate a complete SQL statement.

[0075] Thus, by performing variable assignment operations on the placeholders in the original program statements, SQL statements can be quickly obtained, avoiding the time-consuming and inaccurate logic problems caused by rewriting the SQL statement logic, and effectively improving the generation efficiency of SQL statements.

[0076] S150. After establishing a data connection between the data source information corresponding to the current instance and the target database, execute the target program statement to generate test data corresponding to the business data in the target database.

[0077] Among them, by obtaining information such as the data source type, URL, username, and password from the current instance, loading the specified driver class according to the data source type, establishing a connection between the program and the target database, and executing the complete SQL statement, it is convenient to generate test data in the target database to complete cross-database data addition.

[0078] In this embodiment, obtain the pre-configured language text data, which includes: the language template path corresponding to the test instance, and the language template path is used to describe the storage location of the business data in the device memory; perform parsing processing on the language template path to obtain a list of path instances corresponding to the language template path, and the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders; based on the list of path instances corresponding to the language template path, determine the variable mapping set corresponding to the test instance, and the variable mapping set corresponding to the test instance stores multiple business variables and the variable values corresponding to each business variable in the form of key-value pairs; perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain the target program statement; after establishing a data connection between the data source information corresponding to the current instance and the target database, execute the target program statement to generate test data corresponding to the business data in the target database. In this way, by abstracting the program statements into language templates, the decoupling of code and configuration is achieved, the flexibility of the script is improved, and the data generation efficiency is effectively enhanced.

[0079] In this embodiment, the data source, SQL template, and variable rules are defined through a YAML configuration file to achieve "one configuration, multi-scenario reuse" and reduce the maintenance cost. Automatically select the data generation strategy through prefix recognition, use the template engine and variable generator to dynamically generate variables to ensure that the test data meets complex constraints. And it supports multiple databases (such as Oracle, PostgreSQL, Mysql), automatically adapts to the syntax differences of different databases, and improves the template reuse rate.

[0080] Figure 2The figure is a schematic structural diagram of a data processing device for cross-database use. The data processing device for cross-database use may include: an acquisition module 210, an analysis module 220, a determination module 230, an assignment module 240, and an execution module 250.

[0081] The acquisition module 210 is configured to acquire pre-configured language text data, where the language text data includes: a language template path corresponding to a test instance, and the language template path is used to describe the storage location of business data in the device memory.

[0082] The analysis module 220 is configured to perform analysis processing on the language template path to obtain a list of path instances corresponding to the language template path. The list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders.

[0083] The determination module 230 is configured to determine a variable mapping set corresponding to the test instance based on the list of path instances corresponding to the language template path. In the variable mapping set corresponding to the test instance, multiple business variables and variable values corresponding to each business variable are stored in the form of key-value pairs.

[0084] The assignment module 240 is configured to perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain target program statements.

[0085] The execution module 250 is configured to, after establishing a data connection with the target database based on the data source information corresponding to the current instance, generate test data corresponding to the business data in the target database by executing the target program statements.

[0086] In this embodiment, optionally, the determination module 230 includes: a generation unit, an update unit, and an assignment unit.

[0087] The generation unit is configured to generate a first mapping set based on the program variables included in the original program statement. In the first mapping set, multiple business variables are stored in the form of key-value pairs.

[0088] The update unit is configured to perform variable update on the first mapping set based on the template text data corresponding to the original program statement in the list of path instances to obtain a second mapping set.

[0089] The assignment unit is configured to perform matching assignment on each business variable in the second mapping set to obtain a variable mapping set corresponding to the test instance.

[0090] In this embodiment, optionally, the update unit is specifically configured to:

[0091] Read the template text data corresponding to the original program statements in the instance list of read paths. The template text data includes: placeholders and program representation statements; Parse to obtain the representation variables corresponding to the placeholders included in the template text data; Based on the representation variables corresponding to the placeholders included in the template text data, update the variables in the first mapping set to obtain a second mapping set.

[0092] In this embodiment, optionally, the assignment unit is specifically configured to:

[0093] If the service variable in the second mapping set corresponds to a preset character identifier, generate a variable value corresponding to the service variable based on the preset built-in policy and assign it; If the service variable in the second mapping set corresponds to a program variable in the original program statement, match and assign the service variable based on the variable mapping set corresponding to the current instance; If the service variable in the second mapping set corresponds to a preset prefix identifier, determine the variable value corresponding to the service variable based on the data source type corresponding to the service variable and assign it; Based on the service variables and corresponding identifier variables in the second mapping set, determine the variable mapping set corresponding to the test instance.

[0094] In this embodiment, optionally, the assignment unit is specifically configured to:

[0095] If the data source type corresponding to the service variable is a preset type, generate a corresponding sequence query statement to query the variable value corresponding to the service variable from the database corresponding to the preset type according to the sequence query statement and assign it; If the data source type corresponding to the service variable is a non-preset type, generate a variable sequence value through the database corresponding to the non-preset type, and assign the service variable based on the variable sequence value.

[0096] In this embodiment, optionally, the assignment module 240 is specifically configured to:

[0097] Match the variable values corresponding to the placeholders included in each original program statement from the variable mapping set corresponding to the test instance; Based on the variable values corresponding to the placeholders included in each original program statement, replace the placeholders in the corresponding original program statement to obtain the target program statement.

[0098] In this embodiment, optionally, it further includes: a generation module and a verification module.

[0099] The generation module is used to generate test program statements based on the data source type corresponding to the test instance.

[0100] The verification module is used to perform configuration verification on the language text data by executing the test program statements after establishing a data connection with the target database based on the data source information corresponding to the current instance.

[0101] The data processing device for cross-database provided by the present disclosure can execute the above method embodiments. For its specific implementation principle and technical effects, please refer to the above method embodiments, which will not be elaborated herein.

[0102] An embodiment of the present application also provides a computer device. Specifically, please refer to Figure 3 , Figure 3 which is the basic structural block diagram of the computer device in this embodiment.

[0103] The computer device includes a memory 310 and a processor 320 that are communicatively connected to each other via a system bus. It should be noted that only the computer device with the memory 310 and the processor 320 is shown in the figure. However, it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented. Among them, those skilled in the art of the present technology can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0104] The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device can interact with the user through a keyboard, a mouse, a remote control, a touchpad or a voice control device and other means.

[0105] The memory 310 includes at least one type of readable storage medium, which includes non-volatile memory or volatile memory, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. RAM can include static RAM or dynamic RAM. In some embodiments, the memory 310 can be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory 310 can also be an external storage device of the computer device, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device. Of course, the memory 310 can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 310 can also be used to temporarily store various data that have been output or will be output.

[0106] The processor 320 is generally used to execute the overall operations of the computer device. In this embodiment, the memory 310 is used to store program code or instructions, and the program code includes computer operation instructions. The processor 320 is used to execute the program code or instructions stored in the memory 310 or process data, such as running the program code of the above method.

[0107] In this text, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0108] Another embodiment of the present application further provides a computer-readable medium, which can be a computer-readable signal medium or a computer-readable medium. A processor in the computer reads the computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or the combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or the combination of blocks in the block diagram.

[0109] The computer-readable medium includes but is not limited to electronic, magnetic, optical, electromagnetic, infrared memories or semiconductor systems, devices or apparatuses, or any suitable combination of the foregoing. The memory is used to store program code or instructions, and the program code includes computer operation instructions. The processor is used to execute the program code or instructions of the above method stored in the memory.

[0110] For the definitions of the memory and the processor, reference can be made to the description of the foregoing computer device embodiments, and details will not be elaborated here.

[0111] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the devices or units can be in an electrical, mechanical, or other form.

[0112] In each embodiment of the present application, each functional unit or module can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0113] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.

[0114] In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The "including" described in this application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a claim listing several units of a device, several of these units of the device can be embodied by the same item of hardware. The use of the first, second, and third, etc. does not denote any order and these words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

[0115] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of various embodiments of this application.

Claims

1. A data processing method for cross-database, characterized in that, Including: Obtain pre-configured language text data, where the language text data includes: a language template path corresponding to a test instance, and the language template path is used to describe the storage location of business data in the device memory; Perform parsing processing on the language template path to obtain a list of path instances corresponding to the language template path, where the list of path instances includes multiple original program statements, and each original program statement includes one or more placeholders; Based on the list of path instances corresponding to the language template path, determine a variable mapping set corresponding to the test instance, where the variable mapping set corresponding to the test instance stores multiple business variables and variable values corresponding to each business variable in the form of key-value pairs; Perform variable assignment on each original program statement included in the list of path instances based on the variable mapping set corresponding to the test instance to obtain target program statements; After establishing a data connection with the target database based on the data source information corresponding to the current instance, execute the target program statement to generate test data corresponding to the business data in the target database.

2. The method according to claim 1, wherein The original program statement corresponds to program variables; the determining the variable mapping set corresponding to the test instance based on the list of path instances corresponding to the language template path includes: Generate a first mapping set based on the program variables included in the original program statement, and the first mapping set stores multiple business variables in the form of key-value pairs; Perform variable update on the first mapping set based on the template text data corresponding to the original program statement in the list of path instances to obtain a second mapping set; Perform matching assignment on each business variable in the second mapping set to obtain the variable mapping set corresponding to the test instance.

3. The method according to claim 2, wherein The performing variable update on the first mapping set based on the template text data corresponding to the original program statement in the list of path instances to obtain a second mapping set includes: Read the template text data corresponding to the original program statement in the list of path instances, where the template text data includes: placeholders and program representation statements; Parse to obtain the representation variables corresponding to the placeholders included in the template text data; Perform variable update on the first mapping set based on the representation variables corresponding to the placeholders included in the template text data to obtain the second mapping set.

4. The method according to claim 2, wherein The performing matching assignment on each business variable in the second mapping set to obtain the variable mapping set corresponding to the test instance includes: If the business variable in the second mapping set corresponds to a preset character identifier, generate and assign a variable value corresponding to the business variable based on a preset built-in policy; If the business variable in the second mapping set corresponds to the program variable in the original program statement, perform matching assignment on the business variable based on the variable mapping set corresponding to the current instance; If the business variable in the second mapping set corresponds to a preset prefix identifier, determine and assign a variable value corresponding to the business variable based on the data source type corresponding to the business variable; Determine the variable mapping set corresponding to the test instance based on the service variables and the corresponding identification variables in the second mapping set.

5. The method according to claim 4, wherein The determining the variable value corresponding to the service variable based on the data source type corresponding to the service variable and assigning the value includes: If the data source type corresponding to the service variable is a preset type, generate a corresponding sequence query statement to query the variable value corresponding to the service variable from the database corresponding to the preset type according to the sequence query statement and assign the value; If the data source type corresponding to the service variable is a non-preset type, generate a variable sequence value through the database corresponding to the non-preset type, and assign the value to the service variable based on the variable sequence value.

6. The method according to claim 1, wherein The assigning variables to each original program statement included in the path instance list based on the variable mapping set corresponding to the test instance to obtain the target program statement includes: Match the variable values corresponding to the placeholders included in each original program statement from the variable mapping set corresponding to the test instance; Based on the variable values corresponding to the placeholders included in each original program statement, replace the placeholders in the corresponding original program statement to obtain the target program statement.

7. The method according to claim 1, characterized in that The language text data further includes: the data source information corresponding to the test instance; The method further includes: Generate a test program statement based on the data source type corresponding to the test instance; After establishing a data connection between the data source information corresponding to the current instance and the target database, perform configuration verification on the language text data by executing the test program statement.

8. A data processing device for cross-database, characterized in that, Including: An acquisition module, configured to acquire pre-configured language text data, where the language text data includes: a language template path corresponding to a test instance, and the language template path is used to describe the storage location of service data in the device memory; A parsing module, configured to perform parsing processing on the language template path to obtain a path instance list corresponding to the language template path, where the path instance list includes a plurality of original program statements, and each original program statement includes one or more placeholders; A determination module, configured to determine the variable mapping set corresponding to the test instance based on the path instance list corresponding to the language template path, where the variable mapping set corresponding to the test instance stores a plurality of service variables and the variable values corresponding to each service variable in the form of key-value pairs; An assignment module, configured to perform variable assignment on each original program statement included in the path instance list based on the variable mapping set corresponding to the test instance to obtain a target program statement; An execution module, configured to generate test data corresponding to the service data in the target database by executing the target program statement after establishing a data connection between the data source information corresponding to the current instance and the target database.

9. A computer device, characterized in that, Including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, it implements the data processing method for cross-database as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the data processing method for cross-database as described in any one of claims 1 to 7.