Databricks Lakehouse 入門
Gang Wang
Senior Data Scientist
$$
my_project/
|-- databricks.yml
|-- src/
| |-- etl_pipeline.py
| |-- data_quality.py
|-- resources/
| |-- jobs/
| | |-- nightly_etl.yml
| |-- pipelines/
| |-- sales_pipeline.yml
|-- tests/
|-- test_etl.py
$$
databricks.yml - 專案的「核心設定」檔src/ - 你的「筆記本與程式碼」resources/ - 「作業與 pipeline 定義」tests/ - 選用的「測試檔」bundle:
name: sales_analytics
workspace:
host: https://myworkspace.databricks.com
targets:
dev:
default: true
workspace:
root_path: /Users/me/dev
production:
workspace:
root_path: /Shared/production
permissions:
- level: CAN_MANAGE
group_name: data_engineers
$$

$$
resources:
jobs:
nightly_etl:
name: "Nightly ETL Pipeline"
schedule:
quartz_cron: "0 0 2 * * ?"
tasks:
- task_key: ingest
notebook_task:
notebook_path: src/etl.py
$$
| 指令 | 目的 |
|---|---|
bundle validate |
檢查設定是否有誤 |
bundle deploy |
部署到目標環境 |
bundle run |
觸發已部署的作業 |
bundle destroy |
移除已部署的資源 |
$$
# 部署前先驗證
databricks bundle validate
# 部署到 production
databricks bundle deploy \
--target production
# 觸發執行
databricks bundle run nightly_etl

$$
$$
databricks.yml 定義你的專案、目標與資源validate、deploy、run、destroyDatabricks Lakehouse 入門