Nothing Special   »   [go: up one dir, main page]

CN116578651B - Data table structure synchronization method, system and equipment - Google Patents

Data table structure synchronization method, system and equipment Download PDF

Info

Publication number
CN116578651B
CN116578651B CN202310854898.8A CN202310854898A CN116578651B CN 116578651 B CN116578651 B CN 116578651B CN 202310854898 A CN202310854898 A CN 202310854898A CN 116578651 B CN116578651 B CN 116578651B
Authority
CN
China
Prior art keywords
information
table structure
target
platform
name
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310854898.8A
Other languages
Chinese (zh)
Other versions
CN116578651A (en
Inventor
张世强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jidu Technology Co Ltd
Original Assignee
Beijing Jidu 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 Beijing Jidu Technology Co Ltd filed Critical Beijing Jidu Technology Co Ltd
Priority to CN202310854898.8A priority Critical patent/CN116578651B/en
Publication of CN116578651A publication Critical patent/CN116578651A/en
Application granted granted Critical
Publication of CN116578651B publication Critical patent/CN116578651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data table structure synchronization method, a system and equipment. Generating corresponding reference table creation information based on source table structure information of a source data table in a first platform, and creating a corresponding target data table and corresponding target table structure information thereof based on the reference table creation information by a second platform; furthermore, according to the table structure information and the target table structure information of the target data table, the table structure difference information and the corresponding data table to be modified between the table structure information and the target table structure information are determined, and based on the table structure difference information, the corresponding table structure synchronous information can be generated for the subsequent table structure modification operation of the data table to be modified. The method can automatically complete the cross-platform table structure synchronous confirmation operation in a code assembly mode on the basis of no other synchronous tools, changes the original data of the database slightly, improves the efficiency and accuracy of data processing, and is beneficial to reducing the labor cost and the resource loss.

Description

Data table structure synchronization method, system and equipment
Technical Field
The application relates to the technical field of intelligent automobiles, in particular to a data table structure synchronization method, a system and equipment.
Background
In the design of an actual product architecture, a data synchronization scene is often encountered, namely, data synchronization among cross-platform databases is realized through a data synchronization tool, wherein the premise of realizing the data synchronization is that the data table structures in databases to be synchronized in different platforms are the same.
Although the table structures among different platforms can be unified by relying on the data synchronization tool, when the existing mode is operated for databases of different platforms, the comparison difficulty of the cross-platform data table structure is high, the accuracy is difficult to guarantee, and the risk of deleting the databases by mistake exists.
Disclosure of Invention
Aspects of the application provide a data table structure synchronization method, a system and equipment, which are used for realizing the synchronization management of data table structures among different platforms and ensuring the consistency of data processing of the different platforms.
The embodiment of the application provides a cross-platform data table structure synchronization method, which is applicable to a second platform and comprises the following steps: acquiring reference table creation information generated by a first platform, wherein the reference table creation information is generated according to source table structure information corresponding to a plurality of source data tables to be synchronized, and the reference table creation information comprises a plurality of reference table names; determining corresponding reference table structure information according to the reference table creation information; and determining, for each reference table name, a target table name having the same table name as its corresponding source table name; acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names; determining existing table structure difference information and a corresponding data table to be modified according to the reference table structure information and the target table structure information; and generating table structure synchronous information for executing table structure modification operation on the data table to be modified according to the table structure difference information.
In an optional embodiment, each reference table name in the reference table creation information is obtained by adding a preset table name suffix identifier on the basis of a corresponding source table name, and for each reference table name, determining a target table name having the same table name as the corresponding source table name includes: checking each reference table name in the reference table creation information according to the preset table name suffix identification; and deleting the suffix identification of the preset table name in each reference table name under the condition that verification is passed, so as to obtain the corresponding target table name.
In an alternative embodiment, determining the existing table structure difference and the corresponding data table to be modified according to the reference table structure information and the target table structure information includes: determining the reference table structure information and the target table structure information corresponding to each other as a group; comparing the reference table structure information and the target table structure information in each group, and determining at least one group of target comparison groups with different table structures and corresponding table structure difference information; and taking the corresponding target data table in each target comparison group as a data table to be modified.
In an alternative embodiment, generating table structure synchronization information for performing a table structure modification operation on the data table to be modified according to the table structure difference information includes: and generating a table structure modification operation modification SQL statement for executing the table structure modification operation on the data table to be modified according to the table structure difference information, and taking the SQL statement as table structure synchronization information.
In an optional embodiment, the reference table creating information is a table creating SQL statement, and before determining the corresponding reference table structure information according to the reference table creating information, the method further includes: executing first object program code embedded in the table-building SQL statement to create a plurality of reference data tables at the second platform; accordingly, determining corresponding reference table structure information includes: executing second target program codes embedded in a first query SQL statement, and acquiring corresponding reference table structure information from the second platform, wherein the first query SQL statement is determined according to the plurality of reference table names.
In an alternative embodiment, obtaining target table structure information corresponding to a plurality of target data tables according to a plurality of target table names includes: and executing a third target program code embedded in a second query SQL statement, and acquiring target table structure information corresponding to a plurality of target data tables from the second platform, wherein the second query SQL statement is determined according to the plurality of target table names.
In an alternative embodiment, the method further comprises: acquiring to-be-deleted reference table names respectively corresponding to a plurality of to-be-deleted reference data tables according to the preset table name suffix identification; and executing fourth target program codes embedded in a delete table SQL statement to delete the plurality of reference data tables from the second platform, wherein the delete table SQL statement is determined according to a plurality of reference table names to be deleted.
The embodiment of the application also provides a data table management system, which comprises: the system comprises a first platform, a second platform and a third platform, wherein the first platform is used for generating corresponding reference table creation information according to source table structure information corresponding to a plurality of source data tables to be synchronized, the reference table creation information comprises a plurality of reference table names, and each reference table name is obtained by adding a preset table name suffix identifier on the basis of the corresponding source table name; the second platform is used for acquiring the reference table creation information and determining corresponding reference table structure information according to the reference table creation information; and determining, for each reference table name, a target table name having the same table name as its corresponding source table name; acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names; determining a data table to be modified, which has a table structure difference with a plurality of reference data tables, in the plurality of target data tables according to the reference table structure information and the target table structure information; and generating table structure synchronization information for executing table structure modification operation on the data table to be modified according to the table structure difference.
In an alternative embodiment, the second platform is configured, when determining, for each reference table name, a target table name having the same table name as the source table name corresponding to the reference table name, to: checking each reference table name in the reference table creation information according to the preset table name suffix identification; and deleting the suffix identification of the preset table name in each reference table name under the condition that verification is passed, so as to obtain the corresponding target table name.
In an optional embodiment, the second platform is configured to, when determining, according to the reference table structure information and the target table structure information, a data table to be modified in which there is a table structure difference between the plurality of target data tables and the plurality of reference data tables: determining the reference table structure information and the target table structure information corresponding to each other as a group; comparing the reference table structure information and the target table structure information in each group to determine at least one group of target comparison groups with different table structures; and taking the corresponding target data table in each target comparison group as a data table to be modified.
In an optional embodiment, when generating table structure synchronization information for performing a table structure modification operation on the data table to be modified according to the table structure difference, the second platform is configured to: obtaining table structure difference information corresponding to each group of target comparison groups; and generating a table structure modification operation modification SQL statement for executing the table structure modification operation on the data table to be modified according to the table structure difference information, and taking the SQL statement as table structure synchronization information.
In an alternative embodiment, the system further comprises: the operation platform is used for responding to a first request operation, sending the first request to the first platform, and enabling the first platform to acquire source table structure information corresponding to a plurality of source data tables to be synchronized according to the first request; and responding to a second request operation, and sending the second request to the second platform so that the second platform can acquire the reference table creation information according to the second request.
The embodiment of the application also provides a computer device, which comprises: a processor and a memory storing a computer program for implementing the table structure synchronization method when the processor executes the computer program.
Embodiments of the present application also provide a computer-readable storage medium storing a computer program/instruction that, when executed by a processor, causes the processor to implement the table structure synchronization method.
In the embodiment of the application, aiming at a source data table and a target data table respectively belonging to a first platform and a second platform, in order to unify the table structures of the source data table and the target data table, firstly, corresponding reference table creation information is generated on the first platform based on source table structure information of the source data table; further, the second platform may determine the corresponding target table name and target table structure information based on the plurality of reference table names in the reference table creation information, and determine the corresponding reference table structure information according to the table structure corresponding to the reference table creation information; based on the table structure information and the target table structure information, the table structure difference information and the corresponding data table to be modified between the table structure information and the target table structure information are determined, and further, corresponding table structure synchronous information is generated according to the table structure difference information and used for modifying the table structure of the data table to be modified. By the method, the cross-platform table structure synchronous confirmation operation can be automatically completed in a code assembly mode on the basis of no other synchronous tools, the original data of the database is changed slightly, the efficiency and accuracy of data processing can be improved in the whole implementation process, and labor cost and resource loss can be reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1a is a block diagram of a data table management system according to an embodiment of the present application;
FIG. 1b is a block diagram of another data table management system according to an embodiment of the present application;
FIG. 1c is a block diagram of another data table management system according to an embodiment of the present application;
FIG. 2a is a flowchart of a table structure synchronization method applied to a second platform according to an embodiment of the present application;
FIG. 2b is an overall flow chart applied to the first platform according to the embodiment of the present application;
FIG. 2c is an overall flow chart applied to a second platform according to an embodiment of the present application;
FIG. 2d is a schematic diagram of a data table relationship between databases across platforms according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In order to solve the problem of difficulty in unifying data table structures among different platforms, the embodiment of the application provides a data table structure synchronization method applicable to a cross-platform environment, which can generate corresponding reference table construction information based on table structure information of a source data table of a first platform, wherein the reference table structure information comprises a plurality of reference table names; the second platform may acquire the reference table structure information, determine corresponding reference table structure information according to the reference table creation information, determine, for each reference table name, a target table name having the same table name as the source table name corresponding to the reference table name, and acquire target table structure information corresponding to the plurality of target data tables according to the plurality of target table names. Based on the table structure information, table structure difference information and a corresponding data table to be modified between the table structure information and the target table structure information can be determined according to the reference table structure information and the target table structure information, and table structure synchronous information for executing table structure modification operation on the data table to be modified is generated according to the table structure difference information, so that modification assistance is provided for subsequent execution of the data table structure modification operation. In addition, the operation of the data table is automatically completed in a code assembly mode through project codes in the whole method, manual intervention is not needed, the efficiency and accuracy of the data processing process can be improved, and labor cost can be reduced.
Before explaining the specific implementation steps of the data table structure synchronization method provided by the embodiment of the application, firstly, a system environment to which the method is applied is explained.
In an embodiment of the present application, a data table management system is further provided, where the system includes a first platform and a second platform that are not mutually communicated, and in the first platform and the second platform, data tables having a correspondence relationship between each other are included, where the data tables having a correspondence relationship commonly correspond to the same data table name in the first platform and the second platform, but there may be a difference in table structure. Therefore, in order to ensure the consistency of the first platform and the second platform in data processing, the data tables with corresponding relations in the first platform and the second platform need to be subjected to table structure synchronization processing.
For example, the first platform is an online environment in which the project code runs, and the second platform is a test environment in which the project code runs, if the information such as a source data table, necessary fields and attributes thereof necessary for the online environment are inconsistent with the test environment, this may cause that the project code that can be successfully executed in the test environment cannot be successfully executed in the online environment. Therefore, in order to ensure that the project code can be executed smoothly in an online environment, the source data table of the online environment must have a target data table corresponding to the table structure in the test environment. Then, it is necessary to determine whether the table structures of the source data table of the online environment are consistent with the table structures of the corresponding target data table in the test environment, and if the table structures of the source data table of the online environment are inconsistent, the table structures of the target data table of the test environment are synchronously processed by taking the table structures of the source data table of the online environment as a reference, so as to ensure the consistency of the execution results of the project codes in different environments.
In the embodiment of the application, interfaces for performing table structure synchronous processing on the data table can be respectively created in the first platform and the second platform, for example, a first interface is created in the first platform, and a second interface is created in the second platform; the first interface is used for generating reference table creation information according to source table structure information corresponding to a plurality of source data tables to be synchronized, wherein the reference table creation information comprises a plurality of reference table names; the second interface is used for determining corresponding reference table structure information according to the reference table creation information; and determining a target table name with the same table name as the corresponding source table name according to each reference table name, and according to the plurality of target table names and the corresponding target table structure information; further, according to the reference table structure information and the target table structure information, a data table to be modified, which has a table structure difference from a plurality of reference data tables, in the plurality of target data tables can be determined; further, table structure synchronization information for performing a table structure modification operation on the data table to be modified is generated based on the table structure difference. Based on the above, under the condition that it is determined that the data table structure synchronization operation needs to be performed on the first platform and the second platform, the data table structure synchronization method provided by the embodiment of the application can be implemented through the cooperation of the first interface in the first platform and the second interface in the second platform, so that the table structure synchronization operation is performed on the data table with the corresponding relationship in the first platform and the second platform according to the table structure synchronization information obtained by executing the method.
The following describes a data table management system provided by an embodiment of the present application with reference to the accompanying drawings.
Fig. 1a is a block diagram of a data table management system according to an embodiment of the present application, where, as shown in fig. 1a, the system includes a first platform 10 and a second platform 20, where a first interface in the first platform 10 may receive a first request, and obtain, according to the first request, source table structure information corresponding to a plurality of source data tables to be synchronized from a source database; further, in the case that the source table structure information is obtained, the first interface may generate reference table creation information according to the source table structure information and a preset table name suffix identifier, where the reference table creation information includes a plurality of reference table names, each reference table name is obtained by adding the preset table name suffix identifier on the basis of its corresponding source table name, and the table structure is the same as that of its corresponding source data table.
Accordingly, as shown in fig. 1a, the second interface in the second platform 20 may receive the second request, and acquire the reference table creation information according to the second request; further, according to the reference table creation information, corresponding reference table structure information is determined, and for each reference table name, a target table name with the same table name as the source table name corresponding to the reference table name is determined, and according to the plurality of target table names, target table structure information corresponding to the plurality of target data tables is acquired. Based on this, as shown in fig. 1a, according to the reference table structure information and the target table structure information, the existing table structure difference information and the corresponding data table to be modified can be determined; further, table structure synchronization information for performing a table structure modification operation on the data table to be modified may be generated based on the table structure difference information.
Optionally, when generating the reference table creation information, the first interface may acquire source table structure information corresponding to the plurality of source data tables in the source database by executing program codes embedded in the source data table query SQL statement, and in case that the source table structure information is acquired, acquire source table names corresponding to the plurality of source data tables respectively from the acquired source table structure information by executing program codes embedded in the source table name query SQL statement. Based on the above, a preset suffix identification is added on the basis of each source table name to obtain a corresponding reference table name, and further, corresponding reference table creation information is generated according to a plurality of reference table names and source table structure information.
For example, the first interface obtains source table structure information corresponding to a plurality of source data tables by executing program codes embedded in "show tables" SQL statement, and it is assumed that one of the source table structure information includes a table name "demo" and a table structure of "(' id ' big (20) NOT NULL auto_ INCREMENT COMMENT ') engine= InnoDB DEFAULT CHARSET =utf8mb 4 component= ' which is a component '; based on this, a plurality of source table names including the name "demo" can be acquired from the plurality of source table structure information by executing the program code embedded with the "show create table $ { tableName }" SQL statement.
Based on this, taking the source data table demo as an example, assuming that the preset suffix identifier is "_compacteflag", when the source data table demo and the corresponding table structure information thereof are acquired, the preset suffix identifier "_compacteflag" can be added on the basis of the source table name "demo" to generate the corresponding reference table name "demo_compacteflag"; further, creation information for creating the reference table "demo_compactaflag" is generated from the table structure information of the reference table name "demo_compactaflag" and the source data table demo: CREATE TABLEdemmo_compacteFlag (' id ' big (20) NOT NULL AUTO_ INCREMENT COMMENT ' self-increment id) ENGINE= InnoDB DEFAULT CHARSET =utf8mb4COMMENT= ' which is a COMMENT '; by analogy, the above-described operation is performed for each source table name, and reference table creation information for creating a plurality of reference data tables can be obtained.
It should be noted that, in the embodiment of the present application, the specific content included in the first request is not limited, alternatively, the first request may be only a request message corresponding to the data table structure synchronization type, and no other content is included, based on this, the first interface may obtain, when receiving the first request, source table structure information corresponding to the full source data table from the source database, and then generate reference table creation information corresponding to the full source data table. Further optionally, in order to improve processing efficiency, the first request may also include a specified source data table identifier, for example, a source table name corresponding to the source data table; based on this, when the first interface receives the first request from the receiving end, the first interface may obtain, according to the source data table identifier specified in the first request, the corresponding source table structure information from the source database, and further generate the reference table creation information corresponding to the specified source data table, and in which manner, it may be determined according to the actual requirement.
It should be further noted that, the embodiment of the present application is not limited to a specific manner in which the first interface obtains the preset table name suffix identifier, and optionally, the first request may include the preset table name suffix identifier, and the first interface may obtain the preset table name suffix identifier according to the first request when receiving the first request. Correspondingly, under the condition that the first request does not include the preset table name suffix identification, the data table management system can be also provided with a default preset table name suffix identification, and various operations can be performed on the data table by using the default preset table name suffix identification between the platforms, and the operation can be specifically determined according to actual conditions. The specific form of the default preset table name suffix identification is not limited, and any character string that can be clearly distinguished from the table names of the data tables in the system may be used in the embodiment of the present application, for example, a character string "_ny879_standard" without practical meaning.
The source data table structure information, the reference table structure information and the target table structure information mentioned in the embodiment of the application refer to information such as a table name, a table field type and an attribute corresponding to the source data table, the reference data table and the target data table respectively. The attribute of the table field includes, but is not limited to, whether the field is an ID, whether the field is a primary key, whether the field is not null, whether the field has a default value, whether the field is a comment, whether the field is a primary key, whether the change rule is self-increasing, whether the word is a comment, whether the word includes comment content, and the like. The specific table structure information may be determined according to the actual situation of different data tables, and is not limited herein.
Further optionally, as shown in fig. 1b, the data table management system in the embodiment of the present application may further include an operation platform 30 for synchronizing operations in response to the data table structure. Alternatively, the operation platform 30 may be provided with an operation page through which a designated worker can perform a data table structure synchronization operation. For example, the operator may perform the first request operation on the operation page, based on which, in a case where the operator performs the first request operation in response to the first request operation, the operation platform 30 may send a first request to the first interface of the first platform 10 to request the first interface to obtain source table structure information corresponding to the plurality of source data tables to be synchronized, respectively, according to the first request, and generate corresponding reference table creation information based on the source table structure information.
Accordingly, in the case that it is determined that the first platform 10 generates the reference table creation information, the operator may further perform a second request operation on the operation page provided by the operation platform 30, based on which, in the case that the operator performs the second request operation in response to the second request operation, the operation platform 30 may send a second request to the second interface of the second platform 20 to request the second interface to obtain the reference table creation information according to the second request, perform a specific operation based on the reference table creation information, determine a data table to be modified that requires the multi-table structure to perform the modification operation, and generate the corresponding table structure synchronization information.
It should be noted that, in the embodiment of the present application, the specific form of the operation page provided by the operation platform 30 is not limited, optionally, the operation page may include a function control for selecting a specified source data table, and when executing the first request operation, the worker may also select the specified source data table to request the first interface of the first platform 10 to obtain source table structure information corresponding to the specified source data table and generate corresponding reference table structure information.
In the above example, the manner in which the first platform 10 and the second platform 20 are triggered to perform the corresponding operations is merely illustrative, and in the case where the data table management system does not include the operation platform 30, the operations of respectively sending the requests to the first platform 10 and the second platform 20 may also be triggered by embedding the breakpoint in the project code, and executing the project code to the embedded breakpoint; alternatively, a timing trigger mechanism is provided for timing the transmission of requests to the first platform 10 and the second platform 20, respectively, and so on. The specific manner is not limited herein and may be determined based on the actual configuration of the system and the specific requirements.
Alternatively, in the case where the first interface of the first platform 10 generates the reference table creation information, the generated reference table creation information may also be stored in a storage space corresponding to the specified address, based on which, in the case where the second request is received, the second interface of the second platform 20 may acquire the reference table creation information according to the specified address to perform the subsequent operation according to the reference table creation information. In the embodiment of the present application, the specific location corresponding to the specified address is not limited, and in an alternative embodiment, the storage location corresponding to the specified address may be a storage space in a platform other than the first platform 10, the second platform 20, and the operation platform 30, and then the second platform 20 may directly obtain the stored reference table creation information from the other platforms when receiving the second request.
In another alternative embodiment, the first platform 10 may further return the generated reference table creation information to the operation platform 30 according to the request path corresponding to the first request, so that the operation platform 30 stores the reference table creation information in the local designated storage space. Further alternatively, in the case where the reference table creation information is stored locally to the operation platform 30, the second platform 20 may acquire the reference table creation information from the corresponding designated storage space in the operation platform 30 in the case where the second request is received; alternatively, when the operation platform 30 sends the second request to the second platform 20, the reference table creation information may be simultaneously sent to the second platform 20 together, so that the second platform 20 may implement the subsequent operation based on the reference table creation information. The storage method of the reference table creation information may be specifically determined according to actual requirements, and is not limited herein.
In the case of obtaining the table structure synchronization information, the embodiment of the present application is not limited to a specific manner of performing the table structure modification operation based on the table structure synchronization information, and alternatively, the second platform 20 may directly perform the corresponding table structure modification operation on the data table to be modified according to the table structure synchronization information in the case of generating the table structure synchronization information. Alternatively, the second platform 20 may provide the generated table structure synchronization information as a modification suggestion to the designated object, so that a designated worker performing maintenance work on the data table may perform a corresponding modification operation on the data table to be modified based on the suggestion and the actual requirement. Based on this, in an alternative embodiment, as shown in fig. 1c, the data table management system provided in the embodiment of the present application may further include a processing platform 40, configured to acquire table structure synchronization information generated by the second platform 20, so as to execute a corresponding table structure modification operation on the data table to be modified according to the acquired table structure synchronization information.
It should be noted that, the system architecture in the above system embodiment is only illustrative, and is not limited to this, and in practical application, the platforms that are not mutually communicated but have the correspondence relationship of the data table in the system are not limited to the first platform and the second platform, and the number of the platforms may be different according to specific service requirements. For example, for project codes with extremely high requirements on system stability, multiple rounds of testing may be required before the project codes are put into line, and if the project codes are required to be developed and self-tested by local gate testers, the project codes also need to be subjected to acceptance tests of other departments under the condition that the tests pass, and the project codes can be put into line after the acceptance tests pass. Then, in this system architecture, the test environment, the acceptance environment and the online environment each include a data table with a corresponding relationship, and thus, each platform in the system including the data table with a corresponding relationship may be a first platform, a second platform and a third platform.
For example, when the development work is required to be completed together by matching between different systems, the consistency of the data needs to be ensured between the systems matched with each other, and in the system architecture, each platform with the corresponding relationship of the data table belongs to different systems respectively. Assuming that the system 1 and the system 2 are in charge of developing work together, before the corresponding project codes are used on line, the system 1 and the system 2 are required to cooperate to complete testing work together, in which case, the first platform may belong to the system 1, and the second platform may belong to the system 2. Reference may be made to the above examples for specific system architecture and relationships between platforms, which are not described herein.
According to the above embodiment, the data tables with corresponding relationships exist in different platforms in the system, and the corresponding data tables may have table structure differences, so in order to ensure that the project codes of each platform are executed smoothly and the consistency of the data processing results between the platforms, the corresponding data tables between the different platforms need to be processed in a table structure synchronization. Based on the above, the embodiment of the application also provides a method for synchronizing the cross-platform database table structure, which can be applied to the system to realize the cross-platform database table structure synchronization operation.
The following describes a data table structure synchronization method provided by an embodiment of the present application with reference to the accompanying drawings.
Fig. 2a is a flowchart of a data table structure synchronization method according to an embodiment of the present application, where, as shown in fig. 2a, the method includes:
s1, acquiring reference table creation information generated by a first platform, wherein the reference table creation information is generated according to source table structure information corresponding to a plurality of source data tables to be synchronized, and the reference table creation information comprises a plurality of reference table names;
s2, determining corresponding reference table structure information according to the reference table creation information;
s3, determining target table names with the same table names as the corresponding source table names according to each reference table name;
S4, acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names;
s5, determining existing table structure difference information and a corresponding data table to be modified according to the reference table structure information and the target table structure information;
s6, generating table structure synchronous information for executing table structure modification operation on the data table to be modified according to the table structure difference information.
In the embodiment of the application, in order to realize the consistency of the table structures among different platforms, the data table to be modified in the corresponding target data table in the second platform and the table structure synchronization information according to which the table structure modification operation is carried out are required to be determined based on the table structure information of the source data table in the first platform. Therefore, in order to determine the table structure of the source data table, the first platform may first acquire source table structure information corresponding to a plurality of source data tables to be synchronized, and generate corresponding reference table creation information according to the source table structure information, where the reference table creation information includes a plurality of reference table names, and each reference table name is obtained by adding a preset table name suffix identifier on the basis of the corresponding source table name. For the process how the first platform obtains the source table structure information and generates the corresponding reference table creation information, refer to the description in the above system embodiment, and will not be repeated here.
Optionally, in order to ensure accuracy of the acquired reference table creation information, for each reference table name, when determining that the source table name corresponding to each reference table name has the target table name with the same table name, each reference table name in the reference table creation information may be checked according to the preset table name suffix identifier, so that other information is prevented from being mistakenly regarded as the reference table creation information generated by the first platform. Further, under the condition that verification is passed, deleting the suffix identification of the preset table name in each reference table name to obtain the corresponding target table name. For example, in the case where the reference table creation information is acquired, the suffix identification of the preset table name may be used to compare with the suffix of each reference table name in the reference table creation information, and in the case where it is determined that the two are identical, the reference table creation information that is required is currently acquired; otherwise, ending the operation and outputting prompt information corresponding to the acquisition failure to prompt the staff to initiate the second request again.
In the embodiment of the present application, a specific way of acquiring the reference table creation information is not limited, and a way of acquiring the reference table creation information by the second platform may be different according to a difference in storage location of the first platform after the reference table creation information is generated. For example, in the system architecture described above, after the reference table creation information is generated, the first platform does not return to the operation platform in the original path according to the request path corresponding to the first request, but stores the reference table creation information in the designated storage location corresponding to the other platform, and may directly acquire the reference table creation information from the designated storage location. For example, after the first platform generates the reference table structure information, the reference table structure information is directly returned to the operation platform for storage according to a request path of the first request, whether the reference table creation information is acquired in the direct second request or the reference table creation information is acquired from a storage space designated in the operation platform according to a request path corresponding to the second request can be determined according to whether the received second request includes the reference table creation information or not, and the specific mode can be determined according to actual conditions.
Based on the above, when the reference table structure information and the corresponding target table structure information are obtained, the existing table structure difference information and the corresponding data table to be modified can be determined according to the reference table structure information and the target table structure information. Alternatively, the reference table structure information and the target table structure information corresponding to each other may be first determined as a group; further, comparing each group of reference table structure information with the target table structure information to determine at least one group of target comparison groups with different table structures and corresponding table structure difference information, further, taking the corresponding target data table in each target comparison group as a data table to be modified, and generating a table structure modification SQL statement for executing table structure modification operation on the data table to be modified according to the table structure difference information corresponding to each group of target comparison groups as table structure synchronization information.
In the embodiment of the application, the table structure difference information corresponding to each group of target comparison groups comprises whether a target data table corresponding to the reference data table exists or not, whether field names in the existing target data table are in one-to-one correspondence with field names in the reference data table or not, and whether the corresponding field attributes are all the same or not. Based on this, if it is determined that there is no target data table corresponding to the reference data table, it is explained that there is no target data table corresponding to the reference data table in the first platform, and for this case, a table creation SQL statement for creating the corresponding target data table may be generated. Further, in the case that it is determined that there is a target data table corresponding to the reference data table, if it is determined that a field name in the existing target data table does not correspond to a field name in the reference data table, a modification SQL statement for modifying the field name may be generated for the non-corresponding field; accordingly, if it is determined that the attributes of the corresponding fields are different, a modified SQL statement for modifying the attributes of the fields may be generated for the fields having different attributes. Based on the above, the generated SQL sentences are summarized to obtain the table structure synchronization information for executing the table structure modification operation on the data table to be modified.
In the embodiment of the present application, the storage mode of the table structure synchronization information is not limited, and optionally, the second platform may store the generated table structure synchronization information to the specified address in the case of generating the table structure synchronization information, similar to the storage mode of the reference table creation information.
The embodiment of the application is not limited to the specific location corresponding to the designated address, and alternatively, the storage location corresponding to the designated address may be a storage space in a platform other than the second platform. For example, the processing platform may be a storage space in the processing platform in the system architecture shown in fig. 1c, based on which, in a case that it is determined that a table structure modification operation needs to be performed on a data table to be modified, the processing platform may directly obtain table structure synchronization information from the local area, so as to perform the table structure modification operation on the data table to be modified according to the table structure synchronization information. Or, the storage location corresponding to the specified address may also be an operation platform in the system architecture shown in fig. 1b, and the second platform may return the generated table structure synchronization information to the operation platform according to the request path corresponding to the second request, so that the operation platform stores the table structure synchronization information in the local specified storage space, and in a case that the table structure modification operation needs to be executed, the operation platform provides the table structure synchronization information. The specific storage mode of the table structure synchronization information can be determined according to actual requirements, and is only exemplified herein.
Further alternatively, if the table structure synchronization operation is not required to be immediately executed when the reference table creation information is obtained, a corresponding reference data table may be created on the second platform according to the reference table creation information, so that the corresponding reference table structure information is obtained based on the created reference data table under the condition that the table structure synchronization requirement exists, and then the data table to be modified and the corresponding table structure synchronization information are determined by comparing the reference table structure information with the corresponding target table structure information.
Optionally, the reference table creating information in the embodiment of the present application is an executable table creating SQL statement, based on which the first target program code embedded in the table creating SQL statement may be executed in a code componentized manner to create a plurality of reference data tables in the second platform. Further, when a plurality of reference data tables are created, the corresponding reference table structure information can be acquired from the reference table names of the plurality of reference data tables. Accordingly, the second object code embedded in the first query SQL statement may also be executed in a code componentized manner to obtain corresponding reference table structure information from the second platform, wherein the first query SQL statement is determined from a plurality of reference table names.
Likewise, the target table structure information corresponding to the plurality of target data tables may be obtained from the second platform by executing the third target program code embedded in the second query SQL statement determined according to the plurality of target table names in a code componentization manner. In this way, when the reference table structure information and the target table structure information are both obtained, the existing table structure difference information and the corresponding data table to be modified can be determined according to the reference table structure information and the target table structure information, so that the corresponding table structure modification operation can be performed on the data table to be modified under the condition that the table structure synchronization information is generated according to the table structure difference information.
Based on the above, when the table structure synchronization information is obtained, in order to restore the local data table environment of the second platform, the created multiple reference data tables may be deleted according to the preset table name suffix identification. Optionally, the to-be-deleted reference table names corresponding to the to-be-deleted reference data tables respectively can be obtained according to the preset table name suffix identification; further, a fourth object program code embedded with the delete table SQL statement is executed in a code componentized manner to delete the plurality of reference data tables from the second platform, wherein the delete table SQL statement is determined according to the plurality of reference table names to be deleted.
It should be noted that, in the above embodiment, in order to improve the processing efficiency of each platform and reduce the consumption of data resources when each platform interacts with the database, each platform may be directly connected to a database connection pool created when a platform item is started after the platform is started, and obtain available database connections from the database connection pool, and the obtained database connections are used to operate the data table, so that it is not necessary to create database connections for each operation of data, and resource waste is reduced.
Based on the foregoing embodiments and the system architecture, the overall flow of the first platform and the second platform will be described in brief below with reference to the accompanying drawings. Fig. 2b is an operation flowchart of the first interface applied to the first platform according to the embodiment of the present application, as shown in fig. 2b, when the first interface receives the first request, it first determines whether the first request includes a preset table name suffix identifier, and executes a subsequent operation by using a default preset table name suffix identifier if it determines that the first request does not include the preset table name suffix identifier. Further, the first interface may obtain an available database connection from a database connection pool created when the platform item is started, so as to access the source database through the connection, further obtain corresponding source table structure information from the source database by executing an SQL statement for obtaining source table structure information, and obtain a source table name corresponding to the source data table from the source table structure information by executing an SQL statement for obtaining the source table name.
Based on this, the corresponding reference table name can be generated according to the source table name and the preset table name suffix identification, and the corresponding reference table creation information can be generated according to the reference table name and the acquired source table structure information. Further, when the reference table creation information is obtained, the reference table creation information may be stored, and at this time, whether a corresponding preset storage address exists or not needs to be determined, and if so, the reference table structure information is stored in a storage space corresponding to the preset address; otherwise, returning the path information corresponding to the first request to the request end.
Fig. 2c is a flowchart of an operation of the second interface in the second platform according to the embodiment of the present application, where, as shown in fig. 2c, the second interface first determines whether the second request includes a preset table name suffix identifier, and performs a subsequent operation by using a default preset table name suffix identifier if it is determined that the second request does not include the second request. Further, the second interface may obtain available database connections from a database connection pool created at the start of the platform item to access the target database through the connection. Based on this, the second interface may acquire the reference table creation information generated by the first interface to perform subsequent operations based on the reference table creation information. As shown in fig. 2c, before obtaining the reference table creating information, it is required to determine whether a preset storage address exists, if so, the reference table creating information is obtained from a storage space corresponding to the preset storage address, otherwise, the reference table creating information is obtained locally. The reference table creation information acquired by the second interface from the local may be acquired from the transmitting end of the second request, or may be stored locally in advance, which is not limited herein.
Further, in the case where the reference table creation information is acquired, in order to ensure that the target data table to be searched later is correct, it is necessary to confirm whether or not the reference table creation information currently acquired is generated by the first platform, and therefore, it is necessary to check each reference table name corresponding to the reference table creation information. As shown in fig. 2c, the reference table name suffix in the reference table creation information may be checked according to the preset table name suffix identifier, and when it is determined that the reference table name suffix is identical to the preset table name suffix identifier, a corresponding reference data table is created for the reference table name that passes the check, and if the check fails, the corresponding prompt information is output. Based on the above, for the reference data table which is already created, the reference table structure information of the reference data table and the target table structure information of the corresponding target data table can be obtained, whether the table structures of the reference data table and the target table structure information of the corresponding target data table are consistent is compared, and under the condition that the table structure difference of the reference data table and the target table structure information of the target data table are not consistent, the corresponding table structure synchronization information is generated according to the table structure difference of the reference data table and the target table structure information, and the table structure synchronization information can be used as the basis for carrying out table structure modification on the currently processed target data table which is not consistent with the table structure of the reference data table. And by analogy, the processing is carried out on each reference table name corresponding to the reference table creation information until the processing is determined to be finished, and all generated table structure synchronous information is stored for use in the subsequent operation of table structure modification on the target data table in the second platform.
FIG. 2d is a schematic diagram of a data table relationship between databases across platforms according to an embodiment of the present application, as shown in FIG. 2d, the relationship between databases according to an embodiment of the present application is: the source database is on a first platform and includes source data, and the target database is on a second platform and includes target data tables. Based on the above, the first platform can generate corresponding reference table creation information according to the table structure information of the source data table, and the second platform can acquire the reference table creation information generated by the first platform, create a corresponding reference data table in the local target database based on the reference table creation information and determine a corresponding target data table; further, by acquiring the reference table structure information of the reference data table and the target table structure information of the target data table to compare the table structures of the reference data table and the target data table, the data table to be modified, which needs to be modified, can be determined, and corresponding table structure synchronization information is generated for use in subsequent table modification operation of the data table to be modified.
For detailed processing procedures of the first platform and the second platform in the embodiments of the present application, reference may be made to the above description of the system embodiments and the method embodiments, and the detailed description thereof is omitted herein.
In the embodiment of the application, aiming at a source data table and a target data table respectively belonging to a first platform and a second platform, in order to unify the table structures of the source data table and the target data table, firstly, corresponding reference table creation information is generated on the first platform based on source table structure information of the source data table; furthermore, the second platform can create a corresponding reference data table and confirm a corresponding target data table based on the reference table creation information, and determine a table structure difference between the reference data table and the target data table according to the reference table structure information of the reference data table and the target table structure information of the target data table, so as to generate corresponding table structure synchronization information; based on the table structure synchronization information, table structure modification of the target data table can be achieved. By the method, the cross-platform table structure synchronous confirmation operation can be automatically completed in a code assembly mode on the basis of no other synchronous tools, the original data of the database is changed slightly, the efficiency and accuracy of data processing can be improved in the whole implementation process, and labor cost and resource loss can be reduced.
It should be noted that, the execution subjects of each step of the method provided in the above embodiment may be the same device, or the method may also be executed by different devices. For example, the execution subject of step S1 to step S6 may be the device a; for another example, the execution subject of step S1 may be the device a, and the execution subjects of steps S2 to S6 may be the device B; etc.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations appearing in a specific order are included, but it should be clearly understood that the operations may be performed out of the order in which they appear herein or performed in parallel, the sequence numbers of the operations, such as S1, S2, etc., are merely used to distinguish between the various operations, and the sequence numbers themselves do not represent any order of execution. In addition, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first" and "second" herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, and are not limited to the "first" and the "second" being different types.
Based on the foregoing, the embodiment of the present application further provides a computer device, where the computer device may be a service device in the second platform in the foregoing system embodiment. Fig. 3 is a schematic structural diagram corresponding to a connection relationship between main functional modules of the computer device, and as shown in fig. 3, the computer device includes: a processor 31 and a memory 32 storing a computer program; wherein the processor 31 and the memory 32 may be one or more.
The memory 32 is mainly used for storing computer programs, and the computer programs can be executed by the processor 31, so that the processor 31 controls the computer device to realize corresponding functions and complete corresponding actions or tasks. In addition to storing computer programs, the memory 32 may also be configured to store various other data to support operations on the computer device. Examples of such data include instructions for any application or method operating on a computer device.
The memory 32 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
In the embodiment of the present application, the implementation form of the processor 31 is not limited, and may be, for example, but not limited to, a CPU, a GPU, an MCU, or the like. The processor 31 may be regarded as a control system of a computer device operable to execute a computer program stored in the memory 32 for controlling the computer device to perform the respective functions, perform the respective actions or tasks. It should be noted that, depending on the implementation form of the computer device and the scene in which the computer device is located, the functions, actions or tasks to be implemented may be different; accordingly, the computer programs stored in the memory 32 may also vary, and execution of the different computer programs by the processor 31 may control the computer device to perform different functions, perform different actions or tasks.
In some alternative embodiments, as shown in FIG. 3, the computer device may further comprise: the display 33, the power supply component 34, the communication component 35, and other components, the display 33 is used for displaying an on-vehicle graphical user interface. The illustration of only a few components in fig. 3 does not mean that the computer device comprises only the components shown in fig. 3, but that the computer device may also comprise other components for different application requirements, for example, in case of a voice interaction requirement, as shown in fig. 3, the computer device may also comprise an audio component 36. The components that the computer device may include may depend on the product form of the computer device, and are not limited herein.
In an embodiment of the present application, the processor 31, when executing the computer program in the memory 32, is adapted to: acquiring reference table creation information generated by a first platform, wherein the reference table creation information is generated according to source table structure information corresponding to a plurality of source data tables to be synchronized, and the reference table creation information comprises a plurality of reference table names; determining corresponding reference table structure information according to the reference table creation information; and determining, for each reference table name, a target table name having the same table name as its corresponding source table name; acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names; determining existing table structure difference information and a corresponding data table to be modified according to the reference table structure information and the target table structure information; and generating table structure synchronous information for executing table structure modification operation on the data table to be modified according to the table structure difference information.
In an alternative embodiment, each reference table name in the reference table creation information is obtained by adding a preset table name suffix identifier on the basis of its corresponding source table name, and for each reference table name, when determining that the source table name corresponding to the reference table name has the target table name with the same table name, the processor 31 is configured to: checking each reference table name in the reference table creation information according to the preset table name suffix identification; and deleting the suffix identification of the preset table name in each reference table name under the condition that verification is passed, so as to obtain the corresponding target table name.
In an alternative embodiment, the processor 31 is configured to, when determining the existing table structure difference and the corresponding data table to be modified according to the reference table structure information and the target table structure information: determining the reference table structure information and the target table structure information corresponding to each other as a group; comparing the reference table structure information and the target table structure information in each group, and determining at least one group of target comparison groups with different table structures and corresponding table structure difference information; and taking the corresponding target data table in each target comparison group as a data table to be modified.
In an alternative embodiment, the processor 31 is configured to, when generating table structure synchronization information for performing a table structure modification operation on a data table to be modified according to the table structure difference information: and generating a table structure modification SQL statement for executing the table structure modification operation on the data table to be modified according to the table structure difference information, and taking the SQL statement as table structure synchronization information.
In an alternative embodiment, the reference table creating information is a table creating SQL statement, and the processor 31 is further configured to, before determining the corresponding reference table structure information according to the reference table creating information: executing first object program code embedded in the build table SQL statement to create a plurality of reference data tables at a second platform; accordingly, determining corresponding reference table structure information includes: executing the second object program code embedded in the first query SQL statement, and acquiring corresponding reference table structure information from the second platform, wherein the first query SQL statement is determined according to a plurality of reference table names.
In an alternative embodiment, the processor 31 is configured to, when acquiring the target table structure information corresponding to the plurality of target data tables according to the plurality of target table names: and executing a third target program code embedded in a second query SQL statement, and acquiring target table structure information corresponding to a plurality of target data tables from a second platform, wherein the second query SQL statement is determined according to the plurality of target table names.
In an alternative embodiment, processor 31 is further configured to: acquiring to-be-deleted reference table names respectively corresponding to a plurality of to-be-deleted reference data tables according to a preset table name suffix identification; and executing fourth target program codes embedded in the delete table SQL sentence to delete the plurality of reference data tables from the second platform, wherein the delete table SQL sentence is determined according to the plurality of reference table names to be deleted.
It should be noted that, regarding the specific functions of the processor in the above-mentioned computer device, reference may be made to the above-mentioned system embodiments and method embodiments, which are not described herein again.
Accordingly, embodiments of the present application also provide a computer-readable storage medium storing a computer program/instruction that, when executed, is capable of implementing the steps of the method embodiments described above that are executable by a computer device.
The communication assembly of the above embodiments is configured to facilitate wired or wireless communication between the device in which the communication assembly is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as a mobile communication network of WiFi,2G, 3G, 4G/LTE, 5G, etc., or a combination thereof. In one exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component further comprises a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
The display in the above-described embodiments includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation.
The power supply assembly in the above embodiment provides power for various components of the device in which the power supply assembly is located. The power components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the devices in which the power components are located.
The audio component in the above-described fig. embodiments may be configured to output and/or input audio signals. For example, the audio component includes a Microphone (MIC) configured to receive external audio signals when the device in which the audio component is located is in an operational mode, such as a call mode, a recording mode, and a speech recognition mode. The received audio signal may be further stored in a memory or transmitted via a communication component. In some embodiments, the audio assembly further comprises a speaker for outputting audio signals.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (8)

1. A method for synchronizing a data table structure across platforms, the method being adapted for use with a second platform, the method comprising:
the method comprises the steps that reference table creation information generated by a first platform is obtained, the reference table creation information is generated according to source table structure information corresponding to a plurality of source data tables to be synchronized, the reference table creation information comprises a plurality of reference table names, each reference table name in the reference table creation information is obtained by adding a preset table name suffix mark on the basis of the corresponding source table name, and the reference table creation information is a table building SQL statement;
executing first object program code embedded in the table-building SQL statement to create a plurality of reference data tables at the second platform;
determining corresponding reference table structure information according to the reference table creation information, specifically including: executing second target program codes embedded in a first query SQL statement, and acquiring corresponding reference table structure information from the second platform, wherein the first query SQL statement is determined according to the plurality of reference table names; and
For each reference table name, determining a target table name with the same table name as the corresponding source table name specifically comprises the following steps: checking each reference table name in the reference table creation information according to the preset table name suffix identification; and deleting the preset table name suffix identification in each reference table name under the condition that verification is passed, so as to obtain a corresponding target table name;
acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names;
determining existing table structure difference information and a corresponding data table to be modified according to the reference table structure information and the target table structure information;
and generating table structure synchronous information for executing table structure modification operation on the data table to be modified according to the table structure difference information.
2. The method of claim 1, wherein determining the table structure differences present and the corresponding data tables to be modified based on the reference table structure information and the target table structure information comprises:
determining the reference table structure information and the target table structure information corresponding to each other as a group;
comparing the reference table structure information and the target table structure information in each group, and determining at least one group of target comparison groups with different table structures and corresponding table structure difference information;
And taking the corresponding target data table in each target comparison group as a data table to be modified.
3. The method of claim 2, wherein generating table structure synchronization information for performing a table structure modification operation on the data table to be modified based on the table structure difference information comprises:
and generating a table structure modification operation modification SQL statement for executing the table structure modification operation on the data table to be modified according to the table structure difference information, and taking the SQL statement as table structure synchronization information.
4. The method of claim 1, wherein obtaining target table structure information corresponding to a plurality of target data tables according to a plurality of target table names, comprises:
and executing a third target program code embedded in a second query SQL statement, and acquiring target table structure information corresponding to a plurality of target data tables from the second platform, wherein the second query SQL statement is determined according to the plurality of target table names.
5. The method according to claim 4, wherein the method further comprises:
acquiring to-be-deleted reference table names respectively corresponding to a plurality of to-be-deleted reference data tables according to the preset table name suffix identification;
and executing fourth target program codes embedded in a delete table SQL statement to delete the plurality of reference data tables from the second platform, wherein the delete table SQL statement is determined according to a plurality of reference table names to be deleted.
6. A data sheet management system, comprising:
the system comprises a first platform, a second platform and a third platform, wherein the first platform is used for generating corresponding reference table creation information according to source table structure information corresponding to a plurality of source data tables to be synchronized, the reference table creation information comprises a plurality of reference table names, and each reference table name is obtained by adding a preset table name suffix identifier on the basis of the corresponding source table name;
the second platform is used for acquiring the reference table creation information, wherein the reference table creation information is a table creation SQL statement; executing a first object program code embedded in the table-building SQL sentence, creating a plurality of reference data tables, and determining corresponding reference table structure information according to the reference table creation information, wherein the method specifically comprises the following steps: executing second target program codes embedded in a first query SQL statement, and acquiring corresponding reference table structure information, wherein the first query SQL statement is determined according to the plurality of reference table names; and for each reference table name, determining a target table name with the same table name as the corresponding source table name, specifically comprising: checking each reference table name in the reference table creation information according to the preset table name suffix identification; and deleting the preset table name suffix identification in each reference table name under the condition that verification is passed, so as to obtain a corresponding target table name; acquiring target table structure information corresponding to a plurality of target data tables according to the plurality of target table names; determining a data table to be modified, which has a table structure difference with a plurality of reference data tables, in the plurality of target data tables according to the reference table structure information and the target table structure information; and generating table structure synchronization information for executing table structure modification operation on the data table to be modified according to the table structure difference.
7. The system of claim 6, wherein the second platform, when determining, for each reference table name, a target table name having the same table name as its corresponding source table name, is to:
checking each reference table name in the reference table creation information according to the preset table name suffix identification; and
and deleting the suffix identification of the preset table name in each reference table name under the condition that verification is passed, so as to obtain the corresponding target table name.
8. A computer device, comprising: a processor and a memory storing a computer program for implementing the method according to any one of claims 1-5 when the computer program is executed by the processor.
CN202310854898.8A 2023-07-12 2023-07-12 Data table structure synchronization method, system and equipment Active CN116578651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310854898.8A CN116578651B (en) 2023-07-12 2023-07-12 Data table structure synchronization method, system and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310854898.8A CN116578651B (en) 2023-07-12 2023-07-12 Data table structure synchronization method, system and equipment

Publications (2)

Publication Number Publication Date
CN116578651A CN116578651A (en) 2023-08-11
CN116578651B true CN116578651B (en) 2023-11-17

Family

ID=87538165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310854898.8A Active CN116578651B (en) 2023-07-12 2023-07-12 Data table structure synchronization method, system and equipment

Country Status (1)

Country Link
CN (1) CN116578651B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102129478A (en) * 2011-04-26 2011-07-20 广州从兴电子开发有限公司 Database synchronization method and system thereof
WO2019161645A1 (en) * 2018-02-24 2019-08-29 平安科技(深圳)有限公司 Shell-based data table extraction method, terminal, device, and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102129478A (en) * 2011-04-26 2011-07-20 广州从兴电子开发有限公司 Database synchronization method and system thereof
WO2019161645A1 (en) * 2018-02-24 2019-08-29 平安科技(深圳)有限公司 Shell-based data table extraction method, terminal, device, and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
基于元数据驱动的异构数据模型映射算法;袁满;陈星童;;东北林业大学学报(第12期);全文 *
基于元数据驱动的通用数据迁移工具;任庆东;李天阳;袁满;许翰文;;大庆石油学院学报(第01期);全文 *
异构数据库数据迁移测试软件的研究与实现;陈巍;刘艺雯;;安徽工程科技学院学报(自然科学版)(第04期);全文 *
数据同步中差异数据捕获的设计与实现;孙广雨;山岚;;北京化工大学学报(自然科学版)(第03期);全文 *

Also Published As

Publication number Publication date
CN116578651A (en) 2023-08-11

Similar Documents

Publication Publication Date Title
US10095499B2 (en) Optimization for multi-project package manager
CN104978191B (en) Using dispositions method and service device
CN112860798B (en) Data processing method and device, electronic equipment and storage medium
US9092493B2 (en) Adaptive warehouse data validation tool
US20220051662A1 (en) Systems and methods for extraction of user intent from speech or text
CN109471647B (en) Data updating method and device, electronic equipment and readable medium
CN113722394A (en) Data synchronization method, device and storage medium
CN112905441A (en) Test case generation method, test method, device and equipment
CN110198327B (en) Data transmission method and related equipment
CN110688305A (en) Test environment synchronization method, device, medium and electronic equipment
CN111209195B (en) Method and device for generating test case
CN116628085A (en) Synchronous processing method and device of database, electronic equipment and storage medium
CN117370361B (en) Data table operation method, device, electronic equipment and computer readable medium
US8538414B1 (en) Mobile interaction with software test cases
CN114201484A (en) Information processing method, information processing device, electronic equipment and storage medium
CN112988860B (en) Data acceleration processing method and device and electronic equipment
CN116578651B (en) Data table structure synchronization method, system and equipment
CN110780894A (en) Hot upgrade processing method and device and electronic equipment
EP3639138B1 (en) Action undo service based on cloud platform
CN111104409A (en) Database processing method and device, storage medium and electronic equipment
CN117827865A (en) Data blood edge analysis method, device, equipment and storage medium
CN116739397B (en) Dynamic management method for new energy indexes
CN112527765B (en) Data migration method and device
CN117112654B (en) City data display method, device, computer equipment and storage medium
US20220147568A1 (en) Mapping expression generator

Legal Events

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