CN117807167A - Database table copying method, apparatus, electronic device and computer readable medium - Google Patents

Database table copying method, apparatus, electronic device and computer readable medium Download PDF

Info

Publication number
CN117807167A
CN117807167A CN202410008303.1A CN202410008303A CN117807167A CN 117807167 A CN117807167 A CN 117807167A CN 202410008303 A CN202410008303 A CN 202410008303A CN 117807167 A CN117807167 A CN 117807167A
Authority
CN
China
Prior art keywords
database table
data
copy
information set
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410008303.1A
Other languages
Chinese (zh)
Inventor
韩显强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Duodian Life Wuhan Technology Co ltd
Original Assignee
Duodian Life Wuhan 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 Duodian Life Wuhan Technology Co ltd filed Critical Duodian Life Wuhan Technology Co ltd
Priority to CN202410008303.1A priority Critical patent/CN117807167A/en
Publication of CN117807167A publication Critical patent/CN117807167A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the present disclosure disclose database table copying methods, apparatuses, electronic devices, and computer-readable media. One embodiment of the method comprises the following steps: acquiring a database table characteristic information set and a database table relation information set; generating at least one weighted directed graph according to the database table relation information set; generating a data table name sequence according to at least one weighted directed graph; in response to receiving the copy service information, determining a copy mapping information set according to the copy service information; and copying the target database table based on the copy mapping information set and the database table characteristic information set. This embodiment reduces the time to maintain database tables.

Description

Database table copying method, apparatus, electronic device and computer readable medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a database table copying method, apparatus, electronic device, and computer readable medium.
Background
As the software system management scene becomes more and more complex, the interdependence relationship between database tables becomes more and more complex, and how to quickly configure a new access database becomes an important research topic when accessing the new database. Currently, when configuring a new database, the following methods are generally adopted: all data of an existing database table is copied to a new database using database table mirroring.
However, when a new database is configured in the above manner, there are often the following technical problems:
first, when the existing database table is copied, when the fields or data in the database table are changed, the original database table needs to be searched according to the copying path, and all relevant fields or data in the database table need to be modified through the dependency relationship of the original database table, so that the database table needs to be maintained for a long time.
Second, when copying the data rows of the database table, a corresponding mapping is configured for each data row, which results in a need of storing a large amount of space for the dependency relationships, resulting in a waste of storage resources, and a large amount of codes are configured for each table to implement the copy logic of the database table, further resulting in a waste of storage resources.
Thirdly, whether the data which is copied into the database table and is normally operated is stored is not considered, so that after the data is copied, the original data is lost, and the database table cannot be normally operated.
The above information disclosed in this background section is only for enhancement of understanding of the background of the inventive concept and, therefore, may contain information that does not form the prior art that is already known to those of ordinary skill in the art in this country.
Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose database table copying methods, apparatus, electronic devices, and computer readable media to solve one or more of the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a database table copying method, the method comprising: acquiring a database table characteristic information set and a database table relation information set, wherein the database table relation information in the database table relation information set comprises a table name and a dependency table name; generating at least one weighted directed graph according to the database table relation information set; generating a data table name sequence according to the at least one weighted directed graph; in response to receiving the copy service information, determining a copy mapping information set according to the copy service information; and copying the target database table based on the copy mapping information set and the database table characteristic information set, wherein the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
In a second aspect, some embodiments of the present disclosure provide a database table copying apparatus, the apparatus comprising: an obtaining unit configured to obtain a database table feature information set and a database table relation information set, wherein the database table relation information in the database table relation information set includes a table name and a dependency table name; a first generation unit configured to generate at least one weighted directed graph according to the database table relation information set; a second generation unit configured to generate a data table name sequence according to the at least one weighted directed graph; a determining unit configured to determine a copy mapping information set based on the copy service information in response to receiving the copy service information; and a copying unit configured to copy a target database table based on the copy mapping information set and the database table feature information set, wherein the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors causes the one or more processors to implement the method described in any of the implementations of the first aspect above.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
The above embodiments of the present disclosure have the following advantages: by the database table copying method of some embodiments of the present disclosure, the time to maintain database tables is reduced. Specifically, the reason why it takes a long time to maintain the database table is that: when the existing database table is copied, the original database table is required to be searched according to the copying path when the fields or the data in the database table are changed, and all relevant fields or data in the database table are required to be modified through the dependency relationship of the original database table, so that the database table needs to be maintained for a long time. Based on this, the database table copying method of some embodiments of the present disclosure first obtains a database table feature information set and a database table relation information set. Thus, the characteristic information and the dependency relationship of the original database table can be determined. And secondly, generating at least one weighted directed graph according to the database table relation information set. Thus, the direct relation of different original database tables can be intuitively expressed in the form of a graph. And then, generating a data table name sequence according to the at least one weighted directed graph. Thus, the order of copying the database tables can be determined, and the lack of data of the dependent database tables during copying is avoided. And then, in response to receiving the copy service information, determining a copy mapping information set according to the copy service information. Thus, the database table of the original database table copy can be determined. And finally, copying the target database table based on the copy mapping information set and the database table characteristic information set. Therefore, the original database table is copied, a new database can be generated by determining the copying sequence and the copying mapping relation, and the fields or the data in the dependent tables are only changed after the copied database table is changed, so that the original database table is not required to be searched again, and the time for maintaining the database table is reduced.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow chart of some embodiments of a database table copy method according to the present disclosure;
FIG. 2 is a schematic diagram of the architecture of some embodiments of a database table copying apparatus according to the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
FIG. 1 illustrates a flow 100 of some embodiments of a database table copy method according to the present disclosure. The database table copying method comprises the following steps:
And step 101, acquiring a database table characteristic information set and a database table relation information set.
In some embodiments, an executing body (e.g., server) of the database table copy method may obtain the database table feature information set and the database table relationship information set. Wherein, the database table relation information in the database table relation information set comprises table names and dependency table names. The database table feature information in the database table feature information set may be feature information of a certain data table stored in advance. The database table characteristic information may include, but is not limited to: table name, data source, unique description, filter expression, and skip information. The table name may be a table name of a database table. The data source may be a data source of data in a data table. For example, the data source may be DataBase (DB) 1 or DataBase 2. The unique description may be fingerprint information for uniquely representing data of a certain row in the database table. The above-described filtering expression may be a filtering condition of data in a copy database table set in advance. The skip information may be information indicating whether to skip when copying data, which is preset. For example, the above-described skip information may be "0" and "1", where "0" means not to skip and "1" means to skip. The database table relation information in the database table relation information set may be a relation between a dependency table and a depended table stored in advance. The database table relationship information may include, but is not limited to: table name, dependency table name and dependency field.
And 102, generating at least one weighted directed graph according to the database table relation information set.
In some embodiments, the executing entity may generate at least one weighted directed graph according to the database table relationship information set. Wherein, the weighted directed graph in the at least one weighted directed graph may be a weighted directed path graph.
In practice, at least one weighted directed graph may be generated by:
first, at least one dependency table name is selected from the dependency table names included in the database table relation information set as an initial node, so as to generate an initial node group. In practice, for each of the respective dependency table names, the dependency table name may be regarded as an initial node in response to the absence of the dependency table name from the respective table names included in the database table relation information set.
And secondly, assigning an initial weight to each initial node in the initial node group. The initial weight may be a preset weight. For example, the initial weight may be 0.
Third, based on the initial node in the initial node group and the database table relation information set, executing the following processing steps:
And a first processing step of selecting at least one database table relation information corresponding to the initial node from the database table relation information set as a target relation information set. The at least one database table relation information corresponding to the initial node may be at least one database table relation information including a dependency table name of the initial node.
And a second processing step of determining, for each target relationship information in the target relationship information group, a table name included in the target relationship information as a dependent node.
And a third processing step of performing assignment processing on each of the determined dependent nodes according to the initial weight. In practice, for each of the above-mentioned individual dependent nodes, a value is assigned to the above-mentioned dependent node, where the assigned value is the sum of the initial weight and 1.
And a fourth processing step of generating a weighted directed graph according to the initial node and each determined dependent node in response to the determined absence of the dependent node. Wherein each of the dependent nodes in the weighted directed graph points to an initial node. Here, in response to the determined existence of a node depending on a certain dependent node among the respective dependent nodes, the above-described processing steps are executed again with the dependent node as an initial node, the node depending on the above-described dependent node as a dependent node, and the weight of the dependent node as an initial weight.
And 103, generating a data table name sequence according to at least one weighted directed graph.
In some embodiments, the execution body may generate a data table name sequence according to the at least one weighted directed graph.
In practice, the data table name sequence may be generated by:
the first step, node weights of all nodes included in each weighted directed graph in the at least one weighted directed graph are extracted to generate a node weight group, and a node weight group set is obtained.
And step two, sequencing all the node weights included in the node weight group set to generate a node weight sequence.
And thirdly, ordering all the nodes included in the at least one weighted directed graph according to the positions of the corresponding node weights in the node weight sequence so as to generate a data table name sequence. Here, in response to nodes having the same node weight, the initial letters of table names corresponding to the nodes having the same node weight are sorted in alphabetical order.
And 104, in response to receiving the copy service information, determining a copy mapping information set according to the copy service information.
In some embodiments, the executing entity may determine the set of copy mapping information based on the copy service information in response to receiving the copy service information. The copy service information may be main body information transmitted from a terminal associated with the executing main body, and the service copy information includes template service copy information and target service copy information. The template service copy information may be service copy information of a copied original database table. The target service copy information may be service copy information of a database table to be copied. In practice, in response to receiving the copy service information, the template service copy information included in the service copy information may be formatted into a database language characterizing the service condition information, e.g., the database language may be an SQL statement. And establishing a mapping relation of field IDs of the business attributes of the database table and the target data table as a copy mapping information set. Here, the creation time and creator information required for the target data table may also be cached.
And 105, copying the target database table based on the copy mapping information set and the database table characteristic information set.
In some embodiments, the executing entity may perform the copying process on the target database table based on the copy mapping information set and the database table feature information set. The target database table may be a database table corresponding to a target data table name selected from the data table name sequence.
In practice, the execution subject may copy the target database table by:
first, for each data table name in the sequence of data table names, the following copying step is performed:
and a first copying step, namely selecting the database table characteristic information corresponding to the data table name from the database table characteristic information set as target characteristic information. The database table characteristic information corresponding to the data table name may be database table characteristic information including the same table name as the data table name.
And a second copying step, namely acquiring field metadata according to the data source included in the target characteristic information. In practice, at least one field metadata may be obtained from the database characterized by the data sources as a field metadata set.
And a third copying step, according to the field metadata, generating a data extraction condition set. In practice, the above field metadata may be converted to generate a field range of the database statement, and the above template service copy information, the filtering expression of the original data table, and the preset constant condition may be combined to generate the data extraction condition set. The filtering expression of the original data table may be a filtering expression included in the database table feature information corresponding to the original data table. The preset constant condition may be a generated SQL filtering condition through a common field detected by the field range. The common fields may be common fields in a database table. For example, the common field may be a logical delete field.
And a fourth copying step, according to the data extraction condition set, generating a data field set, and mapping the data field set into a target data table. The target data table may be a data table determined according to the copy mapping information set. The target data table may be a data table that needs to be copied.
In practice, the above set of data fields may be mapped into the target data table by:
A first selection step of selecting copy mapping information corresponding to the data table names from the copy mapping information set as target mapping information, and determining a data table corresponding to a data table name other than the data table names in the target mapping information as a target data table. The copy mapping information corresponding to the data table name may be copy mapping information including the data table name.
And a second selection step, obtaining characteristic information of the target data table. Wherein, the target data table characteristic information may include skip information.
And a third selecting step, namely generating a target table data extraction condition set according to the target data table characteristic information. In practice, the target service table copy information, the filtering expression included in the target data table feature information, and the preset constant condition may be combined to generate a target table data extraction condition set.
And a fourth selection step, namely carrying out data extraction processing on the target data table according to the target table data extraction condition set so as to generate an extraction result. Here, in response to no data in the target data table, the extraction result may be information characterizing no data in the target data table. In response to the presence of data in the target data table, the extraction result may be respective target data fields included in the target data table.
A fifth selecting step of performing, for each data field in the set of data fields, the following mapping step:
a first mapping step of determining whether the data field is in the target data table.
In practice, it may be determined whether the data field is in the target data table by the following determination steps:
the first determining step, obtaining a dependency table mapping relation map and a depended table mapping relation map. The dependency table mapping relationship map may be used to characterize a data row ID in a dependency table and a corresponding data row ID in a target data table. The dependent table mapping relationship map may be used to characterize the data row ID in the dependent table and the corresponding data row ID in the target data table.
And a second determining step of determining that the data field is in the target data table in response to the dependency table mapping relationship map or the dependent table mapping relationship map having a mapping relationship corresponding to the data field.
Alternatively, the dependency table map and the relied table map may be generated by the following sub-steps:
the first substep, initializing a dependency table mapping relationship map and a depended table mapping relationship map.
And a second sub-step of selecting at least one database table relation information corresponding to the data table name from the database table relation information set as a target table relation information set for the data table name in the data table name sequence.
And a third sub-step, for the target table relation information in the target table relation information set, responding to the database table corresponding to the data table name as the depended table, and adding the association relation of the data row in the database table corresponding to the data table name and the corresponding data row in the target data table into the depended table mapping relation map so as to update the depended table mapping relation map.
And a fourth sub-step of adding, for the target table relation information in the target table relation information set, the data row in the database table, the data row corresponding to the data row in the database table in the relied on depended table and the data row corresponding to the target data table to the dependency table mapping relation map in response to the database table corresponding to the data table name as the dependency table, so as to update the dependency table mapping relation map.
And a fifth sub-step of determining the updated dependent table mapping relation map and the updated dependent table mapping relation map as a dependent table mapping relation map and a dependent table mapping relation map, respectively.
And a sixth sub-step of storing the dependent table mapping relation map and the dependent table mapping relation map into a target database. The target database may be a database for storing a dependent table mapping relationship map and a dependent table mapping relationship map.
The related content in the first determining step-the sixth substep is taken as an invention point of the present disclosure, which solves the second technical problem mentioned in the background art, namely when copying the data rows of the database table, configuring a corresponding mapping for each data row, which results in a need of storing a large amount of space for the dependency relationships, resulting in a waste of storage resources, and configuring a large amount of codes for each table to implement replication logic of the data table, which further results in a waste of storage resources. Factors that cause waste of storage resources are often as follows: when copying data rows of the database table, a corresponding mapping is configured for each data row, so that a large amount of space is required to store the dependency relationships, storage resources are wasted, and a large amount of codes are required to be configured for each table to realize the copy logic of the data table, and further, the storage resources are wasted. If the above factors are solved, the effect of reducing the waste of storage resources can be achieved. To achieve the effect, some embodiments of the present disclosure store association relations of different data rows through two maps by setting a dependent table and a relation map of the dependent table, so that each mapping relation can be prevented from being stored, and a code of a corresponding replication logic is prevented from being configured for each table, thereby reducing waste of storage resources.
And a second mapping step of mapping the data field to the target data table in response to the absence of the data field in the target data table.
In practice, the data fields may be mapped into the target data table by the following sub-steps:
a first sub-step of selecting a mapping relation corresponding to the data field from the dependent table mapping relation map or the dependent table mapping relation map, and mapping and replacing a field name (data row ID) of the data field according to the sum relation.
And a second sub-step of replacing the creation time and the creator information of the mapped data field.
And a third sub-step, updating the dependency table mapping relation map according to the field names after mapping replacement.
And a fourth sub-step of converting the data included in the data field to generate converted data, and storing the converted data in a target data table. The conversion process may be to convert data into a preset format adapted to the target data table.
And a third mapping step of mapping the data field to a target data table in response to the presence of the data field in the target data table and in response to the skip information included in the target data table characteristic information indicating that the target data table is not skipped.
Optionally, after the third mapping step, in response to the presence of the data field in the target data table, and in response to the skip information characterizing the skipping of the target data table, the mapping of the data field into the target data table is inhibited.
The first selecting step, the third mapping step and optionally related content in the foregoing steps are taken as an invention point of the disclosure, so that the third technical problem mentioned in the background art is solved, that whether the database table into which the data is copied has the data which is normally operated is not considered, so that after the data is copied, the original data is lost, and the database table cannot normally operate. The factors that cause the original data loss and the database table cannot normally run are often as follows: whether the data which is copied into the database table and is normally operated is stored is not considered, so that after the data is copied, the original data is lost, and the database table cannot be normally operated. If the above factors are solved, the effect of reducing the time to copy the database tables can be achieved. To achieve this, first, copy map information corresponding to the data table name is selected from the copy map information set as target map information, and a data table corresponding to a data table name other than the data table name in the target map information is determined as a target data table. Thus, a database table that needs to copy data can be determined. Second, the characteristic information of the target data table is obtained. Thus, the characteristic information of the database table can be determined. Thirdly, generating a target table data extraction condition set according to the target data table characteristic information; and carrying out data extraction processing on the target data table according to the target table data extraction condition set so as to generate an extraction result. Thereby, data in the database table can be extracted. Fourth, for each data field in the set of data fields, the following mapping step is performed: determining whether said data field is in said target data table; and mapping the data field into the target data table in response to the target data table not having the data field. Thus, in response to the database table having no corresponding data field, the data may be copied into the database table. Fifth, in response to the presence of the data field in the target data table, and in response to the skip information included in the target data table characteristic information indicating that the target data table is not skipped, mapping the data field into a target data table; and disabling mapping of the data field into the target data table in response to the data field being present in the target data table and in response to the skip information characterizing skipping the target data table. Therefore, in response to the fact that the data corresponding to the data fields exist in the database table, the data in the database table is not replaced, so that the original data can be prevented from being lost, and the situation that the database table cannot normally operate is avoided.
Optionally, after step 105, the following steps are further included:
in a first step, copy abnormality information is recorded in response to detecting a copy abnormality.
In some embodiments, the executing entity may record copy exception information in response to detecting a copy exception. Wherein, the copy exception may be a copy process pause. The copy abnormality information described above may characterize the cause of suspension of the copy process.
And secondly, carrying out semantic recognition processing on the copy abnormality information to generate copy abnormality type information.
In some embodiments, the execution body may perform semantic recognition processing on the copy exception information to generate copy exception type information. The semantic recognition processing may be performed by a pre-trained large language model. The copy abnormality type information may characterize the type of the copy abnormality information. For example, the copy exception information may be missing dependent configuration data.
And thirdly, acquiring execution information corresponding to the copy abnormality type information.
In some embodiments, the execution body may acquire execution information corresponding to the copy abnormality type information. The execution information may be information set in advance for solving the copy abnormality type information.
As an example, in response to the copy exception information being missing dependent configuration data, the execution body may obtain a default dependent configuration data value.
And fourth, according to the execution information, performing copy skipping processing, and sending the copy abnormality information to a target terminal for display.
In some embodiments, the executing body may perform a copy skip process according to the executing information, and send the copy abnormality information to the target terminal for display. The target terminal may be a terminal having authority to receive copy abnormal information.
As an example, the copying process may be continued by the acquired default dependent configuration data value and the recorded copy exception information may be transmitted to the target terminal for data maintenance.
The above embodiments of the present disclosure have the following advantages: by the database table copying method of some embodiments of the present disclosure, the time to maintain database tables is reduced. Specifically, the reason why it takes a long time to maintain the database table is that: when the existing database table is copied, the original database table is required to be searched according to the copying path when the fields or the data in the database table are changed, and all relevant fields or data in the database table are required to be modified through the dependency relationship of the original database table, so that the database table needs to be maintained for a long time. Based on this, the database table copying method of some embodiments of the present disclosure first obtains a database table feature information set and a database table relation information set. Thus, the characteristic information and the dependency relationship of the original database table can be determined. And secondly, generating at least one weighted directed graph according to the database table relation information set. Thus, the direct relation of different original database tables can be intuitively expressed in the form of a graph. And then, generating a data table name sequence according to the at least one weighted directed graph. Thus, the order of copying the database tables can be determined, and the lack of data of the dependent database tables during copying is avoided. And then, in response to receiving the copy service information, determining a copy mapping information set according to the copy service information. Thus, the database table of the original database table copy can be determined. And finally, copying the target database table based on the copy mapping information set and the database table characteristic information set. Therefore, the original database table is copied, a new database can be generated by determining the copying sequence and the copying mapping relation, and the fields or the data in the dependent tables are only changed after the copied database table is changed, so that the original database table is not required to be searched again, and the time for maintaining the database table is reduced.
With further reference to fig. 2, as an implementation of the method shown in the above figures, the present disclosure provides some embodiments of a database table copying apparatus, which correspond to those method embodiments shown in fig. 1, and which are particularly applicable in various electronic devices.
As shown in fig. 2, the database table copying apparatus 200 of some embodiments includes: an acquisition unit 201, a first generation unit 202, a second generation unit 203, a determination unit 204, and a copy unit 205. Wherein the obtaining unit 201 is configured to obtain a database table feature information set and a database table relation information set, wherein the database table relation information in the database table relation information set includes a table name and a dependency table name; the first generating unit 202 is configured to generate at least one weighted directed graph according to the database table relation information set; the second generating unit 203 is configured to generate a data table name sequence according to the at least one weighted directed graph; the determining unit 204 is configured to determine a copy mapping information set based on the copy service information in response to receiving the copy service information; the copying unit 205 is configured to copy the target database table based on the copy mapping information set and the database table feature information set, where the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
It will be appreciated that the elements described in database table copying apparatus 200 correspond to the various steps in the method described with reference to fig. 1. Thus, the operations, features and advantages described above with respect to the method are equally applicable to the database table copying apparatus 200 and the units contained therein, and are not described herein.
Referring now to fig. 3, a schematic diagram of an electronic device 300 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic devices in some embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, as well as stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 3 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 3, the electronic device 300 may include a processing means 301 (e.g., a central processing unit, a graphics processor, etc.) that may perform various suitable actions and processes in accordance with a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. While fig. 3 shows an electronic device 300 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 3 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications device 309, or from storage device 308, or from ROM 302. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that, the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: and acquiring a database table characteristic information set and a database table relation information set, wherein the database table relation information in the database table relation information set comprises a table name and a dependency table name. And generating at least one weighted directed graph according to the database table relation information set. And generating a data table name sequence according to the at least one weighted directed graph. And in response to receiving the copy service information, determining a copy mapping information set according to the copy service information. And copying the target database table based on the copy mapping information set and the database table characteristic information set, wherein the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes an acquisition unit, a first generation unit, a second generation unit, a determination unit, and a copy unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the acquisition unit may also be described as "a unit that acquires a database table feature information set and a database table relation information set".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (8)

1. A database table copying method, comprising:
acquiring a database table characteristic information set and a database table relation information set, wherein the database table relation information in the database table relation information set comprises a table name and a dependency table name;
generating at least one weighted directed graph according to the database table relation information set;
generating a data table name sequence according to the at least one weighted directed graph;
in response to receiving the copy service information, determining a copy mapping information set according to the copy service information;
and copying the target database table based on the copy mapping information set and the database table characteristic information set, wherein the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
2. The method of claim 1, wherein the generating at least one weighted directed graph from the database table relationship information set comprises:
selecting at least one dependency table name from each dependency table name included in the database table relation information set as an initial node to generate an initial node group;
for each initial node in an initial node group, assigning an initial weight to the initial node;
Based on the initial nodes in the initial node group and the database table relation information set, the following processing steps are executed:
at least one database table relation information corresponding to the initial node is selected from the database table relation information set to serve as a target relation information set;
for each target relation information in the target relation information group, determining a table name included in the target relation information as a dependent node;
for each determined dependent node in the dependent nodes, carrying out assignment processing on the dependent node according to the initial weight;
and generating a weighted directed graph according to the initial node and each determined dependent node in response to the determined absence of the dependent node.
3. The method of claim 1, wherein the generating a sequence of data table names from the at least one weighted directed graph comprises:
extracting node weights of all nodes included in each weighted directed graph in the at least one weighted directed graph to generate a node weight group, and obtaining a node weight group set;
sorting all node weights included in the node weight group set to generate a node weight sequence;
And ordering all the nodes included in the at least one weighted directed graph according to the positions of the corresponding node weights in the node weight sequence so as to generate a data table name sequence.
4. The method of claim 1, wherein the database table characteristic information in the database table characteristic information set includes table names and data sources; and
the copying processing of the target database table based on the copying mapping information set and the database table characteristic information set comprises the following steps:
for each data table name in the sequence of data table names, performing the following copying step:
selecting database table characteristic information corresponding to the data table name from the database table characteristic information set as target characteristic information;
acquiring field metadata according to a data source included in the target characteristic information;
generating a data extraction condition set according to the field metadata;
and generating a data field set according to the data extraction condition set, and mapping the data field set into a target data table, wherein the target data table is a data table determined according to the copy mapping information set.
5. The method of claim 1, wherein the method further comprises:
Recording copy abnormality information in response to detecting the copy abnormality;
carrying out semantic recognition processing on the copy abnormality information to generate copy abnormality type information;
acquiring execution information corresponding to the copy abnormality type information;
and according to the execution information, performing copy skipping processing, and sending the copy abnormality information to a target terminal for display.
6. A database table copying apparatus comprising:
an acquisition unit configured to acquire a database table feature information set and a database table relation information set, wherein database table relation information in the database table relation information set includes a table name and a dependency table name;
a first generation unit configured to generate at least one weighted directed graph according to the database table relation information set;
a second generating unit configured to generate a data table name sequence according to the at least one weighted directed graph;
a determining unit configured to determine a copy mapping information set according to copy service information in response to receiving the copy service information;
and the copying unit is configured to copy a target database table based on the copy mapping information set and the database table characteristic information set, wherein the target database table is a database table corresponding to a target data table name selected from the data table name sequence.
7. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1 to 5.
8. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1 to 5.
CN202410008303.1A 2024-01-03 2024-01-03 Database table copying method, apparatus, electronic device and computer readable medium Pending CN117807167A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410008303.1A CN117807167A (en) 2024-01-03 2024-01-03 Database table copying method, apparatus, electronic device and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410008303.1A CN117807167A (en) 2024-01-03 2024-01-03 Database table copying method, apparatus, electronic device and computer readable medium

Publications (1)

Publication Number Publication Date
CN117807167A true CN117807167A (en) 2024-04-02

Family

ID=90434576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410008303.1A Pending CN117807167A (en) 2024-01-03 2024-01-03 Database table copying method, apparatus, electronic device and computer readable medium

Country Status (1)

Country Link
CN (1) CN117807167A (en)

Similar Documents

Publication Publication Date Title
CN111291103B (en) Interface data analysis method and device, electronic equipment and storage medium
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
CN115757400B (en) Data table processing method, device, electronic equipment and computer readable medium
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
CN114327493A (en) Data processing method and device, electronic equipment and computer readable medium
CN116433388B (en) Data storage resource partitioning method, device, electronic equipment and computer medium
CN112035256A (en) Resource allocation method, device, electronic equipment and medium
CN111625232B (en) Method and device for generating application program installation package, readable medium and electronic equipment
CN117807167A (en) Database table copying method, apparatus, electronic device and computer readable medium
CN115017149A (en) Data processing method and device, electronic equipment and storage medium
CN113918659A (en) Data operation method and device, storage medium and electronic equipment
CN113807056A (en) Method, device and equipment for correcting error of document name sequence number
CN112115154A (en) Data processing and data query method, device, equipment and computer readable medium
CN113742321A (en) Data updating method and device
CN111240657A (en) Method and device for generating SDK and electronic equipment
CN111787043A (en) Data request method and device
CN111008178A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN116467178B (en) Database detection method, apparatus, electronic device and computer readable medium
CN116820354B (en) Data storage method, data storage device and data storage system
CN117850956B (en) Application package data processing method, device, electronic equipment and computer readable medium
CN116483808B (en) Data migration method, device, electronic equipment and computer readable medium
CN115422131B (en) Business audit knowledge base retrieval method, device, equipment and computer readable medium
CN114428823B (en) Data linkage method, device, equipment and medium based on multidimensional variable expression
CN117692672B (en) Snapshot-based video information sending method and device, electronic equipment and medium

Legal Events

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