다음을 통해 공유


패브릭용 Microsoft Spark 유틸리티(MSSparkUtils)

Microsoft Spark 유틸리티(MSSparkUtils)는 일반적인 작업을 쉽게 할 수 있게 돕는 기본 제공 패키지입니다. MSSparkUtils를 사용하여 파일 시스템 작업을 하고, 환경 변수를 가져오고, Notebook을 서로 연결하고, 비밀을 사용할 수 있습니다. MSSparkUtils 패키지는 PySpark(Python) Scala, SparkR Notebook 및 Fabric 파이프라인에서 사용할 수 있습니다.

파일 시스템 유틸리티

mssparkutils.fs 는 ADLS(Azure Data Lake Storage) Gen2 및 Azure Blob Storage를 비롯한 다양한 파일 시스템으로 작업하기 위한 유틸리티를 제공합니다. Azure Data Lake Storage Gen2Azure Blob Storage에 대한 액세스를 적절하게 구성해야 합니다.

사용 가능한 메서드에 대한 개요를 보려면 다음 명령을 실행합니다.

from notebookutils import mssparkutils
mssparkutils.fs.help()

출력

mssparkutils.fs provides utilities for working with various FileSystems.

Below is overview about the available methods:

cp(from: String, to: String, recurse: Boolean = false): Boolean -> Copies a file or directory, possibly across FileSystems
mv(from: String, to: String, recurse: Boolean = false): Boolean -> Moves a file or directory, possibly across FileSystems
ls(dir: String): Array -> Lists the contents of a directory
mkdirs(dir: String): Boolean -> Creates the given directory if it does not exist, also creating any necessary parent directories
put(file: String, contents: String, overwrite: Boolean = false): Boolean -> Writes the given String out to a file, encoded in UTF-8
head(file: String, maxBytes: int = 1024 * 100): String -> Returns up to the first 'maxBytes' bytes of the given file as a String encoded in UTF-8
append(file: String, content: String, createFileIfNotExists: Boolean): Boolean -> Append the content to a file
rm(dir: String, recurse: Boolean = false): Boolean -> Removes a file or directory
exists(file: String): Boolean -> Check if a file or directory exists
mount(source: String, mountPoint: String, extraConfigs: Map[String, Any]): Boolean -> Mounts the given remote storage directory at the given mount point
unmount(mountPoint: String): Boolean -> Deletes a mount point
mounts(): Array[MountPointInfo] -> Show information about what is mounted
getMountPath(mountPoint: String, scope: String = ""): String -> Gets the local path of the mount point

Use mssparkutils.fs.help("methodName") for more info about a method.

MSSparkUtils는 Spark API와 동일한 방식으로 파일 시스템에서 작동합니다. 예를 들어 mssparkuitls.fs.mkdirs() 및 Fabric Lakehouse 사용량을 예로 들 수 있습니다.

사용법 HDFS 루트의 상대 경로 ABFS 파일 시스템의 절대 경로 드라이버 노드의 로컬 파일 시스템에 대한 절대 경로
비데폴트 레이크하우스 지원되지 않음 mssparkutils.fs.mkdirs("abfss://< container_name>@<storage_account_name.dfs.core.windows.net/<> new_dir>") mssparkutils.fs.mkdirs("file:/<new_dir>")
기본 레이크하우스 "Files" 또는 "Tables"의 디렉터리: mssparkutils.fs.mkdirs("Files/<new_dir>") mssparkutils.fs.mkdirs("abfss://< container_name>@<storage_account_name.dfs.core.windows.net/<> new_dir>") mssparkutils.fs.mkdirs("file:/<new_dir>")

파일 나열

디렉터리의 콘텐츠를 나열하려면 mssparkutils.fs.ls('디렉터리 경로')를 사용합니다. 예시:

mssparkutils.fs.ls("Files/tmp") # works with the default lakehouse files using relative path 
mssparkutils.fs.ls("abfss://<container_name>@<storage_account_name>.dfs.core.windows.net/<path>")  # based on ABFS file system 
mssparkutils.fs.ls("file:/tmp")  # based on local file system of driver node 

파일 속성 보기

이 메서드는 파일 이름, 파일 경로, 파일 크기 및 디렉터리 및 파일인지 여부를 비롯한 파일 속성을 반환합니다.

files = mssparkutils.fs.ls('Your directory path')
for file in files:
    print(file.name, file.isDir, file.isFile, file.path, file.size)

새 디렉터리 만들기

이 메서드는 지정된 디렉터리가 없는 경우 해당 디렉터리를 만들고 필요한 부모 디렉터리를 만듭니다.

mssparkutils.fs.mkdirs('new directory name')  
mssparkutils.fs. mkdirs("Files/<new_dir>")  # works with the default lakehouse files using relative path 
mssparkutils.fs.ls("abfss://<container_name>@<storage_account_name>.dfs.core.windows.net/<new_dir>")  # based on ABFS file system 
mssparkutils.fs.ls("file:/<new_dir>")  # based on local file system of driver node 

파일 복사

이 메서드는 파일 또는 디렉터리를 복사하고 파일 시스템에서 복사 작업을 지원합니다.

mssparkutils.fs.cp('source file or directory', 'destination file or directory', True)# Set the third parameter as True to copy all files and directories recursively

성능 복사 파일

이 메서드는 파일, 특히 대량의 데이터를 더 빠르게 복사하거나 이동하는 방법을 제공합니다.

mssparkutils.fs.fastcp('source file or directory', 'destination file or directory', True)# Set the third parameter as True to copy all files and directories recursively

파일 콘텐츠 미리 보기

이 메서드는 지정된 파일의 첫 번째 'maxBytes' 바이트를 UTF-8로 인코딩된 문자열로 반환합니다.

mssparkutils.fs.head('file path', maxBytes to read)

파일 이동

이 메서드는 파일 또는 디렉터리를 이동하고 파일 시스템 간 이동을 지원합니다.

mssparkutils.fs.mv('source file or directory', 'destination directory', True) # Set the last parameter as True to firstly create the parent directory if it does not exist
mssparkutils.fs.mv('source file or directory', 'destination directory', True, True) # Set the third parameter to True to firstly create the parent directory if it does not exist. Set the last parameter to True to overwrite the updates.

파일 쓰기

이 메서드는 지정된 문자열을 UTF-8로 인코딩된 파일에 씁니다.

mssparkutils.fs.put("file path", "content to write", True) # Set the last parameter as True to overwrite the file if it existed already

파일에 콘텐츠 추가

이 메서드는 지정된 문자열을 UTF-8로 인코딩된 파일에 추가합니다.

mssparkutils.fs.append("file path", "content to append", True) # Set the last parameter as True to create the file if it does not exist

파일 또는 디렉터리 삭제

이 메서드는 파일 또는 디렉터리를 제거합니다.

mssparkutils.fs.rm('file path', True) # Set the last parameter as True to remove all files and directories recursively

탑재/탑재 해제 디렉터리

파일 탑재 및 탑재 해제의 자세한 사용에 대한 자세한 정보를 찾습니다.

Notebook 유틸리티

MSSparkUtils Notebook 유틸리티를 사용하여 Notebook을 실행하거나 값이 있는 Notebook을 종료합니다. 사용 가능한 메서드에 관한 개요를 가져오려면 다음 명령을 실행합니다.

mssparkutils.notebook.help()

출력:


exit(value: String): void -> This method lets you exit a notebook with a value.
run(path: String, timeoutSeconds: int, arguments: Map): String -> This method runs a notebook and returns its exit value.

참고 항목

Notebook 유틸리티는 Apache Spark SJD(작업 정의)에 적용되지 않습니다.

Notebook 참조

이 메서드는 Notebook을 참조하고 종료 값을 반환합니다. Notebook 또는 파이프라인에서 중첩 함수 호출을 실행할 수 있습니다. 참조되는 Notebook은 이 함수를 호출하는 Notebook의 Spark 풀에서 실행됩니다.

mssparkutils.notebook.run("notebook name", <timeoutSeconds>, <parameterMap>, <workspaceId>)

예시:

mssparkutils.notebook.run("Sample1", 90, {"input": 20 })

패브릭 Notebook은 작업 영역 ID를 지정하여 여러 작업 영역에서 Notebook 참조를 지원합니다.

mssparkutils.notebook.run("Sample1", 90, {"input": 20 }, "fe0a6e2a-a909-4aa3-a698-0a651de790aa")

셀 출력에서 참조 실행의 스냅샷 링크를 열 수 있습니다. 스냅샷 코드 실행 결과를 캡처하고 참조 실행을 쉽게 디버그할 수 있습니다.

참조 실행 결과의 스크린샷.

스냅샷 예제의 스크린샷

참고 항목

  • 작업 영역 간 참조 Notebook은 런타임 버전 1.2 이상에서 지원됩니다.
  • Notebook 리소스 아래의 파일을 사용하는 경우 참조된 Notebook에서 대화 mssparkutils.nbResPath 형 실행과 동일한 폴더를 가리키는지 확인합니다.

참조는 여러 Notebook을 병렬로 실행합니다.

Important

이 기능은 미리 보기로 제공됩니다.

이 메서드 mssparkutils.notebook.runMultiple() 를 사용하면 여러 Notebook을 병렬로 실행하거나 미리 정의된 토폴로지 구조로 실행할 수 있습니다. API는 Spark 세션 내에서 다중 스레드 구현 메커니즘을 사용하고 있습니다. 즉, 참조 Notebook 실행에서 컴퓨팅 리소스를 공유합니다.

mssparkutils.notebook.runMultiple()로 다음을 수행할 수 있습니다.

  • 각 전자 필기장이 완료되는 것을 기다리지 않고 동시에 여러 Notebook을 실행합니다.

  • 간단한 JSON 형식을 사용하여 Notebook에 대한 종속성 및 실행 순서를 지정합니다.

  • Spark 컴퓨팅 리소스 사용을 최적화하고 패브릭 프로젝트의 비용을 절감합니다.

  • 출력에서 각 Notebook 실행 레코드의 스냅샷을 보고 Notebook 작업을 편리하게 디버그/모니터링합니다.

  • 각 임원 활동의 종료 값을 가져와 다운스트림 작업에 사용합니다.

mssparkutils.notebook.help("runMultiple")를 실행하여 예제 및 자세한 사용량을 찾을 수도 있습니다.

다음은 이 방법을 사용하여 Notebook 목록을 병렬로 실행하는 간단한 예제입니다.


mssparkutils.notebook.runMultiple(["NotebookSimple", "NotebookSimple2"])

루트 Notebook의 실행 결과는 다음과 같습니다.

전자 필기장 목록을 참조하는 스크린샷

다음은 토폴로지 구조를 사용하여 mssparkutils.notebook.runMultiple()Notebook을 실행하는 예제입니다. 이 메서드를 사용하여 코드 환경을 통해 Notebook을 쉽게 오케스트레이션할 수 있습니다.

# run multiple notebooks with parameters
DAG = {
    "activities": [
        {
            "name": "NotebookSimple", # activity name, must be unique
            "path": "NotebookSimple", # notebook path
            "timeoutPerCellInSeconds": 90, # max timeout for each cell, default to 90 seconds
            "args": {"p1": "changed value", "p2": 100}, # notebook parameters
        },
        {
            "name": "NotebookSimple2",
            "path": "NotebookSimple2",
            "timeoutPerCellInSeconds": 120,
            "args": {"p1": "changed value 2", "p2": 200}
        },
        {
            "name": "NotebookSimple2.2",
            "path": "NotebookSimple2",
            "timeoutPerCellInSeconds": 120,
            "args": {"p1": "changed value 3", "p2": 300},
            "retry": 1,
            "retryIntervalInSeconds": 10,
            "dependencies": ["NotebookSimple"] # list of activity names that this activity depends on
        }
    ]
}
mssparkutils.notebook.runMultiple(DAG, {"displayDAGViaGraphviz": False})

루트 Notebook의 실행 결과는 다음과 같습니다.

매개 변수가 있는 Notebook 목록을 참조하는 스크린샷

참고 항목

  • 여러 Notebook 실행의 병렬 처리 수준은 Spark 세션의 사용 가능한 총 컴퓨팅 리소스로 제한됩니다.
  • Notebook 활동의 msspakrutils.notebook.runMultiple() 상한은 50개이며 , 50개 이상의 Notebook 활동이 있으면 컴퓨팅 리소스 사용으로 인해 안정성 및 성능 문제가 발생할 수 있습니다. API에서 더 많은 Notebook 활동을 계속 사용하려는 경우 해결 방법으로 Spark 설정 'spark.notebookutils.runmultiple.limit'를 더 큰 값으로 설정할 수 있습니다. 연결된 환경에서 또는 %%configure 명령을 사용하여 Spark 속성을 설정할 수 있습니다.
  • 50개 이상의 Notebook 활동을 사용하려는 경우 스냅샷 및 진행률 표시줄 콘텐츠 크기가 총 Notebook 콘텐츠 크기 상한값을 초과하지 않도록 하려면 아래 명령을 실행하여 풍부한 UX 기능을 사용하지 않도록 설정하는 것이 좋습니다.
    com.microsoft.spark.notebook.common.Configs.notebookRunSnapshotEnabled = false
    

전자 필기장 종료

이 메서드는 값이 있는 Notebook을 종료합니다. Notebook 또는 파이프라인에서 중첩 함수 호출을 실행할 수 있습니다.

  • Notebook에서 exit() 함수를 대화형으로 호출하면 Fabric Notebook에서 예외를 throw하고, 후속 셀 실행을 건너뛰고, Spark 세션을 활성 상태로 유지합니다.

  • exit() 함수를 호출하는 파이프라인에서 Notebook을 오케스트레이션하면 Notebook 작업이 종료 값으로 반환되고 파이프라인 실행이 완료되고 Spark 세션이 중지됩니다.

  • 참조되는 Notebook에서 exit() 함수를 호출하면 Fabric Spark는 참조된 Notebook의 추가 실행을 중지하고 run() 함수를 호출하는 기본 Notebook에서 다음 셀을 계속 실행합니다. 예를 들어 Notebook1에는 세 개의 셀이 있으며 두 번째 셀에서 exit() 함수를 호출합니다. Notebook2에는 세 번째 셀에 5개의 셀과 호출 실행(notebook1) 이 있습니다. Notebook2를 실행하면 Exit() 함수를 누르면 Notebook1이 두 번째 셀에서 중지됩니다. Notebook2는 네 번째 셀과 다섯 번째 셀을 계속 실행합니다.

mssparkutils.notebook.exit("value string")

예시:

다음 두 개의 셀이 있는 Sample1 Notebook:

  • 셀 1은 기본값이 10으로 설정된 입력 매개 변수를 정의합니다.

  • 셀 2는 입력을 종료 값으로 사용하여 Notebook을 종료합니다.

exit 함수의 샘플 Notebook을 보여 주는 스크린샷.

기본값을 사용하여 다른 Notebook에서 Sample1을 실행할 수 있습니다.

exitVal = mssparkutils.notebook.run("Sample1")
print (exitVal)

출력:

Notebook executed successfully with exit value 10

다른 Notebook에서 Sample1실행하고 입력 값을 20으로 설정할 수 있습니다.

exitVal = mssparkutils.notebook.run("Sample1", 90, {"input": 20 })
print (exitVal)

출력:

Notebook executed successfully with exit value 20

자격 증명 유틸리티

MSSparkUtils 자격 증명 유틸리티를 사용하여 Azure Key Vault에서 액세스 토큰을 가져오고 비밀을 관리할 수 있습니다.

사용 가능한 메서드에 관한 개요를 가져오려면 다음 명령을 실행합니다.

mssparkutils.credentials.help()

출력:

getToken(audience, name): returns AAD token for a given audience, name (optional)
getSecret(keyvault_endpoint, secret_name): returns secret for a given Key Vault and secret name

토큰 가져오기

getToken은 지정된 대상 그룹 및 이름에 대한 Microsoft Entra 토큰을 반환합니다(선택 사항). 다음 목록에는 현재 사용 가능한 대상 그룹 키가 나와 있습니다.

  • 스토리지 대상 리소스: "스토리지"
  • Power BI 리소스: "pbi"
  • Azure Key Vault 리소스: "keyvault"
  • Synapse RTA KQL DB 리소스: "kusto"

다음 명령을 실행하여 토큰을 가져옵니다.

mssparkutils.credentials.getToken('audience Key')

사용자 자격 증명을 사용하여 비밀 가져오기

getSecret은 사용자 자격 증명을 사용하여 지정된 Azure Key Vault 엔드포인트 및 비밀 이름에 대한 Azure Key Vault 비밀을 반환합니다.

mssparkutils.credentials.getSecret('https://<name>.vault.azure.net/', 'secret name')

파일 탑재 및 분리

Fabric은 Microsoft Spark 유틸리티 패키지에서 다음과 같은 탑재 시나리오를 지원합니다. 탑재, 분리, getMountPath()및 mounts() API를 사용하여 모든 작업 노드(드라이버 노드 및 작업자 노드)에 원격 스토리지(ADLS Gen2)를 연결할 수 있습니다. 스토리지 탑재 지점이 배치된 후 로컬 파일 API를 사용하여 로컬 파일 시스템에 저장된 것처럼 데이터에 액세스합니다.

ADLS Gen2 계정을 탑재하는 방법

다음 예제에서는 Azure Data Lake Storage Gen2를 탑재하는 방법을 보여 줍니다. Blob Storage 탑재 방법도 비슷합니다.

이 예제에서는 storegen2라는 Data Lake Storage Gen2 계정이 하나 있고 계정에 Notebook Spark 세션에 탑재/테스트하려는 mycontainer라는 컨테이너가 하나 있다고 가정합니다.

탑재할 컨테이너를 선택할 위치를 보여 주는 스크린샷

mycontainer라는 컨테이너를 탑재하려면 먼저 mssparkutils에서 컨테이너에 액세스할 수 있는 권한이 있는지 여부를 검사 합니다. 현재 Fabric은 트리거 탑재 작업에 대해 accountKeysastoken이라는 두 가지 인증 방법을 지원합니다.

공유 액세스 서명 토큰 또는 계정 키를 통해 탑재

MSSparkUtils는 대상을 탑재하기 위한 매개 변수로 계정 키 또는 SAS(공유 액세스 서명) 토큰을 명시적으로 전달하도록 지원합니다.

보안상의 이유로 다음 스크린샷과 같이 계정 키 또는 SAS 토큰을 Azure Key Vault에 저장하는 것이 좋습니다. 그런 다음 mssparkutils.credentials.getSecret API를 사용하여 검색할 수 있습니다. Azure Key Vault에 대한 자세한 내용은 Azure Key Vault 관리 스토리지 계정 키 정보를 참조 하세요.

비밀이 Azure Key Vault에 저장되는 위치를 보여 주는 스크린샷

accountKey 메서드에 대한 샘플 코드:

from notebookutils import mssparkutils  
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
accountKey = mssparkutils.credentials.getSecret("<vaultURI>", "<secretName>")
mssparkutils.fs.mount(  
    "abfss://mycontainer@<accountname>.dfs.core.windows.net",  
    "/test",  
    {"accountKey":accountKey}
)

sastoken에 대한 샘플 코드:

from notebookutils import mssparkutils  
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
sasToken = mssparkutils.credentials.getSecret("<vaultURI>", "<secretName>")
mssparkutils.fs.mount(  
    "abfss://mycontainer@<accountname>.dfs.core.windows.net",  
    "/test",  
    {"sasToken":sasToken}
)

참고 항목

사용할 수 없는 경우 mssparkutils를 가져와야 할 수 있습니다.

from notebookutils import mssparkutils

탑재 매개 변수:

  • fileCacheTimeout: Blob은 기본적으로 120초 동안 로컬 임시 폴더에 캐시됩니다. 이 시간 동안 blobfuse는 파일이 최신 상태인지 여부를 검사 않습니다. 매개 변수를 설정하여 기본 시간 제한 시간을 변경할 수 있습니다. 로컬 파일과 원격 파일 간의 불일치를 방지하기 위해 여러 클라이언트가 동시에 파일을 수정하는 경우 캐시 시간을 단축하거나 0으로 변경하고 항상 서버에서 최신 파일을 가져오는 것이 좋습니다.
  • 제한 시간: 탑재 작업 시간 제한은 기본적으로 120초입니다. 매개 변수를 설정하여 기본 시간 제한 시간을 변경할 수 있습니다. 실행기가 너무 많거나 탑재 시간이 초과되는 경우 값을 늘리는 것이 좋습니다.

다음과 같은 매개 변수를 사용할 수 있습니다.

mssparkutils.fs.mount(
   "abfss://mycontainer@<accountname>.dfs.core.windows.net",
   "/test",
   {"fileCacheTimeout": 120, "timeout": 120}
)

참고 항목

보안상의 이유로 코드에 자격 증명을 저장하지 않는 것이 좋습니다. 자격 증명을 추가로 보호하기 위해 Notebook 출력에서 비밀을 수정합니다. 자세한 내용은 비밀 수정을 참조하세요.

레이크하우스를 탑재하는 방법

레이크하우스를 /test에 탑재하기 위한 샘플 코드:

from notebookutils import mssparkutils 
mssparkutils.fs.mount( 
 "abfss://<workspace_id>@msit-onelake.dfs.fabric.microsoft.com/<lakehouse_id>", 
 "/test"
)

mssparktuils fs API를 사용하여 탑재 지점 아래의 파일에 액세스

탑재 작업의 기본 목적은 고객이 로컬 파일 시스템 API를 사용하여 원격 스토리지 계정에 저장된 데이터에 액세스할 수 있도록 하는 것입니다. 탑재된 경로와 함께 mssparkutils fs API를 매개 변수로 사용하여 데이터에 액세스할 수도 있습니다. 이 경로 형식은 약간 다릅니다.

탑재 API를 사용하여 Data Lake Storage Gen2 컨테이너 mycontainer/test 에 탑재했다고 가정합니다. 로컬 파일 시스템 API를 사용하여 데이터에 액세스하는 경우 경로 형식은 다음과 같습니다.

/synfs/notebook/{sessionId}/test/{filename}

mssparkutils fs API를 사용하여 데이터에 액세스하려는 경우 getMountPath()를 사용하여 정확한 경로를 가져오는 것이 좋습니다.

path = mssparkutils.fs.getMountPath("/test")
  • 디렉터리 나열:

    mssparkutils.fs.ls(f"file://{mssparkutils.fs.getMountPath('/test')}")
    
  • 파일 콘텐츠 읽기:

    mssparkutils.fs.head(f"file://{mssparkutils.fs.getMountPath('/test')}/myFile.txt")
    
  • 디렉터리 만들기:

    mssparkutils.fs.mkdirs(f"file://{mssparkutils.fs.getMountPath('/test')}/newdir")
    

로컬 경로를 통해 탑재 지점 아래의 파일에 액세스

표준 파일 시스템을 사용하여 탑재 지점에서 파일을 쉽게 읽고 쓸 수 있습니다. Python 예제는 다음과 같습니다.

#File read
with open(mssparkutils.fs.getMountPath('/test2') + "/myFile.txt", "r") as f:
    print(f.read())
#File write
with open(mssparkutils.fs.getMountPath('/test2') + "/myFile.txt", "w") as f:
    print(f.write("dummy data"))

기존 탑재 지점을 검사 방법

mssparkutils.fs.mounts() API를 사용하여 모든 기존 탑재 지점 정보를 검사 수 있습니다.

mssparkutils.fs.mounts()

탑재 지점을 분리하는 방법

다음 코드를 사용하여 탑재 지점을 분리합니다(이 예제에서는/테스트 ).

mssparkutils.fs.unmount("/test")

알려진 제한 사항

  • 현재 탑재는 작업 수준 구성입니다. 탑재 지점이 있거나 사용할 수 없는 경우 탑재 API를 사용하여 검사 것이 좋습니다.

  • 분리 메커니즘은 자동이 아닙니다. 애플리케이션 실행이 완료되면 탑재 지점을 분리하고 디스크 공간을 해제하려면 코드에서 탑재 해제 API를 명시적으로 호출해야 합니다. 그렇지 않으면 애플리케이션 실행이 완료된 후에도 탑재 지점이 노드에 계속 존재합니다.

  • ADLS Gen1 스토리지 계정 탑재는 지원되지 않습니다.

레이크하우스 유틸리티

mssparkutils.lakehouse 는 Lakehouse 아티팩트를 관리하기 위해 특별히 조정된 유틸리티를 제공합니다. 이러한 유틸리티를 통해 사용자는 Lakehouse 아티팩트 만들기, 검색, 업데이트 및 삭제를 손쉽게 할 수 있습니다.

참고 항목

Lakehouse API는 런타임 버전 1.2 이상에서만 지원됩니다.

메서드 개요

다음은 다음에서 제공하는 mssparkutils.lakehouse사용 가능한 방법에 대한 개요입니다.

# Create a new Lakehouse artifact
create(name: String, description: String = "", workspaceId: String = ""): Artifact

# Retrieve a Lakehouse artifact
get(name: String, workspaceId: String = ""): Artifact

# Update an existing Lakehouse artifact
update(name: String, newName: String, description: String = "", workspaceId: String = ""): Artifact

# Delete a Lakehouse artifact
delete(name: String, workspaceId: String = ""): Boolean

# List all Lakehouse artifacts
list(workspaceId: String = ""): Array[Artifact]

사용 예

이러한 메서드를 효과적으로 활용하려면 다음 사용 예제를 고려하세요.

Lakehouse 아티팩트 만들기

artifact = mssparkutils.lakehouse.create("artifact_name", "Description of the artifact", "optional_workspace_id")

Lakehouse 아티팩트 검색

artifact = mssparkutils.lakehouse.get("artifact_name", "optional_workspace_id")

Lakehouse 아티팩트 업데이트

updated_artifact = mssparkutils.lakehouse.update("old_name", "new_name", "Updated description", "optional_workspace_id")

Lakehouse 아티팩트 삭제

is_deleted = mssparkutils.lakehouse.delete("artifact_name", "optional_workspace_id")

레이크하우스 아티팩트 나열

artifacts_list = mssparkutils.lakehouse.list("optional_workspace_id")

추가 정보

각 메서드 및 해당 매개 변수에 대한 자세한 내용은 함수를 활용합니다 mssparkutils.lakehouse.help("methodName") .

MSSparkUtils의 Lakehouse 유틸리티를 사용하면 Lakehouse 아티팩트를 관리하는 것이 더 효율적이고 패브릭 파이프라인에 통합되어 전반적인 데이터 관리 환경을 향상합니다.

원활한 Lakehouse 아티팩트 관리를 위해 이러한 유틸리티를 자유롭게 탐색하고 패브릭 워크플로에 통합하세요.

알려진 문제

1.2 이상의 런타임 버전을 사용하고 실행하는 mssparkutils.help()경우 나열된 fabricClient, 웨어하우스작업 영역 API 는 현재 지원되지 않으며 추가로 사용할 수 있습니다.