Skip to main content

A reusable task-based framework for managing Unity Catalog in Databricks

Project description

Databricks Unity Catalog Setup Demo

A Python package that demonstrates automated setup and teardown of Databricks Unity Catalog resources using the Databricks SDK. This package provides a reusable framework for managing Unity Catalog resources programmatically, both from local environments and within Databricks notebooks.

Features

  • Automated creation of Unity Catalog resources:
    • Catalogs
    • Schemas
    • Volumes
  • Configurable resource naming via environment variables
  • Support for both local execution and Databricks notebook execution
  • Type-safe configuration management using Pydantic
  • Clean teardown functionality

Prerequisites

  • Python 3.8+
  • A Databricks workspace with Unity Catalog enabled
  • Appropriate permissions to create/manage Unity Catalog resources

Installation

pip install demo-uc-setup

Configuration

The package uses environment variables for configuration. You can set these either in your environment or in a .env file:

# Required for local execution (optional in Databricks notebooks)
DATABRICKS_HOST=your-workspace-url
DATABRICKS_TOKEN=your-pat-token

# Optional - override default resource names
DEMO_CATALOG_NAME=custom_catalog_name
DEMO_SCHEMAS=["schema1", "schema2"]
DEMO_VOLUME_NAME=custom_volume_name

Usage

Local Execution

from demo_uc_setup.unity_catalog_setup import UnityCatalogSetupTask
from demo_uc_setup.unity_catalog_teardown import UnityCatalogTeardownTask

# Setup Unity Catalog resources
UnityCatalogSetupTask.entrypoint()

# Teardown Unity Catalog resources
UnityCatalogTeardownTask.entrypoint()

Databricks Notebook Execution

%pip install demo-uc-setup

from demo_uc_setup.unity_catalog_setup import UnityCatalogSetupTask
UnityCatalogSetupTask.entrypoint()

Default Resource Names

If not overridden via environment variables, the package will create:

  • A catalog named demo_catalog
  • Two schemas: demo_schema_1 and demo_schema_2
  • A volume named demo_volume in each schema

Extending the Framework

The package provides a reusable Task base class that can be extended for custom Unity Catalog operations:

from demo_uc_setup.common import Task
from demo_uc_setup.config import Config

class CustomTask(Task[Config]):
    def run(self):
        self.logger.info("Starting custom task...")
        # Your custom logic here

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

demo_uc_setup-0.1.0.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

demo_uc_setup-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file demo_uc_setup-0.1.0.tar.gz.

File metadata

  • Download URL: demo_uc_setup-0.1.0.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.24

File hashes

Hashes for demo_uc_setup-0.1.0.tar.gz
Algorithm Hash digest
SHA256 86d1509ba5e408e735e25f5d2e01037f24e1b5566c5fb5188b304e10a665dbb1
MD5 10f64baf01577bf5bb8e29ceb465d2de
BLAKE2b-256 a7622468d65a62a72cfe10915f4e0471c5e33e18473470a9f4425f8591bc7fa8

See more details on using hashes here.

File details

Details for the file demo_uc_setup-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for demo_uc_setup-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f0ca6cc5de4aaa07aa39b99bccb3feb874f68c90968a0494663e21b338179f9
MD5 35ecaa02e7e5acc77552b58fa1108fac
BLAKE2b-256 dd7cd9f311694cd50632d85d9388ae491d714497afd84c9d118d25f78f11a8d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page