Updated on 2024-02-02 GMT+08:00

Managing Databases

Multiple databases can be created under a LakeFormation catalog. Centralized metadata management can maximize the value of data assets.

Prerequisites

  • A LakeFormation instance has been created and is running properly.
  • A catalog has been created.
  • You have created an OBS parallel file system for storing databases by referring to Creating a Metadata Storage Path.

Create a Database

  1. Log in to the LakeFormation console.
  2. In the upper left corner, click and choose Analytics > LakeFormation to access the LakeFormation console.
  3. Select the LakeFormation instance to be operated from the drop-down list on the left and choose Metadata > Database in the navigation pane.
  4. Select the name of the desired catalog from the Catalog drop-down list box in the upper right corner. You can view the databases contained in this catalog.
  5. Click Create.

    1. In the Basic Information area, set the related parameters.
      Table 1 Parameters for creating a database

      Parameter

      Description

      Database Name

      Enter a database name.

      The value should contain 1 to 128 characters. Only letters, numbers, and underscores (_) are allowed.

      Catalog

      Select the name of the catalog to which the database to be created belongs.

      Select Location

      Select a location where the database information is stored in the OBS parallel file system.

      Click , select a location, and click OK.

      • The selected location must start with obs:// and must contain one storage object. For example, select obs://lakeformation-test/catalog1/database1. If no suitable parallel file system is available, click go to OBS and create one.
      • The path must be different from the storage path of its catalog (the one specified by Select Location on the catalog creation page).
      • If a database storage path is added for the catalog to which the database belongs, set this parameter to the subpath of the database storage path or that of the path specified by Select Location during catalog creation.

      Description

      Description of the created database.

      The content length must be between 0 and 4000 bytes (3 bytes per Chinese character).

    2. (Optional) Click Add under Data Table Storage Locations. On the Add Table Storage Location page, click to manually select a database storage path as required. Click OK.

      Click to add more storage paths. Click to delete a storage path.

      • Selecting data table storage path is an optional operation.
      • The data table storage path can be set to the catalog path and its subpaths, or database storage location path and its subpaths.
      • If a data table storage path is added, the tables in this database must be the subpath of the data table storage path or that of the selected database location path.
    3. (Optional) Click Add under Function Storage Locations. On the Add Function Storage Location page, click to manually select a function storage path as required. Click OK.

      Click to add more storage paths. Click to delete a storage path.

      • Selecting function storage path is an optional operation.
      • The function storage path can be set to the catalog path and its subpaths, or database storage location path and its subpaths.
      • If a function storage path is added, the functions in this database must be the subpath of the function storage path or that of the selected database location path.
    4. Click Submit.

  6. After the database is created, you can view the database name/ID, catalog, owner, and storage location on the Database page.

    Click Modify in the Operation column to modify the configurations of a database.

    Click Table in the Operation column to view the tables in a database.

    Click More to authorize or delete a database, or view the permissions of a database.

    If files are deleted when metadata is deleted, the system processes the files based on the deletion policy that you have configured. For how to configure a deletion policy, see Configuring Metadata Lifecycle. If no deletion policy is configured, data is moved to the recycle bin (OBS path lake-formation-trash-dir/table_id) by default.