Data processing method and device, equipment, storage medium and program product

By analyzing the database access instructions in the multi-tenant database architecture and modifying the access instructions according to the tenant information table, the problem of poor data isolation effect is solved and higher data security and query efficiency are achieved.

CN118607002APending Publication Date: 2024-09-06CCB FINTECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410872097.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

In the existing multi-tenant database architecture, the data isolation effect is poor and the security is insufficient. It relies on the SQL interpreter to analyze the tenant number in the query condition, resulting in poor data isolation effect.

Method used

By obtaining the database access instructions requested by the business, analyze the instructions to determine whether the database to be accessed is the global database or the tenant database, and modify the access instructions based on the tenant information in the tenant information table to ensure that data access follows tenant rules and avoid mixed storage of data from different tenants.

Benefits of technology

It enhances the data isolation effect, improves data security, reduces the data volume of a single data table, and improves data query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118607002A
    Figure CN118607002A
Patent Text Reader

Abstract

The invention provides a data processing method and device, equipment, a storage medium and a program product, and relates to the field of data processing. The method comprises the steps of obtaining and analyzing a database access instruction related to a service request, obtaining that a to-be-accessed database is a global database or a tenant database, if the to-be-accessed database is the tenant database, modifying the database access instruction according to tenant information corresponding to the service request, and then executing the instruction for the tenant database corresponding to a tenant. And obtaining a database return result. The tenant databases of different tenants are distinguished for access through the tenant information corresponding to the service request, and the data of different tenants does not need to be stored in the same data table in the form of increasing the number of the tenants, so that the data isolation effect can be enhanced, the data security can be improved, the data volume of a single data table can be reduced, and the user experience is improved. Therefore, the data query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a data processing method, device, equipment, storage medium and program product. Background Art

[0002] A multi-tenant database is a database architecture design that is designed to support multiple independent objects (called tenants) running in the same database system. Multiple tenants can share the same database instance, but the data of each tenant is isolated, ensuring that the data of one tenant cannot be accessed or modified by other tenants.

[0003] At present, the multi-tenant database architecture generally adopts the form of adding tenant numbers in the data table of the database to achieve data sub-tenant management. Under this architecture, the data isolation of different tenants depends on the constraints in the query conditions. The SQL statements are analyzed by the SQL interpreter in the form of plug-ins, and the tenant restriction query condition information is forcibly added. There is a problem of poor data isolation effect for different tenants and insufficient security. Summary of the invention

[0004] The present application provides a data processing method, apparatus, device, storage medium and program product for improving the security of data access in a multi-tenant database architecture.

[0005] In a first aspect, the present application provides a data processing method, which is applied to a business system, where the business system includes multiple tenants, and the method includes:

[0006] Get database access instructions related to business requests;

[0007] Analyze the database access instruction to obtain a database to be accessed, the database to be accessed is a global database or a tenant database, the global database stores a tenant information table and data corresponding to the business system, the tenant information table contains tenant information of the tenant, and the tenant database stores data corresponding to the tenant;

[0008] If the database to be accessed is a global database, executing the database access instruction on the global database to obtain data returned by the global database;

[0009] If the database to be accessed is a tenant database, the database access instruction is modified according to the tenant information corresponding to the business request, and the modified database access instruction is executed on the tenant database to obtain the data returned by the tenant database. The tenant information corresponding to the business request is obtained according to the tenant information table.

[0010] In a possible design, the global database further stores access rules of the tenant database, and there is a corresponding relationship between the access rules and the tenant information. Modifying the database access instruction according to the tenant information corresponding to the business request includes:

[0011] Extracting tenant information corresponding to the service request from the session state of the service request;

[0012] The corresponding access rule is matched in the global database according to the corresponding relationship and the tenant information corresponding to the business request, and the database access instruction is modified according to the matched access rule.

[0013] In a possible design, the tenant information table also includes a list of users authorized by the tenant to access the corresponding tenant database, and before extracting the tenant information corresponding to the service request from the session state of the service request, it also includes:

[0014] If the service request is generated based on an operation of a target user in the user list, acquiring tenant information of a target tenant corresponding to the target user from the global database according to the user list;

[0015] In response to the authorization operation of the target user, the tenant information of the target tenant is recorded in the session state related to the target user.

[0016] In a possible design, modifying the database access instruction according to the matched access rule includes:

[0017] Extracting fields of a data table contained in the database access instruction;

[0018] The identification information of the tenant database corresponding to the database access instruction is obtained, and the identification information is added to the field containing the data table.

[0019] In a possible design, analyzing the database access instruction to obtain a database to be accessed includes:

[0020] Extracting identification information of the data table contained in the database access instruction;

[0021] The global database and / or the tenant database are searched to see whether there is a data table matching the identification information, and the database to be accessed is determined to be a global database or a tenant database according to the search result.

[0022] In one possible design, it also includes:

[0023] Monitoring, by means of a database change monitoring device or a data synchronization device, whether data changes occur in the global database and the tenant database under the effect of the database access instruction;

[0024] If data changes occur in the global database or the tenant database under the effect of the database access instruction, the result of the data change is synchronized to an analysis database, and the analysis database is used to analyze the data in the business system.

[0025] In one possible design, it also includes:

[0026] In response to a lease request from a newly added tenant, establishing a tenant database corresponding to the newly added tenant;

[0027] The tenant information of the newly added tenant is obtained, and the tenant information table in the global database is updated according to the obtained tenant information.

[0028] In a second aspect, the present application provides a data processing device, which is applied to a business system, wherein the business system includes multiple tenants, and the device includes:

[0029] The acquisition module is used to obtain database access instructions related to business requests;

[0030] a database determination module, configured to analyze the database access instruction to obtain a database to be accessed, wherein the database to be accessed is a global database or a tenant database, wherein the global database stores a tenant information table and data corresponding to the business system, wherein the tenant information table contains tenant information of the tenant, and wherein the tenant database stores data corresponding to the tenant;

[0031] A first execution module, configured to execute the database access instruction on a global database to obtain data returned by the global database when the database to be accessed is a global database;

[0032] The second execution module is used to modify the database access instruction according to the tenant information corresponding to the business request when the database to be accessed is a tenant database, and execute the modified database access instruction on the tenant database to obtain the data returned by the tenant database, and the tenant information corresponding to the business request is obtained according to the tenant information table.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the data processing method described in the first aspect and various possible designs of the first aspect.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the data processing method described in the first aspect and various possible designs of the first aspect is implemented.

[0035] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the data processing method described in the first aspect and various possible designs of the first aspect.

[0036] The data processing method, device, equipment, storage medium and program product provided by the present application can obtain and analyze the database access instructions related to the business request to determine whether the database to be accessed is a global database or a tenant database. If it is a tenant database, the database access instructions can be modified according to the tenant information corresponding to the business request, and then the instructions are executed for the tenant database corresponding to the tenant to obtain the database return result. The tenant databases of different tenants are distinguished for access through the tenant information corresponding to the business request, and there is no need to store the data of different tenants in the same data table by adding tenant numbers. This can not only enhance the data isolation effect and improve data security, but also reduce the amount of data in a single data table, thereby improving data query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0038] Figure 1 An application scenario diagram of a data processing method applicable to an embodiment of the present application;

[0039] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;

[0040] Figure 3 A flowchart of a method for modifying a database access instruction provided in an embodiment of the present application;

[0041] Figure 4 A flowchart of a method for modifying a database access instruction provided by another embodiment of the present application;

[0042] Figure 5 A flowchart of a method for analyzing database access instructions provided in an embodiment of the present application;

[0043] Figure 6 A flowchart of a data processing method provided in another embodiment of the present application;

[0044] Figure 7 A flowchart of a data processing method provided in yet another embodiment of the present application;

[0045] Figure 8 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;

[0046] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0047] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0048] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0049] Multi-tenant data architecture is widely used in the cloud service era. This architecture allows multiple independent tenants to share the same application instance and database. At present, for tenant data management, developers generally add tenant numbers to the data tables of the database. All tenants share the same database and table, and the data of different tenants is distinguished by adding tenant numbers in the table to achieve sub-tenant management of data.

[0050] However, the database itself in the above architecture does not provide a strong field-based data isolation permission mechanism. Therefore, the access isolation to the data itself depends entirely on using the tenant number as a constraint in the SQL query condition. The data of different tenants are mixed and stored in the same data table, resulting in poor data isolation and insufficient security.

[0051] In response to the above technical problems, the present application proposes the following technical concept: set up multiple tenant databases according to business needs, manage the data of different tenants in separate databases, and maintain the data shared between tenants and the tenant information of each tenant database corresponding to the tenant through a global database. When there is a need to access a database, determine whether the database to be accessed is a global database or a tenant database based on the database access instruction analysis. If it is a tenant database, determine the tenant information of the tenant database to be accessed based on the tenant information maintained by the global database, and modify the database access instruction based on the determined tenant information before executing the data access operation. In this way, different tenants independently maintain and manage data through their respective corresponding tenant databases. There is no need to store the data of different tenants in the same data table by adding tenant numbers. This can not only enhance the data isolation effect and improve data security, but also reduce the amount of data in a single data table, thereby improving data query efficiency.

[0052] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of financial data or user data and other information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals. It should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, models, etc. may be mentioned, and they should be considered as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0053] Figure 1 FIG. 1 is an application scenario diagram of a data processing method applicable to an embodiment of the present application. Figure 1 As shown, the terminal 102 communicates with the server 101 through the network. The data storage system can store the data that the server 101 needs to process. The data storage system can be integrated on the server 101, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 101 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0054] The application scenarios involved above are only some examples. Those skilled in the art may expand the application to specific business scenarios, and the embodiments of the present application do not impose any specific limitations on this.

[0055] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0056] Figure 2 A flow chart of a data processing method provided in an embodiment of the present application. The data processing method can be applied to a business system, which can run on Figure 1 In the server 101, the business system may include multiple tenants. Figure 2 As shown, the data processing method includes:

[0057] S201: Obtain database access instructions related to a business request.

[0058] The database access instruction may be a SQL (Structured Query Language) command for interacting with the database, which may be used to query, insert, update and delete data in the database, and manage the database structure.

[0059] S202: Analyze the database access instruction to obtain the database to be accessed.

[0060] The database to be accessed is a global database or a tenant database. The global database stores a tenant information table and data of a corresponding business system. The tenant information table contains tenant information of tenants. The tenant database stores data of corresponding tenants.

[0061] Specifically, SQL statements can be obtained from business requests of business systems through preset plug-ins or scripts. For example, a preset plug-in can be added to the data access layer (such as the access engine of Mybatis), and the plug-in can be used to call the SQL statement parser to analyze the generated SQL statement, and the fields in the SQL statement can be used to determine whether the SQL statement is used to access the global database or the tenant database.

[0062] In some possible implementations, a plug-in can be used in advance to allow the business system to add an identifier for distinguishing the database to be accessed when generating a database access instruction corresponding to a business request. For example, for a business request that needs to access data in a global database, a string "Global" can be added to the database access instruction corresponding to the business request. By identifying whether the database access instruction contains the string, it can be determined whether the database to be accessed is a global database or a tenant database.

[0063] In some possible implementations, the tenant information table may store tenant information such as the tenant identifier and the identifier of the tenant database corresponding to the tenant. The tenant identifier may be the name or number of the tenant, and the tenant database identifier may be the name or number of the tenant database.

[0064] In some possible implementations, the tenant information table may also store information about users managed by the tenant, and the information may include the user's name, number, and permission to access the tenant database, etc.

[0065] S203: If the database to be accessed is a global database, execute a database access instruction for the global database to obtain data returned by the global database.

[0066] Specifically, the global database may be set as the default access database. If the database to be accessed is found to be the global database through analysis of the database access instruction, the database access instruction may be directly executed on the global database to obtain the data result returned by the database.

[0067] S204: If the database to be accessed is a tenant database, modify the database access instruction according to the tenant information corresponding to the business request, and execute the modified database access instruction for the tenant database to obtain data returned by the tenant database.

[0068] The tenant information corresponding to the business request is obtained according to the tenant information table.

[0069] Specifically, if the database to be accessed is found to be a tenant database through analysis of the database access instruction, the tenant corresponding to the business request can be determined based on the tenant information corresponding to the business request, and the tenant database corresponding to the tenant can be determined from multiple tenant databases, thereby modifying the database access instruction based on the determined tenant database so that the modified database access instruction can be executed in the tenant database.

[0070] In the above embodiment, by obtaining and analyzing the database access instructions related to the business request, it can be obtained that the database to be accessed is a global database or a tenant database. If it is a tenant database, the database access instructions can be modified according to the tenant information corresponding to the business request, and then the instructions are executed for the tenant database corresponding to the tenant to obtain the database return result. The tenant databases of different tenants are distinguished for access through the tenant information corresponding to the business request, and there is no need to store the data of different tenants in the same data table by adding tenant numbers. This can not only enhance the data isolation effect and improve data security, but also reduce the amount of data in a single data table, thereby improving data query efficiency.

[0071] In one embodiment, the global database also stores access rules of the tenant database, and there is a corresponding relationship between the access rules and the tenant information, such as Figure 3 As shown, modifying the database access instruction according to the tenant information corresponding to the business request may include:

[0072] S311. Extract tenant information corresponding to the service request from the session state of the service request.

[0073] The service request may be an http request, and the service system may store the session state of the service request in the server memory, and the session state may be used to record user login information, user settings and other information.

[0074] Specifically, the business system can assign a session ID to the business request, and store the session state of the business request in the server memory according to the session ID. The tenant information of the business request is recorded through the session state, and the tenant information state can be transmitted. For example, business request A is associated with business request B (such as associated operations from the same user), and business request A and business request B can share the session state. If the data processing process involved in business request A is related to tenant a, tenant information such as tenant number of tenant a can be written into the session state of business request A. Accordingly, tenant information can be obtained for business request B through the shared session state.

[0075] In some possible implementations, the session state may be transferred in different threads corresponding to the business request through the thread local variable ThreadLocal, so that the tenant information corresponding to the current thread may be obtained in the session state.

[0076] S312: Match corresponding access rules in the global database according to the corresponding relationship and the tenant information corresponding to the business request, and modify the database access instruction according to the matched access rules.

[0077] Specifically, different tenants can set independent access rules for their respective tenant databases. For example, corresponding access rights can be assigned to different users managed by the tenants, and verification processes based on user authorization can be set.

[0078] In some possible implementations, the user's authentication information corresponding to the tenant database may be stored in the global database, and the authentication information provided by the user corresponding to the business request may be compared with the authentication information stored in the global database, and the database access instruction corresponding to the business request may be modified after the comparison is passed. For example, the global database stores the first authentication information of user C accessing tenant database a. If business request A is generated based on the operation of user C, the second authentication information provided by user C may be obtained in advance and written into the session state corresponding to business request A, and then the second authentication information in the session state may be verified to be consistent with the first authentication information in the global database. If they are consistent, the database access instruction corresponding to business request A may be modified according to the access rule of tenant database a. If they are inconsistent, the database access instruction may not be modified.

[0079] In some possible implementations, modifying the database access instruction according to the matched access rule includes: extracting the fields containing the data table in the database access instruction; obtaining the identification information of the tenant database corresponding to the database access instruction, and adding the identification information to the fields containing the data table. The identification information may be the name of the tenant database. For example, if the name of tenant database a is "Database a", "Database a" may be added to the SQL statement corresponding to the business request, and the SQL statement with the name added may be executed, so that the database driver may perform corresponding data operations on tenant database a.

[0080] In the above embodiment, the tenant information corresponding to the service request can be quickly obtained through the session state, without accessing the global database each time to obtain the tenant information, which can improve data access efficiency. In addition, different tenants can flexibly set access rules for their respective tenant databases according to access requirements, and maintain access rules through the global database, thereby improving the flexibility and scalability of data access.

[0081] In one embodiment, the tenant information table also includes a list of users authorized by the tenant to access the corresponding tenant database, such as Figure 4 As shown, before extracting the tenant information corresponding to the business request from the session state of the business request, it also includes:

[0082] S301: If the service request is generated based on an operation of a target user in a user list, tenant information of a target tenant corresponding to the target user is obtained from a global database according to the user list.

[0083] Specifically, the business system can generate a business request based on the user's operation. For the business request, the user's name and other identification information can be matched with the user list stored in the tenant information table to determine which tenant's authorized user list the user is in, thereby determining the tenant information corresponding to the user.

[0084] S302: In response to the authorization operation of the target user, the tenant information of the target tenant is recorded in the session state related to the target user.

[0085] Specifically, in response to the user's authorization operation, the tenant business space corresponding to the user may be logged in, and the tenant information corresponding to the user may be recorded in the session state at the system level.

[0086] In some possible implementations, if the business request is not generated based on user operations, for example, the business request is generated based on a preset event of the business system, the business system can customize the session state of the business request so that the tenant information in the session state adapts to the preset event.

[0087] In one embodiment, Figure 5 As shown, analyzing the database access instruction to obtain the database to be accessed includes:

[0088] S501: Extract identification information of a data table contained in a database access instruction.

[0089] The identification information of the data table may be the name of the data table.

[0090] Specifically, the fields corresponding to the data table may be extracted from the database access instruction by executing a pre-written script, thereby obtaining identification information such as the name of the data table.

[0091] S502: Search the global database and / or the tenant database to see whether there is a data table matching the identification information, and determine whether the database to be accessed is the global database or the tenant database according to the search result.

[0092] Specifically, after obtaining the name of the data table in the database access instruction, you can search the global database and the tenant database respectively to see whether there is a data table with the same name. If there is a data table with the same name in the global database, the database to be accessed is the global database; if there is a data table with the same name in the tenant database, the database to be accessed is the tenant database.

[0093] In some possible implementations, it is also possible to search only in the global database whether there is a data table with the same name. If so, the database to be accessed is the global database; if not, the database to be accessed is the tenant database.

[0094] In one embodiment, Figure 6 As shown, the data processing method also includes:

[0095] S601. Monitor, by means of a database change monitoring device or a data synchronization device, whether data changes occur in a global database and a tenant database under the action of a database access instruction.

[0096] Among them, the database change monitoring device is a system or tool for detecting and recording data changes in a database. In a distributed system, the database change monitoring device can be used to synchronize data changes to other databases or systems in real time.

[0097] S602: If data changes occur in the global database or the tenant database under the action of the database access instruction, the result of the data change is synchronized to the analysis database.

[0098] Among them, the analytical database is used to analyze the data in the business system.

[0099] Specifically, the global database and the tenant database may be queried periodically by polling to determine whether the data in the global database and the tenant database has changed. If so, the data before and after the change and the database identifiers involved in the change are synchronized to a preset analysis database.

[0100] In one embodiment, Figure 7 As shown, the data processing method also includes:

[0101] S701: In response to a lease request from a newly added tenant, establish a tenant database corresponding to the newly added tenant.

[0102] Specifically, the business system can also add tenants according to the request, and establish a tenant database corresponding to the newly added tenant by creating a new database instance or other means.

[0103] S702: Obtain tenant information of the newly added tenant, and update the tenant information table in the global database according to the obtained tenant information.

[0104] Specifically, the preset tenant initialization script can be used to obtain information such as the identification of the newly added tenant, the identification of the tenant database, and access rules, and the obtained information can be synchronously updated to the tenant information table in the global database through the script, so as to facilitate the management of the newly added tenant database through the global database.

[0105] Figure 8 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. The data processing device can be applied to a business system, and the business system can include multiple tenants. Figure 8 As shown, the data processing device may include:

[0106] The acquisition module 801 is used to acquire database access instructions related to the business request.

[0107] The database determination module 802 is used to analyze the database access instruction to obtain the database to be accessed. The database to be accessed is a global database or a tenant database. The global database stores a tenant information table and data of the corresponding business system. The tenant information table contains tenant information of the tenant, and the tenant database stores data of the corresponding tenant.

[0108] The first execution module 803 is used to execute a database access instruction on the global database to obtain data returned by the global database when the database to be accessed is a global database.

[0109] The second execution module 804 is used to modify the database access instruction according to the tenant information corresponding to the business request when the database to be accessed is a tenant database, and execute the modified database access instruction on the tenant database to obtain the data returned by the tenant database. The tenant information corresponding to the business request is obtained according to the tenant information table.

[0110] In one embodiment, the global database also stores access rules of the tenant database, and there is a corresponding relationship between the access rules and the tenant information. The second execution module 804 may include:

[0111] The tenant information extraction unit may be used to extract tenant information corresponding to the service request from the session state of the service request.

[0112] The rule matching and modifying unit can be used to match the corresponding access rules in the global database according to the corresponding relationship and the tenant information corresponding to the business request, and modify the database access instruction according to the matched access rules.

[0113] In one embodiment, the tenant information table also includes a list of users authorized by the tenant to access the corresponding tenant database. The second execution module 804 may include:

[0114] The list processing unit may be used to obtain tenant information of a target tenant corresponding to the target user from a global database according to the user list when the service request is generated based on an operation of a target user in the user list.

[0115] The information recording unit may be configured to record the tenant information of the target tenant into a session state related to the target user in response to an authorization operation of the target user.

[0116] In one embodiment, the rule matching modification unit may include:

[0117] The field extraction unit can be used to extract the fields of the data table contained in the database access instruction.

[0118] The identification adding unit can be used to obtain the identification information of the tenant database corresponding to the database access instruction, and add the identification information to the field containing the data table.

[0119] In one embodiment, the database determination module 802 may include:

[0120] The data table extraction unit can be used to extract the identification information of the data table contained in the database access instruction.

[0121] The data table retrieval unit may be used to retrieve whether there is a data table matching the identification information in the global database and / or the tenant database, and determine whether the database to be accessed is the global database or the tenant database according to the retrieval result.

[0122] In one embodiment, the data processing device may further include:

[0123] The change monitoring unit can be used to monitor whether data changes occur in the global database and the tenant database under the action of the database access instruction through the database change monitoring device or the data synchronization device.

[0124] The data synchronization unit can be used to synchronize the data change results to the analysis database when the global database or the tenant database is changed under the action of the database access instruction. The analysis database is used to analyze the data in the business system.

[0125] In one embodiment, the data processing device may further include:

[0126] The database establishment module can be used to respond to a lease request from a newly added tenant and establish a tenant database corresponding to the newly added tenant.

[0127] The tenant information synchronization module can be used to obtain tenant information of newly added tenants and update the tenant information table in the global database according to the obtained tenant information.

[0128] The data processing device provided in the embodiment of the present application can be used to execute the technical solution of the data processing method in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0129] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the first execution module 803 can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the first execution module 803. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0130] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device may include: a transceiver 91 , a processor 92 , and a memory 93 .

[0131] The processor 92 executes the computer execution instructions stored in the memory, so that the processor 92 executes the scheme in the above embodiment. The processor 92 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0132] The memory 93 is connected to the processor 92 via a system bus and completes communication between them. The memory 93 is used to store computer program instructions.

[0133] The transceiver 91 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.

[0134] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0135] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.

[0136] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the data processing method in the above embodiment.

[0137] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the data processing method of the above embodiment.

[0138] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, it can implement the technical solution of the data processing method in the above embodiment.

[0139] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0140] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0141] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0142] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0143] It should be understood that the above processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0144] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0145] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0146] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0147] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0148] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0149] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data processing method, It is characterized in that Applied to a business system, the business system includes multiple tenants, and the method includes: Get database access instructions related to business requests; Analyze the database access instruction to obtain a database to be accessed, the database to be accessed is a global database or a tenant database, the global database stores a tenant information table and data corresponding to the business system, the tenant information table contains tenant information of the tenant, and the tenant database stores data corresponding to the tenant; If the database to be accessed is a global database, executing the database access instruction on the global database to obtain data returned by the global database; If the database to be accessed is a tenant database, the database access instruction is modified according to the tenant information corresponding to the business request, and the modified database access instruction is executed on the tenant database to obtain the data returned by the tenant database. The tenant information corresponding to the business request is obtained according to the tenant information table.

2. The method according to claim 1, It is characterized in that The global database further stores access rules of the tenant database, and there is a corresponding relationship between the access rules and the tenant information. Modifying the database access instruction according to the tenant information corresponding to the business request includes: Extracting tenant information corresponding to the service request from the session state of the service request; The corresponding access rule is matched in the global database according to the corresponding relationship and the tenant information corresponding to the business request, and the database access instruction is modified according to the matched access rule.

3. The method according to claim 2, It is characterized in that The tenant information table also includes a list of users authorized by the tenant to access the corresponding tenant database, and before extracting the tenant information corresponding to the service request from the session state of the service request, it also includes: If the service request is generated based on an operation of a target user in the user list, acquiring tenant information of a target tenant corresponding to the target user from the global database according to the user list; In response to the authorization operation of the target user, the tenant information of the target tenant is recorded in the session state related to the target user.

4. The method according to claim 2 or 3, It is characterized in that The step of modifying the database access instruction according to the matched access rule includes: Extracting fields of a data table contained in the database access instruction; The identification information of the tenant database corresponding to the database access instruction is obtained, and the identification information is added to the field containing the data table.

5. The method according to any one of claims 1 to 3, It is characterized in that The step of analyzing the database access instruction to obtain a database to be accessed includes: Extracting identification information of the data table contained in the database access instruction; The global database and / or the tenant database are searched to see whether there is a data table matching the identification information, and the database to be accessed is determined to be a global database or a tenant database according to the search result.

6. The method according to any one of claims 1 to 3, It is characterized in that Also includes: Monitoring, by means of a database change monitoring device or a data synchronization device, whether data changes occur in the global database and the tenant database under the effect of the database access instruction; If data changes occur in the global database or the tenant database under the effect of the database access instruction, the result of the data change is synchronized to an analysis database, and the analysis database is used to analyze the data in the business system.

7. The method according to any one of claims 1 to 3, It is characterized in that Also includes: In response to a lease request from a newly added tenant, establishing a tenant database corresponding to the newly added tenant; The tenant information of the newly added tenant is obtained, and the tenant information table in the global database is updated according to the obtained tenant information.

8. A database access device, It is characterized in that Applied to a business system, the business system includes multiple tenants, and the device includes: The acquisition module is used to obtain database access instructions related to business requests; a database determination module, configured to analyze the database access instruction to obtain a database to be accessed, wherein the database to be accessed is a global database or a tenant database, wherein the global database stores a tenant information table and data corresponding to the business system, wherein the tenant information table contains tenant information of the tenant, and wherein the tenant database stores data corresponding to the tenant; A first execution module, configured to execute the database access instruction on a global database to obtain data returned by the global database when the database to be accessed is a global database; The second execution module is used to modify the database access instruction according to the tenant information corresponding to the business request when the database to be accessed is a tenant database, and execute the modified database access instruction on the tenant database to obtain the data returned by the tenant database, and the tenant information corresponding to the business request is obtained according to the tenant information table.

9. An electronic device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.

Citation Information

Cited By

  • Data management method and device, management system and medium

    CN120705134A