Management method and system for sharded database and table, and electronic device and medium

By analyzing and generating SQL statements for permission verification, the permission control and security issues in the database sub-table management of large companies are solved, and table-level refined management and security shielding are realized, which improves the security and audit capabilities of database operations.

WO2025161414A1PCT designated stage Publication Date: 2025-08-07SHANGHAI JUSHUITAN NETWORK TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/118850
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-01
Filing Date
2024-09-13
Publication Date
2025-08-07

AI Technical Summary

Technical Problem

In the database management of large companies, data updates and query problems occur after the database is divided into different databases and tables, difficulty in managing permissions, inability to audit operations, leakage of account and passwords, high risk of high-risk statements, and difficulty in permission control.

Method used

By parsing access permissions and query permissions in SQL statements, generating execution statements, and performing permission verification, blocking database address and account password, realizing table-level permission control.

Benefits of technology

It improves the security of database operations, prevents high-risk operations, realizes refined management and audit of permissions, and reduces the risk of account password leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024118850_07082025_PF_FP_ABST
    Figure CN2024118850_07082025_PF_FP_ABST
Patent Text Reader

Abstract

A management method and system for a sharded database and table, and an electronic device and a medium. The method comprises: on the basis of parameters in a database that need to be changed, determining a sub-database to be changed (S1); when a backend verifies that a user has access permission for the sub-database, the user inputting a statement (S2); when the backend verifies that the user has query permission for the sub-database, parsing the inputted statement (S3); after a table, a database and a statement template corresponding to the parsed statement have been subjected to permission verification, generating an execution statement on the basis of the parsed statement (S4); and on the basis of the execution statement, changing the parameters in the sub-database that need to be changed (S5).
Need to check novelty before this filing date? Find Prior Art

Description

Sub-library and sub-table management method, system, electronic equipment, and medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 1, 2024, with application number 202410146902.X. The entire contents of this application are incorporated by reference into this application. Technical Field

[0002] The present application relates to the technical field of database management, and for example, to a method, system, electronic device and medium for managing sub-libraries and sub-tables. Background Art

[0003] As the scale of a company's business grows, sharding has become a necessity for large companies. However, querying and maintaining sharded databases and tables is also difficult. When the number of databases reaches over 1,000, the following problems will arise:

[0004] (1) It is extremely difficult to update and query data in large quantities of homogeneous tables;

[0005] () Based on business needs, each business department needs to develop online read-only permissions or read-write permissions to troubleshoot and solve problems, which makes permission management difficult;

[0006] (3) Online inquiries and operations cannot be audited or traced;

[0007] (4) The operator may enter high-risk statements (such as drop table statements and updates without where conditions);

[0008] (5) The online database address and read-only account password need to be sent to the developer in plain text, which makes it impossible to centrally manage and control the account password and online database address. This makes it easy for the account password and online database address to be leaked.

[0009] (6) Employee resignation may lead to account password leakage;

[0010] (7) Only allow users to enter specific statements, for example: only allow SELECT commands, not ANALYZE commands.

[0011] Summary of the Invention

[0012] Based on this, the purpose of this application is to provide a method, system, electronic equipment and medium for managing sub-libraries and sub-tables.

[0013] To achieve the above objectives, this application provides the following solutions:

[0014] A method for managing sharded libraries and tables, comprising:

[0015] Determine the sub-database to be changed based on the parameters that need to be changed in the database;

[0016] When the background verification finds that the user has access rights to the sub-database, the user enters a statement; the statement entered by the user includes a query statement, a delete statement, and an update statement;

[0017] When the background verifies that the user has the query authority for the sub-database, the statement input by the user is parsed;

[0018] After the table, database, and statement template corresponding to the parsed statement are verified for permissions, an execution statement is generated based on the parsed statement;

[0019] The parameters that need to be changed in the sub-database are changed according to the execution statement.

[0020] Optionally, the user's access rights and query rights are verified by parsing a statement template for access rights and a statement template for query rights in an SQL statement.

[0021] Optionally, after the table, database, and statement template corresponding to the parsed statement are verified for permissions, an execution statement is generated based on the parsed statement, specifically including:

[0022] Determine whether the commands involved in the parsed statement contain dangerous instructions;

[0023] If so, an error message is returned;

[0024] If not, verify that the user has the table access permission;

[0025] If not, an error message is returned;

[0026] If so, after the permissions of the table, database, and statement template corresponding to the parsed statement are checked, an execution statement is generated based on the parsed statement.

[0027] This application also provides a sharding management system, including:

[0028] A sub-database determination module is configured to determine a sub-database to be changed based on parameters that need to be changed in the database;

[0029] The statement input module is configured to allow the user to input statements when the background verifies that the user has access rights to the sub-database; the statements input by the user include query statements, delete statements, and update statements.

[0030] A parsing module configured to parse the statement input by the user when the background verifies that the user has query authority for the sub-database;

[0031] The execution statement generation module is configured to generate an execution statement based on the parsed statement after the table, database, and statement template corresponding to the parsed statement have been verified for permissions.

[0032] The changing module is configured to change the parameters that need to be changed in the sub-database according to the execution statement.

[0033] The present application also provides an electronic device, including a memory and a processor, wherein the memory is configured to store a computer program, and the processor runs the computer program to enable the electronic device to execute the above-mentioned sub-library and sub-table management method.

[0034] The present application also provides a computer-readable storage medium storing a computer program, which implements the above-mentioned method for managing sharded libraries and tables when executed by a processor.

[0035] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0036] (1) This application uses the method of parsing SQL statements to perform permission verification to determine whether the defined statement template and permissions are met. If the verification fails, the execution will be terminated.

[0037] (2) Permission control can be implemented at the table level. For the core database, some tables require separate permission control. In this application, the core database tables that need to be controlled can be mapped separately to user settings.

[0038] (3) During the process of querying the database, the system shields the actual database address, account number and password, which greatly improves the security of the program. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0040] FIG1 is a flowchart of sub-library and sub-table management provided by some embodiments of the present application;

[0041] FIG2 is a flowchart of asynchronous execution provided by some embodiments of the present application. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0043] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0044] Example 1

[0045] As shown in Figure 1, the sharding management method provided by this application includes the following steps:

[0046] S1: Determine the sub-database to be changed based on the parameters that need to be changed in the database.

[0047] S2: When the background verification finds that the user has access rights to the sub-database, the user enters statements, including query statements, delete statements, and update statements.

[0048] S3: When the background verifies that the user has the query authority for the sub-database, the statement input by the user is parsed.

[0049] S4: After the permissions of the tables, libraries, and statement templates corresponding to the parsed statements are verified, an execution statement is generated based on the parsed statements.

[0050] S5: Modify the parameters that need to be changed in the sub-database according to the execution statement.

[0051] In this embodiment, the access authority statement template and the query authority statement template in the SQL statement are parsed to verify the user's access authority and query authority.

[0052] Database permissions include: read-only permission, read-write permission, and administrator permission.

[0053] (1) Read-only permission: only query permission is granted to the data in the database. The limited statement template is: SELECT, etc.

[0054] (2) Read and write permissions, including read-only permissions and permissions to modify data. The limited statement templates are: UPDATE, DELETE, INSERT, etc.

[0055] (3) Administrator privileges include read and write privileges, as well as the privileges to add, delete, and modify table structures. The limited statement templates are: ALTER, CREATE, etc.

[0056] A statement (SQL statement) is a structured query language specifically for databases. Common examples are as follows:

[0057] (1) Query: SELECT * FROM dbo.order_1 WHERE co_id = 1;

[0058] (2) Update: UPDATE dbo.order_1SET id=2WHERE id=2;

[0059] (3) Delete: DELETE FROM dbo.order_1 WHERE id = 2;

[0060] (4) High-risk commands:

[0061] 1) Delete (high risk): TRUNCATE TABLE dbo.order_1;

[0062] 2) Deleting a table (high risk): DROP TABLE dbo.order_1;

[0063] 3) Update (high risk, unconditional): UPDATE dbo.order_1 SET id = 2;

[0064] 4) Delete (high risk, unconditional): DELETE FROM dbo.order_1.

[0065] Statement templates analyze and classify statements entered by users. For example, SELECT * FROM dbo.order_1 WHERE co_id = 1 is classified as a SELECT template. To facilitate permission verification, this embodiment presets the following default templates:

[0066] (1) Define statement templates allowed by read-only permissions: SELECT, etc.

[0067] (2) Define statement templates that are allowed by read and write permissions: UPDATE, DELETE, INSERT, etc.;

[0068] (3) Define statement templates allowed by administrator privileges: ALTER, CREATE, etc.;

[0069] (4) Define dangerous statement templates: DROP TABLE, TRUNCATE TABLE, unconditional update, etc.

[0070] This application performs query and change operations on the database set selected by the user. After the user enters the statement, the statement is verified, parsed, and the placeholders in the statement are processed. After a series of operations, the statement is executed according to the final generated statement, and the execution results are automatically merged and output to the front end.

[0071] As shown in Figure 2, the specific steps are as follows:

[0072] 1: The user selects the scope to be modified on the web (for example, a group of companies, a group of sharded tables, or a group of databases) and initializes a channel based on the selected parameters. Built-in variables, such as **co_id**, represent the company ID; **seq** represents the sharded table ID where the company data resides. These variables can be included in statements and replaced with the actual values ​​within the context. For example, if a user issues the statement: SELECT * FROM dbo.order_**seq** WHERE co_id = **co_id**, the resulting statement sent to the database might be 99 statements, like the following: SELECT * FROM dbo.order_1 WHERE co_id = 1

[0073] SELECT*FROM dbo.order_2WHERE co_id=2

[0074] ...

[0075] SELECT*FROM dbo.order_99WHERE co_id=99.

[0076] 2: The background verifies whether there is database query module permission, verifies one by one whether the user has access to the database in the channel, and verifies the maximum read and write permissions of the library (read-only, read-write, administrator). After the verification is passed, the created channel number is returned and a new channel query page is opened on the Web.

[0077] 3: In the open web channel, the user enters a statement and clicks "Execute" to submit it to the backend for execution.

[0078] 4: The background verifies whether there is database query module permission, verifies one by one whether the user has access rights to the database in the channel, and verifies the maximum read and write permissions of the library (read-only, read and write, administrator).

[0079] 5: Analyze whether the commands involved in the user input statement contain dangerous instructions (drop, truncate). If so, return an error message.

[0080] 6: Analyze whether the table referenced in the statement entered by the user has query permissions. If there is no query permission for the table, an error message is returned.

[0081] 7: Parse the statement based on the channel initialization parameters and placeholders in the statement and replace the actual statement.

[0082] Example: User input:

[0083] ALTER TABLE t ADD id INT

[0084] ALTER TABLE t_**seq**ADD id int

[0085] After this processing, it becomes:

[0086] ALTER TABLE t ADD id INT

[0087] ALTER TABLE t_99 ADD id int

[0088] ALTER TABLE t_98 ADD id int

[0089] ALTER TABLE t_97 ADD id int

[0090] ...t_96–t_3 are omitted here...

[0091] ALTER TABLE t_2 ADD id int

[0092] ALTER TABLE t_1 ADD id int

[0093] ALTER TABLE t_0 ADD id int

[0094] 8: Asynchronously execute the processed statement and immediately return the result to the foreground.

[0095] 9: Pull data incrementally in the front-end.

[0096] 10: The background records the statements executed by the user and the returned results for auditing.

[0097] In the above method:

[0098] User database permission check: Check whether the current user has the access rights to the currently selected database resources, that is, the platform administrator has set query permissions for the user. If yes, it passes, otherwise an error is returned.

[0099] User database data permission check: Check whether the permission applied by the current user is included in the permission configured by the platform administrator. The platform administrator has assigned read and write permissions to database A. If the user applies for read-only or read-write permissions, it will be approved. If the user applies for administrator permissions, an error will be reported directly.

[0100] User database table permission check: Check whether the tables involved in the current user statement are in the queryable tables configured by the platform administrator and are not in the inaccessible tables. If so, the verification passes. Otherwise, an error is reported directly if the verification fails.

[0101] The usage of the management tool that applies the above method is as follows:

[0102] 1: DingTalk QR code scanning management tool web platform website. If you have not registered, you will be automatically registered as a user after logging in. Otherwise, you will be logged in.

[0103] Only employees currently working in the company are allowed to log in. Once an employee leaves, HR will delete that person from the company's DingTalk. Therefore, once an employee leaves, after being removed from DingTalk, the former employee will no longer be able to log in to this platform, achieving the effect of automatic account recovery.

[0104] 2: If you are a platform administrator, you can set the accessible database resources for each employee account.

[0105] 3: On the web page, select the corresponding database using the database instance name and database name.

[0106] The data displayed here is the list of visible databases configured by the platform administrator for the user. When the user chooses which database to connect to, the key information exposed to the user is only the instance name and database name, and does not include the actual address of the database and the account and password. It can be found that when querying the database through this platform, the actual address, account, and password of the database are blocked, thereby avoiding the risk of leakage of core database information.

[0107] 4: After selecting multiple database names in the third step, click Create Channel.

[0108] Creating a channel will verify the currently selected library [User Database Permission Verification] [User Database Data Permission Verification]. After creation, you can find that there are two libraries currently being queried, and the query context contains two companies. The current permissions for operating these libraries are configured by the platform administrator as read-only, read-write, and administrator.

[0109] 5: Execute the statement. Suppose the user enters the statement:

[0110] SELECT TOP 100*FROM dbo.Order_**seq**o INNER JOIN dbo.Order_Item_**seq**oi ON oi.o_id=o.o_id WHERE o.coid=**co_id**.

[0111] The permission verification steps include:

[0112] 1: First, identify **co_id** and **seq**, and replace them according to the actual company number and the corresponding sub-table number of the company, obtaining the following two statement lists:

[0113] SELECT TOP 100*FROM dbo.Order_1 o INNER JOIN dbo.Order_Item_1 oi ON oi.o_id=o.o_id WHERE o.coid=1;

[0114] SELECT TOP 100*FROM dbo.Order_2 o INNER JOIN dbo.Order_Item_2 oi ON oi.o_id=o.o_id WHERE o.coid=2.

[0115] 2. Traverse and parse the above table.

[0116] SELECT TOP 100*FROM aaa.dbo.Order_1 o INNER JOIN dbo.Order_Item_1 oi ON oi.o_id=o.o_id WHERE o.coid=1.

[0117] The following information is obtained:

[0118] (1) Operation database: aaa;

[0119] (2) Statement template: SELECT template;

[0120] (3) Operation tables: Order_1, Order_Item_1;

[0121] (4) Condition: WHERE o.coid = 1;

[0122] (5)Company number of the operation: 1.

[0123] 3. Verification.

[0124] (1) Check whether the database aaa currently being operated on has permissions;

[0125] (2) Verify the current permissions (read-only, read-write, administrator) and the corresponding statement template to see if they meet the system's built-in permission corresponding template;

[0126] (3) Verify the table permissions of the table operated in the statement with those configured in the platform;

[0127] (4) If it is an UPDATE or DELETE template, determine whether there is a condition;

[0128] (5) Determine whether Company 1 has the authority to query.

[0129] 4. Secondary verification: including user database permission verification and user database data permission verification.

[0130] 5. Send the two statements generated in the first step to the database for execution, then merge the two results and display them on the front end, and record the executed statements in the log.

[0131] 6. The front-end web pulls data from the back-end interface in real time through incremental pull until all the data is read.

[0132] Account and password issues:

[0133] The system integrates DingTalk scan code login, no account password is required, which is more secure. Only company employees can log in to the management system. After leaving the company, you will not be able to log in to the system immediately

[0134] Database account password issue:

[0135] Each database instance has a unified read-only account, read-write account, and administrator account. Users log in to the system with a DingTalk account and configure the accessible database and read-only, read-write, and administrator account permissions.

[0136] Permission issues:

[0137] Define the statements allowed by read-only permissions: SELECT, etc.

[0138] Define the statements allowed by read and write permissions: UPDATE, DELETE, INSERT, etc.;

[0139] Define statements allowed by administrator privileges: ALTER, CREATE, etc.;

[0140] Define dangerous statements: DROP TABLE, TRUNCATE TABLE, UPDATE without WHERE, etc.

[0141] Define non-executable statements: ANALYZE, etc.

[0142] Permission verification is performed by parsing SQL statements. All statements entered by the user are parsed, and then it is determined whether they meet the statement template and permissions defined above. If the verification fails, the execution will be terminated.

[0143] Permission control can be implemented at the table level. For core libraries, some tables require separate permission control. In this system, the core library tables that need to be controlled can be mapped individually to user settings.

[0144] When using this system to query the database, the system shields the actual database address, account number and password, significantly improving program security. It also integrates DingTalk login, which can quickly and automatically reclaim online database access rights when employees leave.

[0145] Example 2

[0146] In order to execute the method corresponding to the above-mentioned embodiment 1 and achieve the corresponding functions and technical effects, a sub-library and sub-table management system is provided below.

[0147] The system includes:

[0148] The sub-database determining module is configured to determine the sub-database to be changed according to the parameters that need to be changed in the database.

[0149] The statement input module is configured to allow the user to input a statement when the background verification determines that the user has access rights to the sub-database.

[0150] The parsing module is configured to parse the statement input by the user when the background verifies that the user has the query authority of the sub-database.

[0151] The execution statement generation module is configured to generate an execution statement based on the parsed statement after the table, database, and statement template corresponding to the parsed statement are subjected to permission verification.

[0152] The changing module is configured to change the parameters that need to be changed in the sub-database according to the execution statement.

[0153] Example 3

[0154] Embodiment 3 of the present application provides an electronic device, including a memory and a processor, wherein the memory is configured to store a computer program, and the processor runs the computer program to enable the electronic device to execute the sub-library and sub-table management method provided in embodiment 1.

[0155] In practical applications, the above-mentioned electronic device may be a server.

[0156] In practical applications, an electronic device includes at least one processor, a memory, a bus, and a communications interface.

[0157] Wherein: the processor, the communication interface, and the memory communicate with each other via a communication bus.

[0158] Communication interface, configured to communicate with other devices.

[0159] The processor is configured to execute a program, and specifically can execute the method described in the above embodiment.

[0160] Specifically, the program may include program codes including computer operation instructions.

[0161] The processor may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.

[0162] The memory is configured to store programs. The memory may include a high-speed RAM memory and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage.

[0163] Example 4

[0164] Based on the description of the third embodiment, the fourth embodiment of the present application provides a storage medium on which a computer program is stored. The computer program can be executed by a processor to implement the sharding method of managing sharded libraries and tables of the first embodiment.

[0165] The sharding management system provided in the second embodiment of the present application exists in various forms, including but not limited to:

[0166] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and are primarily designed to provide voice and data communications. These terminals include smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones.

[0167] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access capabilities. These terminals include PDAs, MIDs, and UMPC devices, such as the iPad.

[0168] (3) Portable entertainment devices: These devices can display and play multimedia content. These devices include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.

[0169] (4) Other electronic devices with data interaction functions.

[0170] Thus far, specific embodiments of the present subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing may be advantageous.

[0171] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0172] For the convenience of description, the above devices are described in terms of their functions and are divided into various units and described separately. Of course, when implementing the present application, the functions of each unit can be implemented in the same one or more software and / or hardware. It should be understood by those skilled in the art that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0173] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0174] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0175] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0176] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0177] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0178] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this application, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0179] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0180] The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer.

[0181] Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0182] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.

[0183] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for managing sharded libraries and tables, comprising: Determine the sub-database to be changed based on the parameters that need to be changed in the database; When the background verification finds that the user has access rights to the sub-database, the user enters a statement; the statement entered by the user includes a query statement, a delete statement, and an update statement; When the background verifies that the user has the query authority for the sub-database, the statement input by the user is parsed; After the table, database, and statement template corresponding to the parsed statement are verified for permissions, an execution statement is generated based on the parsed statement; The parameters that need to be changed in the sub-database are changed according to the execution statement.

2. The method for managing sharded libraries and tables according to claim 1, wherein: The user's access rights and query rights are verified by parsing the statement template for access rights and the statement template for query rights in the SQL statement.

3. The method for managing sharded libraries and tables according to claim 1, wherein: After the table, database, and statement template corresponding to the parsed statement are verified for permissions, an execution statement is generated based on the parsed statement, including: Determine whether the commands involved in the parsed statement contain dangerous instructions; If so, an error message is returned; If not, verify that the user has the table access permission; If not, an error message is returned; If so, after the permissions of the table, database, and statement template corresponding to the parsed statement are checked, an execution statement is generated based on the parsed statement.

4. A sharding database and table management system, comprising: A sub-database determination module is configured to determine a sub-database to be changed based on parameters that need to be changed in the database; A statement input module is configured to allow a user to input a statement when the backend verifies that the user has access rights to the sub-database; the statement input by the user includes a query statement, a delete statement, and an update statement; A parsing module configured to parse the statement input by the user when the background verifies that the user has query authority for the sub-database; The execution statement generation module is configured to generate an execution statement based on the parsed statement after the table, database, and statement template corresponding to the parsed statement have been verified for permissions. The changing module is configured to change the parameters that need to be changed in the sub-database according to the execution statement.

5. An electronic device comprising a memory and a processor, wherein the memory is configured to store a computer program, and the processor runs the computer program to enable the electronic device to execute the sub-library and sub-table management method according to any one of claims 1 to 3.

6. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the method for managing sharded libraries and tables according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Data access control method and device

    CN111460506A

  • Database division and table division method, electronic equipment and storage medium

    CN112860691A

  • Data query method and device, electronic equipment and computer readable storage medium

    CN114328574A

  • Data authority management method and device, electronic equipment and storage medium

    CN116415218A

  • Management method and system for sub-libraries and sub-tables, electronic equipment and medium

    CN118012869A