In einem Asset-Bundle

Einführung in das Databricks Lakehouse

Gang Wang

Senior Data Scientist

Bundle-Projektstruktur

$$

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 – die zentrale Konfig
  • src/ – deine Notebooks und dein Code
  • resources/Job- und Pipeline-Definitionen
  • tests/ – optionale Testdateien
Einführung in das Databricks Lakehouse

Die Datei databricks.yml

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
Einführung in das Databricks Lakehouse

Ressourcen definieren

$$

Ebenen: databricks.yml (oben), Resources - Jobs - Pipelines - Dashboards, Code - Notebooks - Python-Skripte, Targets - dev - staging - production

$$

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
Einführung in das Databricks Lakehouse

Bundle-CLI-Befehle

$$

Command Purpose
bundle validate Konfig auf Fehler prüfen
bundle deploy In ein Target deployen
bundle run Einen deployten Job starten
bundle destroy Deployte Ressourcen entfernen

$$

# Vor dem Deploy validieren
databricks bundle validate

# In Produktion deployen
databricks bundle deploy \
  --target production

# Einen Lauf starten
databricks bundle run nightly_etl
Einführung in das Databricks Lakehouse

Deployment-Workflow

Flussdiagramm: Deployment-Workflow

$$

  • Lokale Entwicklung – Code bearbeiten und Konfigs validieren
  • Versionskontrolle – Änderungen in Git committen
  • CI/CD-Automatisierung – nach Staging deployen und Tests ausführen
  • Promotion in Produktion – mit Vertrauen deployen
Einführung in das Databricks Lakehouse

Zusammenfassung

$$

  • databricks.yml definiert Projekt, Targets und Ressourcen
  • Ressourcen umfassen Jobs, Pipelines und Dashboards
  • Targets entsprechen Umgebungen (dev, staging, production)
  • CLI-Befehle: validate, deploy, run, destroy
Einführung in das Databricks Lakehouse

Lass uns üben!

Einführung in das Databricks Lakehouse

Preparing Video For Download...