Method and apparatus for creating a database in a data warehouse

By determining the database path in the data warehouse based on user identification information, the problem of poor data isolation in a multi-user environment is solved, and the secure isolation of user data in the data warehouse is achieved.

CN112181975BActive Publication Date: 2025-04-15BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201910604045.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-05
Publication Date
2025-04-15
Estimated Expiration
2039-07-05

AI Technical Summary

Technical Problem

Existing data warehouses are difficult to effectively isolate data from different users in a multi-user environment, resulting in impaired data security.

Method used

The path of the database in the data warehouse is determined through the user's identification information, and the encrypted identification information is used as the directory name to ensure that the data of each user is isolated from the data of other users.

Benefits of technology

It realizes data isolation between different users and enhances the security of user data in data warehouses in multi-user environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181975B_ABST
    Figure CN112181975B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure disclose a method and apparatus for creating a database in a data warehouse. A specific implementation of the method includes: in response to receiving a request for instructing to create a database in a data warehouse, obtaining identification information of a user who sends the request; determining the path of the database in the data warehouse according to the identification information, wherein different identification information corresponds to different paths; and creating the database at the location indicated by the determined path. This implementation achieves data isolation between data of different users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method and apparatus for storing data in a data warehouse. Background Art

[0002] A data warehouse is a collection of data that provides all types of data support for decision-making processes at all levels of an enterprise. Data warehouses are usually created for analytical reporting and decision support purposes. They can filter and integrate a variety of business data to guide business process improvements, monitor time, cost, quality, and control.

[0003] Currently, commonly used data warehouses include HIVE and Teradata data warehouse. HIVE is an open source data warehouse tool based on Hadoop, which can query and analyze data sets stored in HDFS (Hadoop Distributed File System). At the same time, HIVE also provides query functions to the outside world. Teradata data warehouse supports a large-scale parallel processing platform and can process massive amounts of data at high speed. Summary of the invention

[0004] The embodiments of the present disclosure provide a method and apparatus for creating a database in a data warehouse.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for creating a database in a data warehouse, the method comprising: in response to receiving a request for instructing to create a database in the data warehouse, obtaining identification information of a user who sends the request; determining a path of the database in the data warehouse based on the identification information, wherein different identification information corresponds to different paths; and creating the database at the location indicated by the determined path.

[0006] In some embodiments, the identification information includes a user name and a user instance name, wherein the user instance indicated by the user instance name is an instance of the user indicated by the user name.

[0007] In some embodiments, based on the identification information, determining the path of the database in the data warehouse includes: obtaining the path of the data warehouse for storing data as the root directory; based on the identification information, determining the subdirectory under the root directory, wherein different identification information corresponds to different subdirectories; based on the subdirectory, determining the path of the database, wherein the path of the database includes the path of the subdirectory.

[0008] In some embodiments, determining a subdirectory under a root directory based on identification information includes: encrypting the identification information to obtain encrypted identification information; and determining the subdirectory using the encrypted identification information as the name of the subdirectory.

[0009] In some embodiments, based on the identification information, a subdirectory is determined under the root directory, including: encrypting the user name to obtain the encrypted user name; using the encrypted user name as the name of the subdirectory, and determining the subdirectory as the first subdirectory; and based on the subdirectory, determining the path of the database, including: encrypting the user instance name to obtain the encrypted user instance name; using the encrypted user instance name as the name of the subdirectory, determining a subdirectory of the first subdirectory as the second subdirectory, and determining the path where the second subdirectory is located as the path of the database.

[0010] In some embodiments, the above method also includes: in response to receiving a request for indicating access to data in a data warehouse, determining whether the user sending the request has the corresponding access rights; in response to determining that the user sending the request does not have the corresponding access rights, sending a prompt message to prompt the user sending the request that the user does not have the corresponding access rights.

[0011] In some embodiments, after creating the database at the location indicated by the determined path, the method further includes: constructing a correspondence between the user instance indicated by the user instance name and the database.

[0012] In some embodiments, after creating a database at the location indicated by the determined path, the method further includes: recording update information of the user instance indicated by the user instance name, wherein the update information includes an update time of the user instance indicated by the user instance name.

[0013] In a second aspect, an embodiment of the present disclosure provides a device for creating a database in a data warehouse, the device comprising: an acquisition unit, configured to, in response to receiving a request for instructing to create a database in the data warehouse, acquire identification information of a user who sends a request; a first determination unit, configured to determine a path of the database in the data warehouse based on the identification information, wherein different identification information corresponds to different paths; and a creation unit, configured to create the database at the location indicated by the determined path.

[0014] In some embodiments, the identification information includes a user name and a user instance name, wherein the user instance indicated by the user instance name is an instance of the user indicated by the user name.

[0015] In some embodiments, the first determination unit is further configured to: obtain the path of the data warehouse for storing data as the root directory; determine the subdirectory under the root directory based on the identification information, wherein different identification information corresponds to different subdirectories; determine the path of the database based on the subdirectory, wherein the path of the database includes the path where the subdirectory is located.

[0016] In some embodiments, the first determining unit is further configured to: encrypt the identification information to obtain the encrypted identification information; and determine the sub-directory using the encrypted identification information as the name of the sub-directory.

[0017] In some embodiments, the first determination unit is further configured to: encrypt the user name to obtain an encrypted user name; use the encrypted user name as the name of the subdirectory, and determine the subdirectory as the first subdirectory; encrypt the user instance name to obtain an encrypted user instance name; use the encrypted user instance name as the name of the subdirectory, determine the subdirectory of the first subdirectory as the second subdirectory, and determine the path where the second subdirectory is located as the path of the database.

[0018] In some embodiments, the above-mentioned device also includes: a second determination unit, configured to determine whether the user sending the request has the corresponding access permission in response to receiving a request for indicating access to data in a data warehouse; and a sending unit, configured to send a prompt message for prompting the user sending the request that does not have the corresponding access permission in response to determining that the user sending the request does not have the corresponding access permission.

[0019] In some embodiments, the above-mentioned apparatus further includes: a construction unit configured to construct a correspondence between the user instance indicated by the user instance name and the database.

[0020] In some embodiments, the above-mentioned apparatus further includes: a recording unit configured to record update information of the user instance indicated by the user instance name, wherein the update information includes an update time of the user instance indicated by the user instance name.

[0021] In a third aspect, an embodiment of the present disclosure provides a server, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.

[0022] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.

[0023] The method and apparatus for creating a database in a data warehouse provided by the embodiments of the present disclosure determine the path of the database created by the user in the data warehouse through the user's identification information, and the paths of the databases corresponding to different identification information are different, so that the paths of the databases of different users are different, that is, each user's data is isolated from the data of other users, thereby ensuring the isolation of data between different users and enhancing the security of user data stored in the data warehouse in a multi-user environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0025] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;

[0026] Figure 2 is a flowchart of an embodiment of a method for creating a database in a data warehouse according to the present disclosure;

[0027] Figure 3 is a schematic diagram of an application scenario of a method for creating a database in a data warehouse according to an embodiment of the present disclosure;

[0028] Figure 4 is a flowchart of another embodiment of a method for creating a database in a data warehouse according to the present disclosure;

[0029] Figure 5 is a structural schematic diagram of an embodiment of an apparatus for creating a database in a data warehouse according to the present disclosure;

[0030] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION

[0031] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0032] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0033] Figure 1 An exemplary architecture 100 is shown to which an embodiment of a method for creating a database in a data warehouse or an apparatus for creating a database in a data warehouse of the present disclosure can be applied.

[0034] like Figure 1As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a data warehouse 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the data warehouse 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables.

[0035] The terminal devices 101 , 102 , and 103 can access the data warehouse 105 through the network 104 based on a command line or a Web method to implement operations such as creating a corresponding database or querying data in the data warehouse 105 .

[0036] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers and desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.

[0037] The data warehouse 105 may be deployed in the cloud. The data warehouse 105 may be various data warehouses, such as HIVE, Teradata data warehouse, etc. The data warehouse 105 may receive a request sent by the terminal devices 101, 102, 103 to instruct the creation of a database, and determine the path of the database corresponding to the terminal devices 101, 102, 103 in the data warehouse according to the received request, and then create the database at the location indicated by the determined path.

[0038] It should be noted that the method for creating a database in a data warehouse provided in the embodiments of the present disclosure is generally executed by the data warehouse 105 , and accordingly, the device for creating a database in a data warehouse is generally arranged in the data warehouse 105 .

[0039] It should be noted that the data warehouse 105 can be hardware or software. When the data warehouse 105 is hardware, it can be implemented based on a distributed server cluster composed of multiple servers, or a single server. When the data warehouse 105 is software, it can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.

[0040] It should be understood that Figure 1 The number of terminal devices and networks in the embodiment is only for illustration. Any number of terminal devices and networks may be provided according to implementation requirements.

[0041] Continue to refer Figure 2 , which shows a process 200 of an embodiment of a method for creating a database in a data warehouse according to the present disclosure. The method for creating a database in a data warehouse includes the following steps:

[0042] Step 201: in response to receiving a request for instructing to create a database in a data warehouse, obtaining identification information of a user who sends the request.

[0043] In this embodiment, the execution body (such as Figure 1 When the data warehouse 105 shown receives a request for instructing to create a database in the data warehouse, it can obtain the identification information of the user who sent the request.

[0044] In different application scenarios, different data warehouses may have different access methods, so the method in which a user sends a request for instructing to create a database in the data warehouse may also be different.

[0045] For example, a user can use a terminal device (such as Figure 1 The terminal devices 101, 102, and 103 shown in the figure send a command line command through a command line interface to send a request for instructing to create a database in the data warehouse. For another example, a user can use a terminal device based on a Web interaction mode to send a request for instructing to create a database in the data warehouse by operating an interactive portal provided by a web page.

[0046] The identification information may be any information that can be used to identify a user. For example, the identification information may include a user name. Since different users usually have different user names, the user name may be used as the user's identification information to distinguish different users.

[0047] Generally, a user may send a request to the execution subject through a terminal device. Therefore, the execution subject may distinguish the user according to the sender of the received request, and further obtain the identification information of the user.

[0048] In some optional implementations of this embodiment, the identification information may include a user name and a user instance name. The user instance indicated by the user instance name may be an instance of the user indicated by the corresponding user name. In other words, a user may have one or more user instances.

[0049] Generally, a user can create one or more user instances according to actual application requirements. Therefore, using both the user name and the user instance name as identification information can achieve differentiation of user instance levels.

[0050] Step 202: Determine the path of the database in the data warehouse according to the identification information.

[0051] In this embodiment, the paths of the databases corresponding to different identification information may be different. Thus, the paths of the databases of different users in the data warehouse may be different. Of course, when the identification information includes the user name and the user instance name, not only the paths of the databases of different users in the data warehouse may be different, but also the paths of the databases of different user instances of the same user in the data warehouse may be different.

[0052] The names of the directories at all levels included in the paths of different users' databases in the data warehouse can be determined flexibly using various methods. For example, the directory name indicated by the user can be received, or the directory name can be determined by the above-mentioned execution subject. For another example, the above-mentioned execution subject can determine the root directory name, and the directory name indicated by the user can be received as the name of the subdirectory of the root directory.

[0053] Step 203: Create a database at the location indicated by the determined path.

[0054] In this embodiment, after determining the path of the database corresponding to the above identification information, if the path already exists in the data warehouse, the database can be directly created at the location indicated by the path. If the path does not exist in the data warehouse, the path can be created first, and then the database can be created at the location indicated by the path.

[0055] In some optional implementations of this embodiment, the path of the database in the data warehouse may be determined according to the identification information through the following steps:

[0056] Step 1: Get the path of the data warehouse used to store data as the root directory.

[0057] In this step, the path of the data warehouse for storing data may refer to a storage path preset by the data warehouse. For example, in some cases, some data warehouses may pre-specify a unified path and control all users' data to use the specified path as the root directory.

[0058] Taking HIVE data warehouse as an example, a unified data storage path is usually pre-specified in the configuration file "hive-site.xml". For example, the configuration in the configuration file is as follows:

[0059]

[0060]

[0061] It can be seen that the value of the "hive.metastore.warehouse.dir" property in the configuration file is "hdfs: / / prod". That is, "hdfs: / / prod" is used as the unified data storage path. At this time, "hdfs: / / prod" can be determined as the root directory.

[0062] Step 2: Determine the subdirectory under the root directory based on the identification information.

[0063] In this step, the subdirectories corresponding to different identification information may be different, so that the paths of the subdirectories corresponding to different users may be different. The names of the subdirectories corresponding to different identification information may be determined flexibly using various methods. For example, the name of the subdirectory indicated by the user may be received, or the name of the subdirectory may be determined by the above-mentioned execution subject.

[0064] Optionally, the identification information may be used as the name of the subdirectory. Taking the identification information as a user name as an example, each user name may be directly used as the name of the subdirectory corresponding to each user.

[0065] Optionally, the identification information may be encrypted first to obtain the encrypted identification information, and then the encrypted identification information may be used as the name of the subdirectory. Various encryption algorithms may be flexibly selected to encrypt the identification information, for example, the Message Digest Algorithm MD5.

[0066] It should be understood that if there is a corresponding subdirectory under the root directory, the existing subdirectory can be determined as the subdirectory corresponding to the identification information. If there is no corresponding subdirectory under the root directory, a subdirectory can be created with the name of the determined subdirectory.

[0067] Step three: determine the path of the database based on the determined subdirectory.

[0068] In this step, the path of the database may include the path where the subdirectory is located.

[0069] Optionally, the path where the subdirectory is located can be used as the database path.

[0070] Optionally, when the identification information includes a user name and a user instance name, in the above step 2, a subdirectory may be first determined as the first subdirectory according to the user name. Then, a subdirectory of the first subdirectory may be determined as the second subdirectory according to the user instance name. Thereafter, a path where the second subdirectory is located may be determined as the path of the database in the data warehouse.

[0071] For example, the user name may be used as the name of the subdirectory to determine the subdirectory as the first subdirectory. Then, the user instance name may be used as the name of the subdirectory of the first subdirectory to determine the subdirectory of the first subdirectory as the second subdirectory. At this time, the path where the second subdirectory is located may be determined as the path of the database.

[0072] Optionally, the user name may be encrypted first to obtain an encrypted user name. Then, the encrypted user name may be used as the name of the subdirectory to determine the subdirectory as the first subdirectory. Afterwards, the user instance name may be encrypted to obtain an encrypted user instance name. Afterwards, the encrypted user instance name may be used as the name of the subdirectory to determine the subdirectory of the first subdirectory as the second subdirectory. At this point, the path where the second subdirectory is located may be determined as the path of the database.

[0073] By using the encrypted user name or encrypted user instance name as the name of the subdirectory, the security of user data in the data warehouse can be further enhanced.

[0074] In some optional implementations of this embodiment, after creating a database, a correspondence between the user instance indicated by the user instance name and the database can be constructed. For example, a correspondence between the identification information of the user instance indicated by the user instance name and the identification information of the database can be stored in a data table. The identification information of the user instance and the identification information of the database can be generated by the above-mentioned execution subject.

[0075] Optionally, a correspondence between a user instance and a corresponding user can be established, etc. Specifically, a data table can be designed according to actual application requirements to maintain the correspondence between a user instance and a database, a user instance and a user, etc., which helps to achieve better user management.

[0076] In some optional implementations of this embodiment, after the database is created, update information of the user instance indicated by the user instance name may be recorded, wherein the update information may include the update time of the user instance indicated by the user instance name.

[0077] It is understandable that if the user instance corresponding to the created database is newly created, then a new record of the user instance is added, and the creation time of the user instance is recorded.

[0078] Continue to see Figure 3 , Figure 3 FIG. 3 is a schematic diagram 300 of an application scenario of the method for creating a database in a data warehouse according to this embodiment. Figure 3 In the application scenario, user instance A1 and user instance A2 of user A, and user instance B1 of user B are taken as examples for description.

[0079] If user instance A1 sends a request to create a database, the data warehouse's unified data storage address "hdfs: / / prod" can be used as the root directory. At the same time, the MD5 encryption algorithm can be used to encrypt user A, and the encrypted result "MD5(user A)" can be used as a subdirectory of "hdfs: / / prod". After that, the MD5 encryption algorithm can be used to encrypt user instance A1, and the encrypted result "MD5(user instance A1)" can be used as a subdirectory of "MD5(user A)". In this way, the database of user instance A1 can be created at the location indicated by the path "hdfs: / / prod / MD5(user A) / MD5(user instance A1)".

[0080] Similarly, if user instance A2 sends a request to create a database, the address "hdfs: / / prod" for the unified data storage of the data warehouse can be used as the root directory. At the same time, the MD5 encryption algorithm can be used to encrypt user A, and the encrypted result "MD5(user A)" can be used as a subdirectory of "hdfs: / / prod". After that, the MD5 encryption algorithm can be used to encrypt user instance A2, and the encrypted result "MD5(user instance A2)" can be used as a subdirectory of "MD5(user A)". Thus, the database of user instance A2 can be created at the location indicated by the path "hdfs: / / prod / MD5(user A) / MD5(user instance A2)".

[0081] Similarly, if user instance B1 sends a request to create a database, the address "hdfs: / / prod" for the unified data storage of the data warehouse can be used as the root directory. At the same time, the MD5 encryption algorithm can be used to encrypt user B, and the encryption result "MD5(user B)" can be used as a subdirectory of "hdfs: / / prod". After that, the MD5 encryption algorithm can be used to encrypt user instance B1, and the encryption result "MD5(user instance B1)" can be used as a subdirectory of "MD5(user B)". Thus, the database of user instance B1 can be created at the location indicated by the path "hdfs: / / prod / MD5(user B) / MD5(user instance B1)".

[0082] The method provided by the above embodiment of the present disclosure distinguishes the paths of databases of different users in the data warehouse, thereby isolating the data of different users. This can also avoid the problem that databases of different users have the same path in the data warehouse, which leads to the problem that different users cannot build databases with the same name. It can also prevent malicious users from obtaining other users' data by means of database collision, thereby enhancing the security of each user's data stored in the data warehouse.

[0083] Further references Figure 4 , which shows a process 400 of another embodiment of a method for creating a database in a data warehouse. The process 400 of the method for creating a database in a data warehouse includes the following steps:

[0084] Step 401: in response to receiving a request for instructing to create a database in a data warehouse, obtaining identification information of a user who sends the request.

[0085] Step 402: Determine the path of the database in the data warehouse according to the identification information.

[0086] Step 403: Create a database at the location indicated by the determined path.

[0087] The specific execution process of the above steps 401, 402 and 403 can be referred to Figure 2 The relevant descriptions of steps 201, 202 and 203 in the corresponding embodiment are not repeated here.

[0088] Step 404: In response to receiving a request for accessing data in the data warehouse, determining whether the user sending the request has corresponding access rights.

[0089] In this embodiment, the user can perform various operations on the data in the data warehouse during the use of the data warehouse. For example, through instructions (such as SQL instructions), query the data in the specified database, delete the specified database, etc. Among them, the user can send instructions through the command line to send a request for instructing to access the data in the data warehouse, and can also send a request for instructing to access the data in the data warehouse based on the interactive interface provided in a Web manner.

[0090] In this embodiment, different users may have different access rights. It is understandable that if a user may have one or more user instances, different user instances may also have different access rights.

[0091] Optionally, a correspondence between a user and a corresponding access authority may be pre-stored. In this case, whether the user has the corresponding access authority may be determined based on the pre-stored correspondence.

[0092] Step 405: In response to determining that the user sending the request does not have the corresponding access authority, a prompt message is sent to prompt that the user sending the request does not have the corresponding access authority.

[0093] In this embodiment, when it is determined that the user does not have the corresponding access authority, a prompt message may be sent to the user to prompt the user that the user does not have the corresponding access authority, thereby ensuring the security of the data in the data warehouse.

[0094] Still taking HIVE data warehouse as an example, the existing HIVE data warehouse has a relatively simple design for user access rights to data. Based on this, the HIVE data warehouse can be updated according to actual application requirements to achieve a user rights design with a higher security level. Among them, when implementing a new user rights design for the HIVE data warehouse, the low coupling between the implementation logic corresponding to the new user rights and the various processing logics of the HIVE data warehouse can be controlled to enhance the reliability and flexibility of the updated HIVE data warehouse.

[0095] Since data warehouses usually have a large number of users and the user data may also be massive, data security is an aspect that needs to be considered when using data warehouses. Figure 2 On the basis of the corresponding embodiments, permission control for various data access requests of users is added, thereby improving the security of the data of each user in the data warehouse.

[0096] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for creating a database in a data warehouse. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0097] like Figure 5 As shown, the apparatus 500 for creating a database in a data warehouse provided by this embodiment includes an acquisition unit 501, a first determination unit 502, and a creation unit 503. The acquisition unit 501 is configured to, in response to receiving a request for instructing to create a database in the data warehouse, acquire identification information of a user who sends the request; the first determination unit 502 is configured to determine the path of the database in the data warehouse according to the identification information, wherein different identification information corresponds to different paths; and the creation unit 503 is configured to create a database at a location indicated by the determined path.

[0098] In the apparatus 500 for creating a database in a data warehouse in this embodiment, the specific processing of the acquisition unit 501, the first determination unit 502 and the creation unit 503 and the technical effects thereof can be referred to respectively. Figure 2 The relevant descriptions of step 201, step 202 and step 203 in the corresponding embodiment are not repeated here.

[0099] In some optional implementations of this embodiment, the identification information includes a user name and a user instance name, wherein the user instance indicated by the user instance name is an instance of the user indicated by the user name.

[0100] In some optional implementations of this embodiment, the first determination unit 502 is further configured to: obtain a path of the data warehouse for storing data as a root directory; determine a subdirectory under the root directory based on identification information, wherein different identification information corresponds to different subdirectories; and determine a path of the database based on the subdirectory, wherein the path of the database includes the path of the subdirectory.

[0101] In some optional implementations of this embodiment, the first determining unit 502 is further configured to: encrypt the identification information to obtain the encrypted identification information; and determine the subdirectory using the encrypted identification information as the name of the subdirectory.

[0102] In some optional implementations of the present embodiment, the first determination unit 502 is further configured to: encrypt the user name to obtain an encrypted user name; use the encrypted user name as the name of the subdirectory, and determine the subdirectory as the first subdirectory; encrypt the user instance name to obtain an encrypted user instance name; use the encrypted user instance name as the name of the subdirectory, determine the subdirectory of the first subdirectory as the second subdirectory, and determine the path where the second subdirectory is located as the path of the database.

[0103] In some optional implementations of the present embodiment, the above-mentioned device 500 for creating a database in a data warehouse also includes: a second determination unit (not shown in the figure) is configured to determine whether the user sending the request has the corresponding access rights in response to receiving a request for indicating access to data in the data warehouse; and a sending unit (not shown in the figure) is configured to send a prompt message for prompting the user sending the request that the user does not have the corresponding access rights in response to determining that the user sending the request does not have the corresponding access rights.

[0104] In some optional implementations of this embodiment, the above-mentioned device further includes: a construction unit (not shown in the figure) configured to construct a correspondence between the user instance indicated by the user instance name and the database.

[0105] In some optional implementations of this embodiment, the above-mentioned device also includes: a recording unit (not shown in the figure) is configured to record update information of the user instance indicated by the user instance name, wherein the update information includes the update time of the user instance indicated by the user instance name.

[0106] The device provided by the above-mentioned embodiment of the present disclosure obtains the identification information of the user who sends the request in response to receiving a request for instructing to create a database in a data warehouse through an acquisition unit; the first determination unit determines the path of the database in the data warehouse based on the identification information, wherein different paths correspond to different identification information; the creation unit creates the database at the position indicated by the determined path, thereby making the paths of the databases of different users different, that is, isolating the data of each user from the data of other users, ensuring the isolation of data between different users, and enhancing the security of user data stored in the data warehouse in a multi-user environment.

[0107] Reference below Figure 6 , which shows an electronic device (eg, Figure 1 A schematic diagram of the structure of the server in (a) 600. Figure 6 The server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0108] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0109] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0110] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0111] It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0112] The computer-readable medium may be included in the server; or it may exist independently without being installed in the server. The computer-readable medium carries one or more programs. When the one or more programs are executed by the server, the server: in response to receiving a request for instructing to create a database in a data warehouse, obtains identification information of the user who sends the request; determines the path of the database in the data warehouse according to the identification information, wherein different identification information corresponds to different paths; and creates the database at the location indicated by the determined path.

[0113] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0114] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0115] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be arranged in a processor, for example, may be described as: a processor includes an acquisition unit, a first determination unit, and a creation unit. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the acquisition unit may also be described as "a unit that acquires identification information of the user who sends the request in response to receiving a request for indicating the creation of a database in a data warehouse."

[0116] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.

Claims

1. A method for creating a database in a data warehouse, comprising: In response to receiving a request for instructing to create a database in a data warehouse, obtaining identification information of a user who sends the request, the identification information including a user name and a user instance name, wherein the user instance indicated by the user instance name is an instance of the user indicated by the user name; Determining the path of the database in the data warehouse according to the identification information includes: obtaining a path of the data warehouse for storing data as a root directory; determining a subdirectory under the root directory according to the identification information includes: encrypting the user name to obtain an encrypted user name; using the encrypted user name as the name of the subdirectory, determining the subdirectory as a first subdirectory, wherein different identification information corresponds to different subdirectories; determining the path of the database according to the subdirectory includes: encrypting the user instance name to obtain an encrypted user instance name; using the encrypted user instance name as the name of the subdirectory, determining a subdirectory of the first subdirectory as a second subdirectory, and determining the path where the second subdirectory is located as the path of the database, wherein the path of the database includes the path where the subdirectory is located, and different identification information corresponds to different paths; The database is created at the location indicated by the determined path.

2. The method according to claim 1, wherein: Determining a subdirectory under the root directory according to the identification information includes: Encrypting the identification information to obtain encrypted identification information; The encrypted identification information is used as the name of the sub-directory to determine the sub-directory.

3. The method according to claim 1, wherein: The method further comprises: In response to receiving a request for accessing data in the data warehouse, determining whether a user sending the request has corresponding access rights; In response to determining that the user sending the request does not have the corresponding access authority, prompt information is sent to prompt that the user sending the request does not have the corresponding access authority.

4. The method according to claim 1, wherein: After creating the database at the location indicated by the determined path, the method further comprises: A correspondence between the user instance indicated by the user instance name and the database is constructed.

5. The method according to claim 1, wherein: After creating the database at the location indicated by the determined path, the method further comprises: Record update information of the user instance indicated by the user instance name, wherein the update information includes an update time of the user instance indicated by the user instance name.

6. An apparatus for creating a database in a data warehouse, comprising: an acquisition unit, configured to, in response to receiving a request for instructing to create a database in a data warehouse, acquire identification information of a user who sends the request, the identification information comprising a user name and a user instance name, wherein the user instance indicated by the user instance name is an instance of the user indicated by the user name; The first determination unit is configured to determine the path of the database in the data warehouse according to the identification information, including: obtaining the path of the data warehouse for storing data as a root directory; determining a subdirectory under the root directory according to the identification information, including: encrypting the user name to obtain the encrypted user name; using the encrypted user name as the name of the subdirectory, determining the subdirectory as a first subdirectory, wherein different identification information corresponds to different subdirectories; determining the path of the database according to the subdirectory, including: encrypting the user instance name to obtain the encrypted user instance name; using the encrypted user instance name as the name of the subdirectory, determining a subdirectory of the first subdirectory as a second subdirectory, and determining the path where the second subdirectory is located as the path of the database, wherein the path of the database includes the path where the subdirectory is located, and different identification information corresponds to different paths; A creating unit is configured to create the database at a location indicated by the determined path.

7. A server, comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method for isolating data in multi-tenant architecture

    CN102708316A

  • System, device and method for isolating multi-tenant data

    CN107203575A

  • Database deployment method and device and storage equipment

    CN109840094A