Binnen een asset bundle

Introductie tot Databricks Lakehouse

Gang Wang

Senior Data Scientist

Structuur van een bundelproject

$$

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 - het centrale configbestand
  • src/ - je notebooks en code
  • resources/ - job- en pipeline-definities
  • tests/ - optionele testbestanden
Introductie tot Databricks Lakehouse

Het bestand 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
Introductie tot Databricks Lakehouse

Resources definiëren

$$

lagen: databricks.yml (boven), Resources - Jobs - Pipelines - Dashboards, Code - Notebooks - Python-scripts, 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
Introductie tot Databricks Lakehouse

Bundle CLI-opdrachten

$$

Command Purpose
bundle validate Config op fouten controleren
bundle deploy Deployen naar een target
bundle run Een gedeployde job starten
bundle destroy Gedeployde resources verwijderen

$$

# Valideren vóór deployen
databricks bundle validate

# Deployen naar production
databricks bundle deploy \
  --target production

# Een run starten
databricks bundle run nightly_etl
Introductie tot Databricks Lakehouse

Deploy-workflow

stroomschema: Deploy-workflow

$$

  • Lokale ontwikkeling - code bewerken en configs valideren
  • Versiebeheer - wijzigingen committen naar Git
  • CI/CD-automatisering - naar staging deployen en tests draaien
  • Productiepromotie - met vertrouwen deployen
Introductie tot Databricks Lakehouse

Samenvatting

$$

  • databricks.yml definieert je project, targets en resources
  • Resources omvatten jobs, pipelines en dashboards
  • Targets komen overeen met omgevingen (dev, staging, production)
  • CLI-opdrachten: validate, deploy, run, destroy
Introductie tot Databricks Lakehouse

Laten we oefenen!

Introductie tot Databricks Lakehouse

Preparing Video For Download...