Updated on 2026-11-06 GMT+08:00

Configuring the UDF Deployment Workspace

Before using UDFs, you need to configure a temporary workspace required for UDF deployment.

Prerequisites

Example

import os
from aura_frame.multimodal import ai_lake

target_database = "test"
#Connect to the AuraJobV2 endpoint. For details about the parameters, see Establishing a Connection with the AuraJobV2 Endpoint.
con = ai_lake.connect(
    aura_endpoint=os.getenv("aura_endpoint"),         # Endpoint where the AuraJobV2 endpoint is located
    aura_endpoint_id=os.getenv("aura_endpoint_id"),    # AuraJobV2 endpoint ID
    aura_endpoint_name=os.getenv("aura_endpoint_name"),# AuraJobV2 endpoint name
    aura_workspace_id=os.getenv("aura_workspace_id"),  # Workspace ID
    lf_catalog_name=os.getenv("lf_catalog_name"),      # LakeFormation Catalog name
    access_key=os.getenv("access_key"),                # Access Key ID (AK)
    secret_key=os.getenv("secret_key"),                # Secret Key (SK)
    default_database=target_database,                       # LakeFormation database name
    use_single_cn_mode=True,   # Whether to enable the single-CN mode
    logging_level=logging.INFO # Set the log level.
)
try:
    con.set_function_staging_workspace(
        obs_directory_base=os.getenv("obs_directory_base"),  # Storage path for UDFs in OBS
        obs_bucket_name=os.getenv("obs_bucket_name"),        # OBS bucket name
        obs_server=os.getenv("obs_server"),                  # OBS endpoint
        access_key=os.getenv("access_key"),                  # Access Key ID (AK)
        secret_key=os.getenv("secret_key"),                  # Secret Key (SK)
    )
    print("The UDF deployment workspace has been configured.")
finally:
    con.close()
The parameters of set_function_staging_workspace() are as follows:
Table 1 Parameter description

Parameter

Description

Type

Default Value

obs_directory_base

Path for storing UDFs in the parallel file system.

str

None

obs_bucket_name

Name of the parallel file system.

str

None

obs_server

OBS access address. For details, see Endpoints and Domain Names.

For endpoint information of the specific connection, see Regions and Endpoints.

str

None

access_key

AK/SK. For details, see AK/SK Obtaining.

str

None

secret_key

str

None

security_token

Security token (required when a temporary AK/SK pair is used).

str

None

Helpful Links

Session APIs