Skip to main content

Volumes란?

💡 Volume 은 Unity Catalog에서 비테이블 파일(이미지, PDF, CSV, 모델 파일, 로그 등)을 관리하는 저장 공간입니다. 테이블이 행/열 구조의 데이터를 관리한다면, Volume은 파일 자체 를 관리합니다.
테이블과 동일한 카탈로그.스키마 체계에 속하므로, 동일한 권한 관리(GRANT/REVOKE)와 감사(Audit)가 적용됩니다.

Volume의 위치

수준오브젝트설명
catalog > schematables행/열 데이터
views
volumes파일 데이터
└ my_volumereports/report_2025.pdfPDF 파일
images/product_001.jpg이미지 파일
raw_data/orders_20250315.csvCSV 원시 데이터

파일 경로 형식

/Volumes/<catalog>/<schema>/<volume>/<path>

예시:
/Volumes/production/ecommerce/raw_files/orders/2025/03/data.csv

Volume 유형

유형설명데이터 위치
Managed VolumeDatabricks가 스토리지 위치를 자동 관리합니다Databricks 관리 경로
External Volume사용자가 지정한 외부 스토리지 경로를 사용합니다고객 지정 경로 (S3, ADLS)
-- Managed Volume 생성 (권장)
CREATE VOLUME production.ecommerce.raw_files
COMMENT '원본 파일 저장소';

-- External Volume 생성
CREATE EXTERNAL VOLUME production.ecommerce.external_data
LOCATION 's3://my-bucket/external-data/'
COMMENT '외부 스토리지 연결';

파일 조작

SQL로 파일 다루기

-- 파일 목록 조회
LIST '/Volumes/production/ecommerce/raw_files/';

-- 파일을 테이블로 읽기
SELECT * FROM read_files(
    '/Volumes/production/ecommerce/raw_files/orders/',
    format => 'csv',
    header => true
);

-- 파일에서 텍스트 추출 (AI)
SELECT ai_parse_document(
    '/Volumes/production/ecommerce/raw_files/contracts/agreement.pdf',
    'markdown'
) AS content;

Python으로 파일 다루기

# 파일 업로드
dbutils.fs.cp(
    "file:/tmp/report.pdf",
    "/Volumes/production/ecommerce/reports/report_2025.pdf"
)

# 파일 목록 조회
files = dbutils.fs.ls("/Volumes/production/ecommerce/raw_files/")
for f in files:
    print(f"{f.name}  {f.size} bytes")

# 파일 다운로드
dbutils.fs.cp(
    "/Volumes/production/ecommerce/reports/report.pdf",
    "file:/tmp/downloaded_report.pdf"
)

# pandas로 CSV 읽기
import pandas as pd
df = pd.read_csv("/Volumes/production/ecommerce/raw_files/data.csv")

REST API로 파일 업로드

# CLI로 파일 업로드
databricks fs cp ./local_file.csv /Volumes/production/ecommerce/raw_files/

# Volume의 파일 목록
databricks fs ls /Volumes/production/ecommerce/raw_files/

권한 관리

-- Volume 읽기 권한 부여
GRANT READ VOLUME ON VOLUME production.ecommerce.raw_files TO `analysts`;

-- Volume 쓰기 권한 부여
GRANT WRITE VOLUME ON VOLUME production.ecommerce.raw_files TO `data_engineers`;

-- 권한 확인
SHOW GRANTS ON VOLUME production.ecommerce.raw_files;

활용 시나리오

시나리오저장 파일처리 방법
RAG 문서 저장PDF, DOCX, 웹 페이지ai_parse_document로 파싱 → 청킹 → Vector Search
원본 데이터 수집CSV, JSON, ParquetAuto Loader로 읽어서 Delta 테이블에 적재
ML 모델 아티팩트모델 파일, 설정 파일MLflow 모델과 함께 관리
이미지/미디어상품 이미지, 의료 영상Spark로 배치 처리, ML 모델 입력
보고서/내보내기PDF 리포트, Excel 파일대시보드 결과를 파일로 내보내기