Databricks CLI

repository·main·Indexed 18 days ago

https://github.com/databricks/cli

A command-line tool for interacting with Databricks workspaces. It supports Databricks Unified Authentication and provides functionality for managing Databricks Asset Bundles, including deploying resources (jobs, pipelines) to different targets (dev, prod) via 'databricks bundle deploy' and executing them using 'databricks bundle run'. The tool includes specific path resolution logic for resource definitions and supports integration with dbt projects and the uv package manager.

Tokens
164.7K
Snippets
758
Records
960
Agent score
62%

What's inside Databricks CLI

  1. Getting started with my_lakeflow_pipelines

    main

    The my_lakeflow_pipelines project is a template-generated project for managing Lakeflow pipelines. It is organized into two main directories:

    • src/: Contains the SQL source code for the pipelines.
    • resources/: Contains resource configurations such as jobs and pipelines.

    You can work on this project in three ways:

    1. Directly in Databricks workspace: Using the Databricks web interface.
    2. Locally with an IDE: Using extensions like the Databricks VS Code extension.
    3. Via Command Line: Using the Databricks CLI.
  2. Overview of my_lakeflow_integrations examples

    main

    The my_lakeflow_integrations bundle provides custom integrations for Lakeflow Jobs. It includes runnable examples and job definitions located in src/my_lakeflow_integrations/examples/ and resources/ respectively.

    Available examples:

    • slack.send_slack_message (Function): Posts a message to Slack using a Unity Catalog connection.
    • wait_for_run_sensor.WaitForRunSensor (Sensor): A sensor that polls a job run until it reaches a terminal state.
  3. Overview of the lakeflow-pipelines template

    main

    The lakeflow-pipelines template is a specialized version of the 'default' template. It is specifically designed for use within the Databricks Workspace UI to facilitate the creation of Lakeflow pipelines.

    For a complete list of the properties and configurations that are automatically defaulted when using this template, refer to the databricks_template_schema.json file.

  4. Use the databricks.bundles.core package

    main
    The databricks.bundles.core package provides the foundational classes and methods for managing Databricks Asset Bundles (DABs) programmatically. It includes abstractions for Resources, Bundle definitions, Variable management, and Diagnostics for error reporting. Developers can use this package to load resource definitions from Python modules or packages and apply mutations to specific resource types like jobs, pipelines, or volumes.
  5. Project Structure for default-python templates

    main

    Projects generated using the default-python template follow a specific directory structure:

    • src/: Contains the Python source code.
      • src/my_default_python/: Shared Python code intended for use by Databricks jobs and pipelines.
    • resources/: Contains resource configurations such as jobs and pipelines.
    • tests/: Contains unit tests for the shared Python code.
    • fixtures/: Contains data set fixtures, primarily used for testing.
  6. Understand the structure of a my_default_python pipeline

    main

    A my_default_python pipeline is organized into several functional directories:

    • explorations/: Contains ad-hoc notebooks for exploring processed data.
    • transformations/: The core directory containing all dataset definitions and transformations. By convention, each dataset is defined in its own separate file.
    • utilities/ (optional): Contains shared utility functions and Python modules.
    • data_sources/ (optional): Contains view definitions that describe the source data for the pipeline.
  7. Understand the lakeflow_project directory structure

    main

    The lakeflow_project pipeline is organized into several functional directories:

    • explorations/: Contains ad-hoc notebooks for exploring processed data.
    • transformations/: Contains all dataset definitions and transformations. This is the primary location for core logic.
    • utilities/ (optional): Contains shared utility functions and Python modules.
    • data_sources/ (optional): Contains view definitions that describe the source data for the pipeline.
  8. Project structure of my_default_python

    main

    The my_default_python project follows this directory structure:

    • src/: Python source code.
      • src/my_default_python/: Shared Python code intended for use by Databricks jobs and pipelines.
    • resources/: Configuration files for Databricks resources (e.g., jobs, pipelines).
    • tests/: Unit tests for the shared Python code.
    • fixtures/: Data set fixtures, primarily used for testing.
  9. Understand the structure of a my_sql_project pipeline

    main

    A my_sql_project pipeline is organized into specific directories that separate logic, data definitions, and exploration:

    • transformations/: The core directory containing all dataset definitions and transformations. By convention, each dataset is defined in its own separate file.
    • explorations/: Contains ad-hoc notebooks used for exploring the data processed by the pipeline.
    • data_sources/ (optional): Contains view definitions that describe the source data for the pipeline.
    • utilities/ (optional): Contains shared utility functions and Python modules used across the pipeline.
  10. Project structure for my_python_project

    main

    The my_python_project pipeline source code is organized into the following directory structure:

    • explorations/: Contains ad-hoc notebooks for data exploration.
    • transformations/: Contains all dataset definitions and transformations. This is the primary location for core logic.
    • utilities/ (optional): Contains utility functions and Python modules.
    • data_sources/ (optional): Contains view definitions describing source data.
  11. Use Python support for Declarative Automation Bundles via databricks-bundles

    main

    The databricks-bundles package provides Python support for Declarative Automation Bundles. This allows developers to manage Databricks resources using a declarative approach within Python environments. The package is organized into several functional modules:

    • databricks.bundles.core: Core bundle functionality.
    • databricks.bundles.jobs: Management of Databricks Jobs.
    • databricks.bundles.pipelines: Management of Databricks Pipelines.
    • databricks.bundles.schemas: Management of schemas.
    • databricks.bundles.volumes: Management of Unity Catalog Volumes.