Data management method and device of database, storage medium and electronic equipment

CN117520336BActive Publication Date: 2026-09-18INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311016324.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-11
Publication Date
2026-09-18
Estimated Expiration
2043-08-11

AI Technical Summary

Technical Problem

[0005]本申请提供了一种数据库的数据管理方法、装置、存储介质及电子设备,以至少解决现有技术在对不同的类型的数据库进行数据管理时需要打开不同的图形界面工具所存在的数据库的数据管理效率较低的技术问题

Benefits of technology

[0018] In this application, a database operation instruction is first received, wherein the database operation instruction carries a unique identifier for a target database, which is any one of M databases, where M is a positive integer; then, a target branch code is determined from the M branch codes based on the unique identifier, wherein each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database; finally, data management of the target database is performed by running the target branch code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520336B_ABST
    Figure CN117520336B_ABST
Patent Text Reader

Abstract

The application discloses a database data management method and device, a storage medium and an electronic equipment. It relates to the technical field of financial technology or other related fields. The method comprises the following steps: receiving a database operation instruction, wherein the database operation instruction carries unique identification information of a target database, the target database is any one of M databases, M is a positive integer; determining a target branch code from M branch codes based on the unique identification information, wherein each branch code in the M branch codes has a one-to-one correspondence with one database in the M databases, and the target branch code is a code created according to a drive package of the target database; and performing data management on the target database by running the target branch code. The application solves the technical problem of low database data management efficiency caused by the need to open different graphical interface tools when different types of databases are managed in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology or other related fields, and more specifically, to a database data management method, apparatus, storage medium, and electronic device. Background Technology

[0002] Databases are categorized into relational (supporting SQL) and non-relational (NoSQL) databases. Relational databases include Oracle and MySQL, while non-relational databases include in-memory databases (Redis) and document databases (Mongo). Currently, there are corresponding graphical tools available for each database type. For example, there are graphical tools like PL / SQL or Toad for Oracle; Workbench or Navicat for MySQL; Management Studio for SQL Server; RedisDesktop for Redis; and PgAdmin for PostgreSQL, among others.

[0003] In existing technologies, when business personnel manage data from multiple databases involved in the same project, they not only need to download the corresponding graphical interface tools, but also need to open different graphical interface tools and switch back and forth between different graphical interface tools to manage the data in order to achieve data management, resulting in low data management efficiency.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a database data management method, apparatus, storage medium, and electronic device to at least solve the technical problem of low data management efficiency in existing technologies that require opening different graphical interface tools when managing different types of databases.

[0006] According to one aspect of this application, a data management method for a database is provided, comprising: receiving a database operation instruction, wherein the database operation instruction carries unique identification information of a target database, the target database being any one of M databases, where M is a positive integer; determining a target branch code from M branch codes based on the unique identification information, wherein each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on a driver package of the target database; and managing the target database by running the target branch code.

[0007] Furthermore, before receiving database operation instructions, the method further includes: obtaining the driver package for each of the M databases to obtain M driver packages; and creating branch code based on each driver package and a preset SQL statement to obtain the M branch codes.

[0008] Furthermore, managing the target database by running the target branch code includes: obtaining a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; establishing a connection with the target database based on the target IP address and the target port number; obtaining target data from the target database by running the target branch code and displaying the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database; and managing the target database based on the target data.

[0009] Further, the data management of the target database based on the target data includes: responding to a data query instruction by querying the first data in the target data table from the target database by running the target branch code, wherein the data query instruction carries the name of the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; and displaying the first data in the target data table in the graphical interface based on a preset pagination SQL statement, wherein the preset pagination SQL statement is used to perform pagination processing on the first data in the target data table.

[0010] Further, the data management of the target database based on the target data includes: in response to a data migration instruction, obtaining a second configuration file, wherein the data migration instruction is used to instruct the migration of data from a target sub-database to a first sub-database, the target sub-database being a sub-database within the target database, the first sub-database being a sub-database within a first database, the first database being a database other than the target database among the M databases, and the second configuration file including at least the IP address of the host running the first database and the port number of the first database; establishing a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and migrating the data from the target sub-database to the first sub-database within the first database by running the target branch code.

[0011] Further, migrating data from the target sub-database to the first sub-database of the first database by running the target branch code includes: obtaining second data from the target sub-database by running the target branch code, wherein the second data includes at least the name of each data table in the target sub-database; creating a first data table in the first sub-database corresponding to each data table in the target sub-database based on a preset DDL statement and the second data; and migrating the data in each data table to the first data table corresponding to that data table in the first sub-database.

[0012] Furthermore, the data management of the target database based on the target data includes: in response to a data addition instruction, detecting whether a primary key of third data exists in the target data table, wherein the data addition instruction is used to add the third data to the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; if the primary key of the third data does not exist in the target data table, adding the third data to the target data table by running the target branch code.

[0013] Furthermore, after detecting whether a primary key of the third data exists in the target data table, the method further includes: if a primary key of the third data exists in the target data table, prohibiting the addition of the third data to the target data table, and performing a data query operation to display the third data in the graphical interface, wherein the data query operation is used to query the third data from the target data table; in response to a data modification instruction, obtaining a target key value in the graphical interface, wherein the target key value is a key value obtained after modifying the key value of the third data; and updating the key value of the third data to the target key value by running the target branch code.

[0014] Furthermore, the data management of the target database based on the target data includes: in response to a data deletion instruction, deleting the fourth data from the target data table by running the target branch code, wherein the fourth data is the data to be deleted, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database.

[0015] According to another aspect of this application, a database data management device is also provided, comprising: a receiving module for receiving a database operation instruction, wherein the database operation instruction carries unique identification information of a target database, the target database being any one of M databases, where M is a positive integer; a determining module for determining a target branch code from M branch codes based on the unique identification information, wherein each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on a driver package of the target database; and a data management module for managing the target database by running the target branch code.

[0016] According to another aspect of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the above-described database data management method at runtime.

[0017] According to another aspect of this application, an electronic device is also provided, the electronic device including one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to run the programs, wherein the programs are configured to execute the above-described database data management method during runtime.

[0018] In this application, a database operation instruction is first received, wherein the database operation instruction carries a unique identifier for a target database, which is any one of M databases, where M is a positive integer; then, a target branch code is determined from the M branch codes based on the unique identifier, wherein each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database; finally, data management of the target database is performed by running the target branch code.

[0019] In the above process, since the target database can be any one of the M databases, each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database. Therefore, by using the unique identifier information of the target database carried in the database operation instructions to determine the target branch code from the M branch codes, and by running the target branch code to manage the target database, data management of the database can be achieved without opening different graphical interface tools or switching back and forth between them. This reduces the operation time of graphical interface tools, thereby improving the technical effect of improving the data management efficiency of the database. This solves the technical problem of low data management efficiency in existing technologies that require opening different graphical interface tools when managing different types of databases. Attached Figure Description

[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0021] Figure 1 This is a flowchart of an optional database data management method according to an embodiment of this application;

[0022] Figure 2 This is a schematic diagram of a graphical interface for an optional relational database according to an embodiment of this application;

[0023] Figure 3 This is a schematic diagram of a graphical interface for another optional relational database according to an embodiment of this application;

[0024] Figure 4 This is a schematic diagram of an optional non-relational database graphical interface according to an embodiment of this application;

[0025] Figure 5 This is a schematic diagram of an optional database data management device according to an embodiment of this application;

[0026] Figure 6 This is a schematic diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0029] It should be noted that the data management method, apparatus, storage medium and electronic device of the database in this application can be used in the field of financial technology, as well as in other fields other than financial technology. The application fields of the data management method, apparatus, storage medium and electronic device of the database in this application are not limited.

[0030] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0031] Example 1

[0032] According to an embodiment of this application, an optional database data management method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0033] Figure 1 This is a flowchart of an optional database data management method according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0034] Step S101: Receive database operation instructions.

[0035] In one optional embodiment, a database data management system can serve as the execution entity for the database data management method in this application embodiment. For ease of description, the database data management system will be referred to as the system below.

[0036] In step S101, the database operation instruction carries the unique identifier information of the target database. The target database is any one of the M databases, where M is a positive integer.

[0037] The above M databases include, but are not limited to, Figure 2 The databases shown include MySQL, Oracle, SQL Server, Access, PostgreSQL, Db2 (IBM DB2), SQLite, Redis, and Memcached. Among these, MySQL, Oracle, SQL Server, Access, PostgreSQL, Db2, and SQL Lite are relational databases, while Redis and Memcached are non-relational databases.

[0038] For example, such as Figure 2 As shown, when the user (i.e. the target object) selects the MySQL database (i.e. the target database) in the database type in the system's graphical interface, the system will receive the database operation command triggered by the user. The database operation command carries the unique identification information of the MySQL database.

[0039] Step S102: Determine the target branch code from the M branch codes based on the unique identifier information.

[0040] In step S102, each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is the code created based on the driver package of the target database.

[0041] In this embodiment, the system's main code consists of M branch codes, where each branch code corresponds to one of the M databases. For example, when the target database is a MySQL database, after receiving a database operation command triggered by the user, the system, in response to the command, can determine the target branch code corresponding to the target database from the M branch codes based on the unique identifier information of the MySQL database carried in the database operation command.

[0042] Step S103: Perform data management on the target database by running the target branch code.

[0043] In this embodiment, since the target branch code is created based on the driver package of the target database, the system can manage the target database by running the target branch code and calling the driver package of the target database. For example, when the target database is a MySQL database, the system manages the target database by running the branch code corresponding to the MySQL database (i.e., the target branch code) and calling the driver package mysql-connector-java.jar of the MySQL database.

[0044] Optionally, the aforementioned data management includes at least data querying, data addition, data modification, data deletion, and data migration. Specifically, data addition includes operations such as adding a database, adding a data table, and adding data to a data table; data deletion includes operations such as deleting a database, deleting a data table, and deleting data from a data table; and data modification includes operations such as renaming a database, renaming a data table, and modifying data in a data table.

[0045] Optionally, users can select Figure 2 The database and table operations shown can be performed to add a database, add a table, delete a database, delete a table, add data to a table, and delete data in a table.

[0046] Based on the scheme defined in steps S101 to S103 above, it can be understood that in this application, a database operation instruction is first received, wherein the database operation instruction carries a unique identifier of the target database, and the target database is any one of the M databases, where M is a positive integer; then, a target branch code is determined from the M branch codes based on the unique identifier, wherein each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database; finally, data management of the target database is performed by running the target branch code.

[0047] It should be noted that in the above process, since the target database is any one of the M databases, each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database. Therefore, by determining the target branch code from the M branch codes through the unique identifier information of the target database carried in the database operation instructions, and managing the target database by running the target branch code, data management of the database can be achieved without opening different graphical interface tools or switching back and forth between them. This reduces the operation time of graphical interface tools, thereby improving the technical effect of improving the data management efficiency of the database. This solves the technical problem of low data management efficiency in existing technologies that require opening different graphical interface tools when managing different types of databases.

[0048] Optionally, in the data management method of the database provided in the embodiments of this application, before receiving the database operation instruction, the method further includes: obtaining the driver package of each of the M databases to obtain M driver packages; and creating a branch code based on each driver package and a preset SQL statement to obtain M branch codes.

[0049] In this embodiment, the preset SQL statements are the SQL statements for data management settings of M databases. The preset SQL statements include SQL statements shared by all M databases, such as data management operations like creating a new database or creating a new data table; different databases correspond to the same SQL statements. The preset SQL statements also include SQL statements specific to each database, such as data management operations like renaming a data table, adding a data column to a data table, or modifying a data column in a data table; different databases correspond to different SQL statements. It is important to note that when performing data addition, deletion, and modification operations on all relational databases, the SQL statements for all relational databases have the same format, as follows:

[0050] To create a new table: insert into table_name values(field_value, field_value, etc.).

[0051] To modify a data table: update table_name set field_name = field_value.

[0052] To delete a data table: `delete from table_name where field_name = field_value`.

[0053] For example, the system obtains the driver packages for various databases, such as ojdbc.jar for Oracle, mysql-connector-java.jar for MySQL, and sqljdbc.jar for SQL Server, and creates branch code for each database in the main code based on preset SQL statements.

[0054] It should be noted that by obtaining the driver package for each of the M databases, M driver packages are obtained. Based on each driver package and a preset SQL statement, a branch code is created, resulting in M ​​branch codes. This enables data management operations compatible with multiple databases. Data management can be performed on the databases without opening different graphical interface tools or switching between them, thereby improving the efficiency of database data management.

[0055] Optionally, in the database data management method provided in this application embodiment, data management of the target database by running target branch code includes: obtaining a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; establishing a connection with the target database based on the target IP address and the target port number; obtaining target data from the target database by running target branch code and displaying the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database; and managing the target database according to the target data.

[0056] For example, the system can obtain localhost:3306 (the target IP address of the host running the MySQL database and the target port number of the MySQL database) from the first configuration file corresponding to the MySQL database (i.e., the target database), and establish a connection with the MySQL database through localhost:3306 in the first configuration file; then, the system can obtain the name of each sub-database and the name of each data table in each sub-database (i.e., the target data) from the target database by running the branch code corresponding to the MySQL database (i.e., the target branch code), and display the target data in the graphical interface. For example, the graphical interface is as follows: Figure 3The graphical interface shown includes sub-databases such as xiach1, xiach2, xiach3, and xiach4, and data tables such as Spcp_id_biz_type1, Spcp_id_biz_type2, Spcp_id_biz_type3, and Spcp_id_biz_type4 in xiach1.

[0057] It should be noted that by establishing a connection with the target database based on the target IP address of the host running the target database and the target port number of the target database, and by retrieving target data from the target database by running the target branch code, and then managing the target database based on the target data, it is possible to manage the target database by running the target branch code after establishing a connection with the target database. This eliminates the need to open different graphical interface tools or switch back and forth between different graphical interface tools, thereby reducing the operation time of graphical interface tools and improving the efficiency of database data management.

[0058] Optionally, in the data management method of the database provided in this application embodiment, data management of the target database based on target data includes: responding to a data query instruction, querying the first data in the target data table from the target database by running target branch code, wherein the data query instruction carries the name of the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; and displaying the first data in the target data table on a graphical interface based on a preset pagination SQL statement, wherein the preset pagination SQL statement is used to perform pagination processing on the first data in the target data table.

[0059] To improve database data management efficiency and avoid system lag caused by excessive data volume during data queries, in this embodiment, the system responds to data query commands by running target branch code to retrieve the first data from the target data table in the target database. Then, based on a preset pagination SQL statement, the first data is paginated and displayed in the graphical interface. For example, ... Figure 3 As shown in the diagram, the user selects the Spcp_id_biz_type1 table in the subdatabase of xiach1 in the MySQL database via the database name in the graphical interface. After clicking the search button, the system queries the data in the Spcp_id_biz_type1 table in response to the data query command. Figure 3 (The id and City_name data in the data).

[0060] Optionally, the graphical interface in this embodiment may display data table fields, such as... Figure 3The IDs shown are City_name and City_code. Users can select fields from the data table to retrieve the data corresponding to those fields.

[0061] Optionally, the default pagination SQL statement for MySQL databases can be "select * from city limit 0, 20", where limit is a SQL keyword specific to MySQL databases used for pagination. That is, the default pagination SQL statement differs for different databases.

[0062] Optionally, in the data management method of the database provided in this application embodiment, data management of the target database based on target data includes: responding to a data migration instruction to obtain a second configuration file, wherein the data migration instruction is used to instruct the migration of data in the target sub-database to the first sub-database, the target sub-database is a sub-database in the target database, the first sub-database is a sub-database in the first database, the first database is a database other than the target database in M ​​databases, and the second configuration file includes at least the IP address of the host running the first database and the port number of the first database; establishing a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and migrating the data in the target sub-database to the first sub-database in the first database by running the target branch code.

[0063] Optionally, in the database data management method provided in this application embodiment, migrating data from a target sub-database to a first sub-database in a first database by running target branch code includes: obtaining second data from the target sub-database by running target branch code, wherein the second data includes at least the name of each data table in the target sub-database; creating a first data table in the first sub-database corresponding to each data table in the target sub-database based on a preset DDL statement and the second data; and migrating the data in each data table to the first data table in the first sub-database corresponding to that data table.

[0064] In this embodiment, the system can migrate data from the target sub-database to the first sub-database in response to a data migration command. Specifically, the system obtains the IP address of the host running the first database and the port number of the first database from the second configuration file in response to the data migration command; then, the system can establish a connection with the first database based on the IP address of the host running the first database and the port number of the first database, and run the target branch code to obtain the second data in the target sub-database; then, the system can create a first data table in the first sub-database corresponding to each data table in the target sub-database based on preset DDL statements and the second data, and migrate the data in each data table to the first data table corresponding to that data table in the first sub-database.

[0065] Optionally, in addition to the name of each data table in the target sub-database, the second data also includes field information (such as field type, field length, field description, etc.) in each data table.

[0066] Optionally, the data migration operation in this embodiment supports mutual migration between different types of databases, and also supports mutual migration between sub-databases in the same type of database, wherein the above-mentioned databases are relational databases.

[0067] For example, when a user needs to migrate data from the xiach1 database (the target sub-database) in a MySQL database to the hiach4 database (the first sub-database) in an Oracle database, after the user clicks... Figure 3 After clicking the data migration button, the system can respond to the data migration instruction by obtaining the IP address of the host running the first database and the port number of the first database, localhost:1521, and establish a connection with the first database based on localhost:1521; then, the system can run the target branch code of the first database to obtain the name of each data table in the xiach1 database and the field information in each data table, and create a first data table in the hiach4 database corresponding to each data table in the xiach1 database based on the preset DDL statements and the name and field information of each data table; finally, the system can migrate the data of each data table in the xiach1 database to the first data table corresponding to each data table in the hiach4 database.

[0068] Optionally, the default DDL statements include, but are not limited to, database creation statements, table creation statements, and constraint statements.

[0069] It should be noted that by responding to data migration commands, data in the target sub-database can be directly migrated to the first sub-database without the need for data migration through graphical interface tools for different databases. This reduces data migration time and improves the efficiency of database data management.

[0070] Optionally, in this embodiment, the system's graphical interface provides SQL statement writing functionality, which users can use to... Figure 3 The SQL statement area allows you to write your SQL statements, making it suitable for writing long and complex SQL statements. It supports the Ctrl+Z undo function and allows you to place multiple SQL statements in the text box. Select one SQL statement and then click... Figure 3 The system can execute the SQL statement by clicking the "Execute" button.

[0071] Optionally, in the database data management method provided in this application embodiment, data management of the target database based on target data includes: the system can respond to a data addition instruction to detect whether there is a primary key for third data in the target data table, wherein the data addition instruction is used to add the third data to the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; if there is no primary key for third data in the target data table, the third data is added to the target data table by running the target branch code.

[0072] Optionally, in the database data management method provided in this application embodiment, after detecting whether a primary key of third data exists in the target data table, the method further includes: if a primary key of third data exists in the target data table, the system can prevent the third data from being added to the target data table and perform a data query operation to display the third data in a graphical interface, wherein the data query operation is used to query the third data from the target data table; then the system can respond to a data modification instruction to obtain the target key value in the graphical interface, wherein the target key value is the key value obtained after modifying the key value of the third data; and update the key value of the third data to the target key value by running the target branch code.

[0073] In this embodiment, the system can determine whether to add third data to the target data table by detecting whether a primary key for third data exists in the target data table; specifically, if a primary key for third data does not exist in the target data table, the third data is added to the target data table by running the target branch code. For example, a user can add the third data by clicking... Figure 3The "Add Row" button allows the system to add a blank row in the graphical interface. Users can then directly enter data (the third data) into the cell and click "Confirm Modification" or press Ctrl+Enter. The system then checks if the third data exists as a primary key in the target data table to determine whether to add it. If the third data does not exist, the system responds to the data addition command and saves the new data to the database by running branch code. When the system loads data, the first column (a hidden column) of the data list displayed in the graphical interface records the primary key value for each row. If it is a composite primary key, such as `id` and `city_name`, the system records the `id` and `city_name` values ​​of that row, connected by `@@`, and stores them in the hidden column.

[0074] Furthermore, if a primary key for third data exists in the target data table, the system can prevent the addition of third data to the target data table, perform a data query operation, display the third data in the graphical interface, and then, in response to a data modification command, retrieve the target key value from the graphical interface and update the third data's key value to the target key value by running the target branch code. For example, if a primary key for third data exists in the target data table, the system can automatically query the third data from the target data table and display it in the graphical interface. When the user modifies the data in the cell corresponding to the third data in the data list in the graphical interface, the system can record the primary key value (i.e., the target key value) corresponding to that row of data. After the user finishes modifying the data, they can click... Figure 3 In the "Confirm Modification" section, the system can respond to the data modification command by obtaining the primary key value corresponding to the row of data, and update the key value of the third data to the primary key value by running the target branch code.

[0075] Optionally, if a user modifies multiple rows of data, the system can record multiple primary key values; when the user finishes modifying, they can click... Figure 3 When you click "Confirm Modification," the system will concatenate multiple update SQL statements based on the set of primary key values ​​in the records and perform batch modifications.

[0076] Optionally, in the data management method of the database provided in the embodiments of this application, data management of the target database based on the target data includes: the system can respond to a data deletion instruction by deleting the fourth data from the target data table by running the target branch code, wherein the fourth data is the data to be deleted, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database.

[0077] For example, the system's graphical interface provides a data deletion function. Users can select one or more data items from a list, and then delete them by clicking... Figure 3 Click the "Delete Row" button in the menu, then click "Confirm Modification" or press Ctrl+Enter. The system will then respond to the data deletion command and execute the branch code to delete one or more rows of data in the database, thus enabling batch data deletion.

[0078] Optionally, in this embodiment, the system's graphical interface provides a data export function, which the user can click to export. Figure 3 The "Export" button will export the data displayed in the current list as an xls file.

[0079] Optionally, the system's graphical interface provides a function to set the primary key, which users can click. Figure 3 The "Primary Key" button allows you to set the primary key field for the current data list.

[0080] Optionally, in this embodiment, the graphical interface of the non-relational database differs from that of the relational database, such as... Figure 4 The graphical interface for the shown NoSQL database displays "Key" and "Script" text boxes below the database type. Both Redis and Memcached are key-value databases, allowing users to easily search for a specific value by key. If the "Key" text box is left blank, the system defaults to paginating and selecting the first H pages of key-value pairs. The data list displays only three columns: Key, Value, and datatype. Datatype can be String, List, Sortedlist, Hash, or Set. Memcached only supports strings.

[0081] Therefore, in the database data management method proposed in this application, since the target database is any one of the M databases, each of the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database. Thus, by determining the target branch code from the M branch codes through the unique identifier information of the target database carried in the database operation instructions, and managing the target database by running the target branch code, data management of the database can be achieved without opening different graphical interface tools or switching between them. This reduces the operation time of graphical interface tools, thereby improving the technical effect of improving the data management efficiency of the database. This solves the technical problem of low data management efficiency in existing technologies that require opening different graphical interface tools when managing different types of databases.

[0082] Example 2

[0083] According to an embodiment of this application, an embodiment of a database data management device is provided, wherein... Figure 5 This is a schematic diagram of an optional database data management device according to an embodiment of this application, such as... Figure 5 As shown, the device includes:

[0084] The receiving module 501 is used to receive database operation instructions, wherein the database operation instructions carry unique identification information of the target database, and the target database is any one of the M databases, where M is a positive integer;

[0085] The determination module 502 is used to determine the target branch code from M branch codes based on unique identification information. Each branch code in the M branch codes has a one-to-one correspondence with one of the M databases. The target branch code is the code created based on the driver package of the target database.

[0086] Data management module 503 is used to manage data in the target database by running the target branch code.

[0087] It should be noted that the receiving module 501, determining module 502, and data management module 503 mentioned above correspond to steps S101 to S103 in the above embodiment 1. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment 1.

[0088] Optionally, the database management device includes: an acquisition module, used to acquire the driver package of each of the M databases before receiving database operation instructions, to obtain M driver packages; and a creation module, used to create a branch code based on each driver package and a preset SQL statement, to obtain M branch codes.

[0089] Optionally, the data management module includes: a first acquisition unit, used to acquire a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; a first connection unit, used to establish a connection with the target database based on the target IP address and the target port number; a second acquisition unit, used to acquire target data from the target database by running target branch code and display the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database; and a data management unit, used to perform data management on the target database based on the target data.

[0090] Optionally, the data management unit includes: a first response unit, used to respond to a data query instruction by querying the first data in the target data table from the target database by running the target branch code, wherein the data query instruction carries the name of the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; and a display unit, used to display the first data in the target data table on a graphical interface based on a preset pagination SQL statement, wherein the preset pagination SQL statement is used to perform pagination processing on the first data in the target data table.

[0091] Optionally, the data management unit includes: a second response unit, configured to obtain a second configuration file in response to a data migration instruction, wherein the data migration instruction instructs the migration of data from a target sub-database to a first sub-database, the target sub-database being a sub-database within a target database, the first sub-database being a sub-database within a first database, the first database being one of the M databases excluding the target database, and the second configuration file including at least the IP address of the host running the first database and the port number of the first database; a second connection unit, configured to establish a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and a first data migration unit, configured to migrate data from the target sub-database to the first sub-database within the first database by running target branch code.

[0092] Optionally, the first data migration unit includes: a third acquisition unit, used to acquire second data in the target sub-database by running the target branch code, wherein the second data includes at least the name of each data table in the target sub-database; a creation unit, used to create a first data table in the first sub-database corresponding to each data table in the target sub-database based on a preset DDL statement and the second data; and a second data migration unit, used to migrate the data in each data table to the first data table in the first sub-database corresponding to that data table.

[0093] Optionally, the data management unit includes: a third response unit, used to detect whether a primary key of third data exists in the target data table in response to a data addition instruction, wherein the data addition instruction is used to add the third data to the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; and a data addition unit, used to add the third data to the target data table by running the target branch code if the primary key of the third data does not exist in the target data table.

[0094] Optionally, the database data management device further includes: an execution unit, configured to, after detecting whether a primary key of third data exists in the target data table, if a primary key of third data exists in the target data table, prevent the addition of third data to the target data table, and perform a data query operation to display the third data in a graphical interface, wherein the data query operation is used to query the third data from the target data table; a fourth response unit, configured to, in response to a data modification instruction, obtain the target key value in the graphical interface, wherein the target key value is the key value obtained after modifying the key value of the third data; and a data modification unit, configured to update the key value of the third data to the target key value by running the target branch code.

[0095] Optionally, the data management unit includes: a data deletion unit, used to delete the fourth data from the target data table by running target branch code in response to a data deletion instruction, wherein the fourth data is the data to be deleted, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database.

[0096] Example 3

[0097] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the above-described database data management method at runtime.

[0098] Example 4

[0099] According to another aspect of the embodiments of this application, an electronic device is also provided, wherein, Figure 6 This is a schematic diagram of an optional electronic device according to an embodiment of this application, such as... Figure 6 As shown, the electronic device includes one or more processors; and a memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to run the programs, wherein the programs are configured to execute the aforementioned database data management method during runtime.

[0100] like Figure 6 As shown, this application embodiment provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps:

[0101] The system receives database operation instructions, each containing a unique identifier for the target database. The target database can be any one of M databases, where M is a positive integer. Based on the unique identifier, the system determines the target branch code from the M branch codes. Each of the M branch codes corresponds one-to-one with one of the M databases. The target branch code is created based on the driver package of the target database. The system then manages the data in the target database by running the target branch code.

[0102] Optionally, the processor also performs the following steps when executing the program: before receiving database operation instructions, it obtains the driver package for each of the M databases, resulting in M ​​driver packages; and creates a branch code based on each driver package and a preset SQL statement, resulting in M ​​branch codes.

[0103] Optionally, when the processor executes the program, it also performs the following steps: obtaining a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; establishing a connection with the target database based on the target IP address and the target port number; obtaining target data from the target database by running the target branch code and displaying the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database; and performing data management on the target database based on the target data.

[0104] Optionally, when the processor executes the program, it also performs the following steps: in response to a data query instruction, it queries the first data in the target data table from the target database by running the target branch code, wherein the data query instruction carries the name of the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; and displays the first data in the target data table in the graphical interface based on a preset paging SQL statement, wherein the preset paging SQL statement is used to perform paging processing on the first data in the target data table.

[0105] Optionally, the processor, when executing the program, further implements the following steps: in response to a data migration instruction, obtains a second configuration file, wherein the data migration instruction is used to instruct the migration of data from a target sub-database to a first sub-database, the target sub-database being a sub-database within a target database, the first sub-database being a sub-database within a first database, the first database being a database other than the target database among M databases, and the second configuration file includes at least the IP address of the host running the first database and the port number of the first database; establishes a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and migrates the data from the target sub-database to the first sub-database within the first database by running the target branch code.

[0106] Optionally, when the processor executes the program, it also performs the following steps: obtaining second data in the target sub-database by running the target branch code, wherein the second data includes at least the name of each data table in the target sub-database; creating a first data table in the first sub-database corresponding to each data table in the target sub-database based on a preset DDL statement and the second data; and migrating the data in each data table to the first data table in the first sub-database corresponding to that data table.

[0107] Optionally, the processor also performs the following steps when executing the program: in response to a data addition instruction, it checks whether a primary key for third data exists in the target data table, wherein the data addition instruction is used to add the third data to the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; if the primary key for third data does not exist in the target data table, the third data is added to the target data table by running the target branch code.

[0108] Optionally, the processor, when executing the program, also implements the following steps: after detecting whether a primary key of third data exists in the target data table, if a primary key of third data exists in the target data table, it prevents the addition of third data to the target data table and performs a data query operation to display the third data in the graphical interface, wherein the data query operation is used to query the third data from the target data table; in response to a data modification instruction, it obtains the target key value in the graphical interface, wherein the target key value is the key value obtained after modifying the key value of the third data; and updates the key value of the third data to the target key value by running the target branch code.

[0109] Optionally, when the processor executes the program, it also performs the following steps: in response to a data deletion instruction, the fourth data is deleted from the target data table by running the target branch code, wherein the fourth data is the data to be deleted, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database.

[0110] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0111] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0112] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0113] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0114] 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 unit can be implemented in hardware or as a software functional unit.

[0115] 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 computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of 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.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0116] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A data management method of a database, characterized by, include: Receive a database operation instruction, wherein the database operation instruction carries a unique identifier of the target database, and the target database is any one of M databases, where M is a positive integer; The target branch code is determined from M branch codes based on the unique identifier information, wherein each branch code in the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database; Data management of the target database is achieved by running the target branch code; The process of managing the target database by running the target branch code includes: obtaining a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; establishing a connection with the target database based on the target IP address and the target port number; obtaining target data from the target database by running the target branch code and displaying the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database. The graphical interface of a non-relational database differs from that of a relational database, and the graphical interface of a non-relational database supports key-value pair operations; and managing the target database based on the target data. The data management of the target database based on the target data includes: in response to a data migration instruction, obtaining a second configuration file, wherein the data migration instruction is used to instruct the migration of data from a target sub-database to a first sub-database, the target sub-database being a sub-database within the target database, the first sub-database being a sub-database within a first database, and the first database being a database other than the target database among the M databases, the second configuration file including at least the IP address of the host running the first database and the port number of the first database; establishing a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and migrating the data from the target sub-database to the first sub-database within the first database by running the target branch code.

2. The method of claim 1, wherein, Before receiving database operation instructions, the method further includes: Obtain the driver package for each of the M databases to obtain M driver packages; A branch code is created based on each driver package and a preset SQL statement, resulting in the M branch codes.

3. The method of claim 1, wherein, The data management of the target database based on the target data includes: In response to a data query instruction, the first data in the target data table is queried from the target database by running the target branch code, wherein the data query instruction carries the name of the target data table, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database; The first data in the target data table is displayed in the graphical interface based on a preset pagination SQL statement, wherein the preset pagination SQL statement is used to perform pagination processing on the first data in the target data table.

4. The method of claim 1, wherein, Migrating data from the target sub-database to the first sub-database of the first database by running the target branch code includes: The second data in the target sub-database is obtained by running the target branch code, wherein the second data includes at least the name of each data table in the target sub-database; Based on the preset DDL statement and the second data, a first data table corresponding to each data table in the target sub-database is created in the first sub-database; The data in each data table is migrated to the first data table corresponding to that data table in the first sub-database.

5. The method of claim 1, wherein, The data management of the target database based on the target data includes: In response to a data addition instruction, the system detects whether a primary key for third data exists in the target data table. The data addition instruction is used to add the third data to the target data table, where the target data table is a data table in a target sub-database, and the target sub-database is a sub-database in the target database. If the third data does not exist as a primary key in the target data table, the third data is added to the target data table by running the target branch code.

6. The method according to claim 5, characterized in that, After detecting whether a primary key of third-party data exists in the target data table, the method further includes: If the primary key of the third data exists in the target data table, adding the third data to the target data table is prohibited, and a data query operation is performed to display the third data in the graphical interface. The data query operation is used to query the third data from the target data table. In response to a data modification instruction, a target key value is obtained from the graphical interface, wherein the target key value is the key value obtained after modifying the key value of the third data; The target branch code updates the key value of the third data to the target key value.

7. The method according to claim 1, characterized in that, The data management of the target database based on the target data includes: In response to a data deletion instruction, the fourth data is deleted from the target data table by running the target branch code, wherein the fourth data is the data to be deleted, the target data table is a data table in the target sub-database, and the target sub-database is a sub-database in the target database.

8. A data management device for a database, characterized in that, include: The receiving module is used to receive database operation instructions, wherein the database operation instructions carry unique identification information of the target database, and the target database is any one of M databases, where M is a positive integer; The determination module is used to determine the target branch code from M branch codes based on the unique identification information, wherein each branch code in the M branch codes has a one-to-one correspondence with one of the M databases, and the target branch code is code created based on the driver package of the target database; The data management module is used to manage data in the target database by running the target branch code; The data management module includes: a first acquisition unit for acquiring a first configuration file corresponding to the target database, wherein the first configuration file includes at least the target IP address of the host running the target database and the target port number of the target database; a first connection unit for establishing a connection with the target database based on the target IP address and the target port number; a second acquisition unit for acquiring target data from the target database by running the target branch code and displaying the target data in a graphical interface, wherein the target data includes at least the name of each sub-database in the target database and the name of each data table in each sub-database, and the graphical interface of the non-relational database differs from that of the relational database, supporting key-value pair operations; and a data management unit for managing the target database based on the target data. The data management unit includes: a second response unit, configured to obtain a second configuration file in response to a data migration instruction, wherein the data migration instruction instructs the migration of data from a target sub-database to a first sub-database, the target sub-database being a sub-database within the target database, the first sub-database being a sub-database within a first database, and the first database being a database other than the target database among the M databases, and the second configuration file includes at least the IP address of the host running the first database and the port number of the first database; a second connection unit, configured to establish a connection with the first database based on the IP address of the host running the first database and the port number of the first database; and a first data migration unit, configured to migrate data from the target sub-database to the first sub-database within the first database by running the target branch code.

9. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the data management method of the database as described in any one of claims 1 to 7 when it is run.

10. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the data management method of the database according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-type database configuration code generation method and device and electronic equipment

    CN116126297A