Database unloading method, device, system, storage medium and program product
By generating structured query statements from database type configuration information, the problem of poor compatibility of data unloading tools is solved, enabling a fast database unloading process that does not require modification of the source code, thus improving the speed of database iteration and updates.
Patent Information
- Application Number
- CN202111615182.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing data offloading tools have poor compatibility with different types of databases, requiring developers to manually modify code and deploy them, which is a complex and time-consuming process.
By obtaining the database type configuration information of the data provider and the requester, a structured query statement is generated, the data in the source data table is transferred to the target data table, and the data format is processed using the configuration information to generate a standard data file, reducing the need to modify the source code.
It improves compatibility with different database types, reduces development and design workload, and increases the speed of database iteration and updates.
Smart Images

Figure CN114238487B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, and in particular to methods, apparatus, systems, storage media, and program products for unloading data from databases. Background Technology
[0002] When extracting data from one or more databases into a target database within an enterprise or between different enterprises, it is usually done using a dedicated data extraction tool customized for the data provider and the data requester.
[0003] Existing data unloading tools are often based on configuration schemes for a single, specific database. For enterprises using multiple different database software, this requires manual modification of the database and additional adaptation of dependent software, which is very inconvenient. For example, different databases exhibit the following differences during data unloading: different drivers require the application to explicitly invoke the corresponding driver interface and add the corresponding database driver JAR dependency; different databases have significantly different data types, requiring the application to implement different compatibility strategies for different data types; and some specific databases may require special settings.
[0004] Therefore, it's evident that if a new or modified database is added, due to differences in drivers and database types, the data unloading tool code needs to be modified for the new or modified database, repackaged, and deployed to the production environment. This means that when developers make technical modifications to the data unloading method for different databases, they often need to involve code modification, packaging, and deployment, which is obviously time-consuming, involves multiple personnel, and has a complex process. Clearly, the above problem is caused by the data unloading tool's lack of compatibility.
[0005] Therefore, improving the compatibility of data unloading tools with different types of databases has become a pressing technical problem. Summary of the Invention
[0006] This invention provides a method, apparatus, system, storage medium, and program product for unloading database data, in order to solve the technical problem of poor compatibility of unloading tools with different types of databases in the prior art.
[0007] Firstly, to solve the above-mentioned technical problems, the technical solution of a database data unloading method provided by the embodiments of the present invention is as follows:
[0008] Obtain table information of the source data table in the database of the data provider, and obtain basic information of the target data table of the data requester;
[0009] Obtain the configuration information of the database type to which the database belongs from the database configuration file; wherein, the database configuration file includes configuration information corresponding to different database types, and the configuration information is used to characterize the relevant information required for unloading data in the database of the corresponding database type;
[0010] Based on the basic information and the table information of the source data table, a structured query statement is generated using the configuration information to offload data from the source data table to the target data table;
[0011] The structured query statement is executed to obtain the file to be transmitted from the target data table and then transmitted to the data requester; wherein the standard data file in the file to be transmitted is obtained by processing the data in the source data table using the configuration information.
[0012] One possible implementation involves obtaining table information of the source data table in the data provider's database, including:
[0013] The table information of the source data table is obtained from the database using the table list component.
[0014] One possible implementation involves obtaining basic information about the target data table from the data requester, including:
[0015] The data unloading requirement file from the data provider is parsed to obtain the basic information of the target data table; wherein, the data unloading requirement file is used to record the basic information and related requirements of the target data table.
[0016] One possible implementation involves executing the structured query statement to obtain the file to be transmitted from the target data table, including:
[0017] Execute the structured query statement to obtain the query results;
[0018] Based on the dimensions of the target data table, the data in the query results is converted into the standard data format required by the target data table using the configuration information, and written into a data file of the first format to obtain the standard data file;
[0019] Based on the dimensions of the target data table, the file information of the standard data file is written into a second-format verification file, wherein the database name in the file information is represented by the database type to which the target data table belongs, and the verification file is used to verify the standard data file;
[0020] Based on the dimensions of the target data table, the field information contained in the target data table is written into a description file in a third format;
[0021] The standard data file, the verification file, and the description file are combined to form the file to be transmitted.
[0022] One possible implementation includes, before writing the field information contained in the target data table into a third-format specification file:
[0023] From the configuration information, obtain the data types contained in the database, and the mapping relationship between the data types and the standard data format;
[0024] Based on the mapping relationship between the data type and the standard data format, the data type corresponding to each field in the source data table is written into the standard data format corresponding to the target data table.
[0025] One possible implementation, the configuration information includes:
[0026] The database connection information corresponding to the database type, the data interface standard corresponding to the data type, the database function corresponding to the database type, the driver information corresponding to the database type, and the special configuration information corresponding to the database type.
[0027] One possible implementation, the basic information includes:
[0028] Table name, unloading date, unloading method, multi-entity identifier, additional conditions.
[0029] Secondly, embodiments of the present invention provide a database unloading apparatus, comprising:
[0030] The transmission unit is used to execute the structured query statement, obtain the file to be transmitted of the target data table, and transmit it to the data requester; wherein the standard data file in the file to be transmitted is obtained by processing the data in the source data table using the configuration information.
[0031] In one possible implementation, the acquisition unit is further configured to:
[0032] The table information of the source data table is obtained from the database using the table list component.
[0033] In one possible implementation, the acquisition unit is further configured to:
[0034] The data unloading requirement file from the data provider is parsed to obtain the basic information of the target data table; wherein, the data unloading requirement file is used to record the basic information and related requirements of the target data table.
[0035] In one possible implementation, the transmission unit is further configured to:
[0036] Execute the structured query statement to obtain the query results;
[0037] Based on the dimensions of the target data table, the data in the query results is converted into the standard data format required by the target data table using the configuration information, and written into a data file of the first format to obtain the standard data file;
[0038] Based on the dimensions of the target data table, the file information of the standard data file is written into a second-format verification file, wherein the database name in the file information is represented by the database type to which the target data table belongs, and the verification file is used to verify the standard data file;
[0039] Based on the dimensions of the target data table, the field information contained in the target data table is written into a description file in a third format;
[0040] The standard data file, the verification file, and the description file are combined to form the file to be transmitted.
[0041] In one possible implementation, the transmission unit is further configured to:
[0042] From the configuration information, obtain the data types contained in the database, and the mapping relationship between the data types and the standard data format;
[0043] Based on the mapping relationship between the data type and the standard data format, the data type corresponding to each field in the source data table is written into the standard data format corresponding to the target data table.
[0044] One possible implementation, the configuration information includes:
[0045] The database connection information corresponding to the database type, the data interface standard corresponding to the data type, the database function corresponding to the database type, the driver information corresponding to the database type, and the special configuration information corresponding to the database type.
[0046] One possible implementation, the basic information includes:
[0047] Table name, unloading date, unloading method, multi-entity identifier, additional conditions.
[0048] Thirdly, embodiments of the present invention also provide a data unloading system, comprising:
[0049] Multiple databases corresponding to various database types;
[0050] A data unloading tool is used to access the database and perform the method described in the first aspect.
[0051] Fourthly, embodiments of the present invention also provide a database unloading apparatus, comprising:
[0052] At least one processor, and
[0053] Memory connected to the at least one processor;
[0054] The memory stores instructions that can be executed by the at least one processor, which executes the instructions stored in the memory to perform the method described in the first aspect above.
[0055] Fifthly, embodiments of the present invention also provide a readable storage medium, comprising:
[0056] memory,
[0057] The memory is used to store instructions that, when executed by a processor, cause the apparatus including the readable storage medium to perform the method described in the first aspect above.
[0058] Fifthly, embodiments of the present invention also provide a computer program product comprising computer-executable instructions for causing a computer to perform the method described in the first aspect.
[0059] Through the technical solutions in one or more of the above embodiments of the present invention, the embodiments of the present invention have at least the following technical effects:
[0060] In the embodiments provided by this invention, since configuration information containing different database types is used, the configuration information of the database type of the data provider's database can be automatically obtained from the database configuration file according to the database type to which the data provider's database belongs. Then, the corresponding configuration information is used to generate a structured query statement to offload data from the source data table to the target data table. By executing the structured query statement, the file to be transmitted for the target data table is obtained and transmitted to the data requester, thus completing the offloading work. When the version of the database data type to which the data provider's database belongs is updated, or when a database of another database type needs to be added to the data provider, only the database configuration file needs to be modified, without modifying the source code, so that the relevant addition or modification work can be completed quickly. This improves the compatibility of offloading data from databases of different database types. At the same time, since no modification to the source code is required, the workload of development and design is reduced, and the iterative update speed of database offloading is improved. Attached Figure Description
[0061] Figure 1 A flowchart of a database data unloading method provided in an embodiment of the present invention;
[0062] Figure 2 This is a schematic diagram of the structure of a database data unloading device provided in an embodiment of the present invention;
[0063] Figure 3 This is a schematic diagram of a data unloading system provided in an embodiment of the present invention. Detailed Implementation
[0064] This invention provides a method, apparatus, system, storage medium, and program product for unloading database data, in order to solve the technical problem of poor compatibility of unloading tools with different types of databases in the prior art.
[0065] Data offloading: The data offloading party (data provider) exports data from its own node's database according to standard data exchange methods and writes it to an external file, then uses data transmission tools to push the data to the data requester.
[0066] Database: The database or database server used by a database application.
[0067] To better understand the above technical solutions, the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments and specific features in the embodiments are detailed descriptions of the technical solutions of the present invention, rather than limitations thereof. Where there is no conflict, the embodiments and technical features in the embodiments can be combined with each other. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with the relevant provisions of national laws and regulations.
[0068] Please refer to Figure 1 This invention provides a method for unloading data from a database, and the processing procedure of this method is as follows.
[0069] Step 101: Obtain the table information of the source data table in the database of the data provider, and obtain the basic information of the target data table of the data requester.
[0070] The table list component can be used to retrieve table information from the data provider's database. This table information includes basic table information, table structure, fields contained in the table, data types of the fields, relationships with other tables, total number of records in the table, and size of each record.
[0071] Before data requesters use data offloading tools to offload data from their database to target tables, they typically need to define the requirements for the target tables, creating a corresponding offloading requirement document. The offloading tool parses this document to obtain the basic information of the target tables. This document records the basic information and requirements of the target tables, including table name, offloading date, offloading method, multiple entity identifiers, and additional conditions.
[0072] After obtaining the table information of the source data table and the basic information of the target data table, step 102 can be executed.
[0073] Step 102: Obtain the configuration information of the database type from the database configuration file; wherein, the database configuration file includes configuration information corresponding to different database types, and the configuration information is used to characterize the relevant information required for data in the database of the corresponding database type.
[0074] Database type refers to the database software used, such as MySQL, MariaDB, Percona Server, PostgreSQL, Microsoft Access, Microsoft SQL Server, Google Fusion Tables, FileMaker, Oracle, Sybase, dBASE, Clipper, FoxPro, foshu, NoSQL, BigTable, Cassandra, MongoDB, CouchDB, Apache Cassandra, Dynamo, LevelDB, etc.
[0075] The database configuration file can include configuration information corresponding to each of the above database types. This configuration information includes: database connection information corresponding to the database type, data interface standard corresponding to the data type, database function corresponding to the database type, driver information corresponding to the database type, and special configuration information corresponding to the database type.
[0076] When a new database type needs to be added, simply add the corresponding database type and configuration information to the database configuration file mentioned above. Alternatively, if an existing data type in the database configuration file is updated and the corresponding configuration information needs to be modified, you can simply modify the corresponding configuration information directly. This way, you can quickly add a new database type or update the configuration information of an existing database type without modifying the source code, thereby improving the compatibility of the data removal tool with different database types.
[0077] For example, if a data provider's database is of the MySQL type, then the configuration information corresponding to MySQL is obtained from the database configuration file. This configuration information includes MySQL database connection information, data interface standards, database functions, driver information, etc. Since MySQL does not have any special configuration, its corresponding configuration information does not contain any special configuration information.
[0078] If the other data provider's database is Oracle, then the corresponding Oracle configuration information is obtained from the database configuration file. This configuration information includes MySQL database connection information, data interface standards, database functions, driver information, and special configuration information. Because Oracle includes special configurations, the Oracle configuration information contains special configuration details.
[0079] After obtaining the database type of the data provider's database, step 103 can be executed.
[0080] Step 103: Based on the basic information and the table information of the source data table, use the configuration information to generate a structured query statement that dumps the data from the source data table to the target data table.
[0081] For example, the source data table includes its name, fields 1 through 8, a total of 3000 records, and the data types of fields 1 through 8. The target data table includes fields 3 through 7 and field 9, and the standard data formats for each field. Field 9 is the sum of the data from fields 1 and 2 in the same record of the source data table. Based on this relationship, the configuration information of the database type of the source data table can be used to generate structured query (SQL) statements that unload fields 3 through 7 from the source data table to fields 3 through 7 of the target data table, as well as a structured query statement to retrieve the sum of the data from fields 1 and 2 in the same record. All these structured query statements can then be assembled into a structured query statement for the target data table.
[0082] After obtaining the structured query statement for the target data table, step 104 can be executed.
[0083] Step 104: Execute a structured query statement to obtain the file to be transferred from the target data table and transmit it to the data requester; wherein, the standard data file in the file to be transferred is obtained by processing the data in the source data table using configuration information.
[0084] To execute a structured query and obtain the file to be transferred from the target data table, the following methods can be used:
[0085] Execute a structured query statement to obtain the query results; based on the dimensions of the target data table, use configuration information to convert the data in the query results into the standard data format required by the target data table, and write it into a first-format data file to obtain a standard data file; based on the dimensions of the target data table, write the file information of the standard data file into a second-format verification file, wherein the database name in the file information is represented by the database type to which the target data table belongs, and the verification file is used to verify the standard data file; based on the dimensions of the target data table, write the field information contained in the target data table into a third-format description file; combine the standard data file, verification file, and description file into a file to be transmitted.
[0086] Before writing the field information contained in the target data table into the third-format specification file, it also includes:
[0087] From the configuration information, obtain the data types contained in the database and the mapping relationship between the data types and the standard data format; based on the mapping relationship between the data types and the standard data format, write the data type corresponding to each field in the source data table into the standard data format corresponding to the target data table.
[0088] For example, executing a structured query statement retrieves 3000 records from the source table, consisting of fields 3 through 7 and field 9. Since fields 1 and 2 are of floating-point data type, field 9, which is the sum of the data from fields 1 and 2, is also of floating-point data type. However, the target table requires field 9 to be in integer text format. Therefore, based on the configuration information of the source table, the data corresponding to field 9 in the query results is converted to the standard data format required by field 9 in the target table (rounded down and converted to text). This allows the data in the standard data format corresponding to field 9 to be written to a standard data file in a first format (such as DAT format). Similarly, data in the standard data format corresponding to other fields can be written to the standard data file, ultimately obtaining the standard data file required by the target table.
[0089] Furthermore, the file information of the aforementioned standard data files needs to be written into a validation file in a second format (such as XML format) according to the dimensions of the target data table. This way, when the data provider receives the standard data files, they can verify them using the simultaneously received validation file to determine if there is any data loss or error, and whether the database type corresponding to the standard data file is consistent with the database type of the target data table. Additionally, based on the dimensions of the target data table, the field information contained within the target data table will be written into a description file in a third format (such as DDL format). This facilitates the data provider's rapid creation of the target data table and the writing of the data from the standard data files into the target data table.
[0090] After creating the standard data file, verification file, and instruction file, you can combine them into a file to be transferred and call the data transfer tool to transfer the file to the data provider to complete the data transfer.
[0091] In the embodiments provided by this invention, since configuration information containing different database types is used, the configuration information of the database type of the data provider's database can be automatically obtained from the database configuration file according to the database type to which the data provider's database belongs. Then, the corresponding configuration information is used to generate a structured query statement to offload data from the source data table to the target data table. By executing the structured query statement, the file to be transmitted for the target data table is obtained and transmitted to the data requester, thus completing the offloading work. When the version of the database data type to which the data provider's database belongs is updated, or when a database of another database type needs to be added to the data provider, only the database configuration file needs to be modified, without modifying the source code, so that the relevant addition or modification work can be completed quickly. This improves the compatibility of offloading data from databases of different database types. At the same time, since no modification to the source code is required, the workload of development and design is reduced, and the iterative update speed of database offloading is improved.
[0092] Based on the same inventive concept, one embodiment of the present invention provides a database unloading device. Specific implementation methods for the database unloading method of this device can be found in the description of the method embodiments section; repeated details will not be repeated here. Figure 2 The device includes:
[0093] The acquisition unit 201 is used to acquire table information of source data tables in the database of the data provider and basic information of target data tables of the data requester; and to acquire configuration information of the database type to which the database belongs from the database configuration file; wherein, the database configuration file includes configuration information corresponding to different database types, and the configuration information is used to characterize the relevant information required for data in the database of the corresponding database type.
[0094] The generation unit 202 is used to generate a structured query statement that offloads data from the source data table to the target data table based on the basic information and the table information of the source data table, using the configuration information.
[0095] The transmission unit 203 is used to execute the structured query statement, obtain the file to be transmitted of the target data table, and transmit it to the data requester; wherein, the standard data file in the file to be transmitted is obtained by processing the data in the source data table using the configuration information.
[0096] In one possible implementation, the acquisition unit 201 is further configured to:
[0097] The table information of the source data table is obtained from the database using the table list component.
[0098] In one possible implementation, the acquisition unit 201 is further configured to:
[0099] The data unloading requirement file from the data provider is parsed to obtain the basic information of the target data table; wherein, the data unloading requirement file is used to record the basic information and related requirements of the target data table.
[0100] In one possible implementation, the transmission unit 203 is further configured to:
[0101] Execute the structured query statement to obtain the query results;
[0102] Based on the dimensions of the target data table, the data in the query results is converted into the standard data format required by the target data table using the configuration information, and written into a data file of the first format to obtain the standard data file;
[0103] Based on the dimensions of the target data table, the file information of the standard data file is written into a second-format verification file, wherein the database name in the file information is represented by the database type to which the target data table belongs, and the verification file is used to verify the standard data file;
[0104] Based on the dimensions of the target data table, the field information contained in the target data table is written into a description file in a third format;
[0105] The standard data file, the verification file, and the description file are combined to form the file to be transmitted.
[0106] In one possible implementation, the transmission unit 203 is further configured to:
[0107] From the configuration information, obtain the data types contained in the database, and the mapping relationship between the data types and the standard data format;
[0108] Based on the mapping relationship between the data type and the standard data format, the data type corresponding to each field in the source data table is written into the standard data format corresponding to the target data table.
[0109] One possible implementation, the configuration information includes:
[0110] The database connection information corresponding to the database type, the data interface standard corresponding to the data type, the database function corresponding to the database type, the driver information corresponding to the database type, and the special configuration information corresponding to the database type.
[0111] One possible implementation, the basic information includes:
[0112] Table name, unloading date, unloading method, multi-entity identifier, additional conditions.
[0113] It should be noted that the division of units in the embodiments of this application is illustrative and only represents one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.
[0114] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a processor-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0115] It should be noted that the apparatus provided in this embodiment of the invention can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Therefore, the parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.
[0116] Based on the same inventive concept, this invention provides a data unloading system in its embodiments. Please refer to [link to relevant documentation]. Figure 3 The unloading system includes:
[0117] Multiple database 301 errors corresponding to various database types;
[0118] Data unloading tool 302 is used to access the database 301 and perform the database data unloading method as described above.
[0119] Based on the same inventive concept, this invention provides a database data unloading apparatus, comprising: at least one processor, and
[0120] Memory connected to the at least one processor;
[0121] The memory stores instructions that can be executed by the at least one processor, and the at least one processor executes the database unloading method described above by executing the instructions stored in the memory.
[0122] Based on the same inventive concept, embodiments of the present invention also provide a readable storage medium, comprising:
[0123] memory,
[0124] The memory is used to store instructions that, when executed by a processor, cause the apparatus including the readable storage medium to perform the database unloading method as described above.
[0125] The readable storage medium can be any available medium or data storage device accessible to the processor, including volatile memory or non-volatile memory, or both. By way of example, and not limitation, non-volatile memory can include read-only memory (ROM), programmable read-only memory (PROM), electrically programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, solid-state disk (SSD), magnetic storage (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disc (MO), etc.), and optical storage (e.g., CD, DVD, BD, HVD, etc.). Volatile memory can include random access memory (RAM), which can act as an external cache memory. By way of example and not limitation, RAM can be obtained in various forms, such as Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random-Access Memory (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), and Sync Link DRAM (SLDRAM). The storage devices disclosed herein are intended to include, but are not limited to, these and other suitable types of memory.
[0126] Based on the same inventive concept, this invention provides a computer program product including program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps of the database unloading method according to various exemplary embodiments of this application described above.
[0127] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of machine program products implemented on one or more readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer / processor-usable program code.
[0128] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These program instructions can 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, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0129] These program instructions may also be stored in a readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0130] These 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 process implemented by the computer / processor, thereby providing instructions that execute on the computer / processor or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0131] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for database unloading, characterized by, The method comprises the following steps: obtaining table information of a source data table in a database of a data provider, and obtaining basic information of a target data table of a data demander; obtaining configuration information of a database type to which the database belongs from a database configuration file; wherein the database configuration file comprises configuration information corresponding to different database types, and the configuration information is used to represent related information required by data in a database corresponding to the database type; generating a structured query statement for unloading data in the source data table to the target data table according to the basic information and the table information of the source data table, and using the configuration information; executing the structured query statement to obtain a query result from the source data table; converting data in the query result into a standard data format required by the target data table according to the dimensions of the target data table, and writing the data into a data file in a first format to obtain a standard data file, and using the configuration information; writing file information of the standard data file into a check file in a second format according to the dimensions of the target data table, wherein a database name in the file information is represented by a database type to which the target data table belongs, and the check file is used for checking whether a received standard data file has a request of data loss or error, and checking whether a database type corresponding to the received standard data file is consistent with the database type to which the target data table belongs; writing field information contained in the target data table into an explanation file in a third format according to the dimensions of the target data table; assembling the standard data file, the check file and the explanation file into a to-be-transmitted file of the target data table, and transmitting the to-be-transmitted file to the data demander.
2. The method of claim 1, wherein, The method comprises the following steps: obtaining table information of a source data table in a database of a data provider, comprising:
3. The method of claim 1, wherein, obtaining table information of the source data table from the database through a table component tablelist. The method comprises the following steps:
4. The method of claim 1, wherein, obtaining basic information of a target data table of a data demander, comprising: parsing an unloading demand file of the data provider to obtain the basic information of the target data table; wherein the unloading demand file is used to record the basic information and related requirements of the target data table. Before writing field information contained in the target data table into an explanation file in a third format, the method further comprises the following steps:
5. The method according to any one of claims 1 to 4, wherein obtaining data types contained in the database and a mapping relationship between the data types and the standard data format from the configuration information; writing a data type corresponding to each field in the source data table into a standard data format corresponding to the target data table according to the mapping relationship between the data types and the standard data format.
6. The method according to any one of claims 1 to 4, wherein The configuration information comprises: database connection information corresponding to the database type, data interface standards corresponding to the data type, database functions corresponding to the database type, driving information corresponding to the database type, and special configuration information corresponding to the database type.
7. An apparatus for database unloading, the apparatus comprising: The basic information comprises: table name, unloading date, unloading mode, multi-entity identifier and additional conditions. The method comprises the following steps: An acquisition unit is configured to acquire table information of a source data table in a database of a data provider and basic information of a target data table of a data demander; Obtaining configuration information of a database type to which the database belongs from a database configuration file; wherein the database configuration file comprises configuration information corresponding to different database types, and the configuration information is used to represent related information required by data in a database corresponding to the database type; A generation unit is configured to generate a structured query statement for unloading data in the source data table to the target data table according to the basic information and the table information of the source data table, and using the configuration information; A transmission unit is configured to execute the structured query statement to obtain a query result, convert data in the query result into a standard data format required by the target data table according to the dimensions of the target data table, and write the data into a data file in a first format to obtain a standard data file, write file information of the standard data file into a check file in a second format according to the dimensions of the target data table, wherein a database name in the file information is represented by a database type to which the target data table belongs, the check file is used for a request of the data demander to check whether the received standard data file has data loss or error, and is used for the data demander to check whether a database type corresponding to the received standard data file is consistent with the database type to which the target data table belongs, write field information contained in the target data table into an instruction file in a third format according to the dimensions of the target data table, and group the standard data file, the check file and the instruction file into a to-be-transmitted file of the target data table and transmit the to-be-transmitted file to the data demander.
8. A number unloading system characterized by, Comprise: A plurality of databases corresponding to a plurality of database types; An unloading tool is configured to access the databases and execute the method according to any one of claims 1-6.
9. An apparatus for database unloading, the apparatus comprising: Comprise: At least one processor, and A memory connected with the at least one processor; Wherein the memory stores instructions executable by the at least one processor, and the at least one processor executes the method according to any one of claims 1-6 by executing the instructions stored in the memory.
10. A readable storage medium, characterized by, Comprise a memory, The memory is used to store instructions, when the instructions are executed by a processor, so that the device comprising the readable storage medium completes the method according to any one of claims 1-6.
11. A computer program product, characterised in that, Contain computer executable instructions, the computer executable instructions are used for making computer execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Database migration evaluation method and device, storage medium and computer equipment
CN111258989A