This guide covers the essential setup and workflow for developing the dbt-databricks adapter.
Prerequisites: Python 3.9+ installed on your system
- Hatch will manage development environment Python versions for you
- You just need Python 3.9+ to install Hatch itself
Install Hatch (recommended):
# Install Hatch globally - see https://hatch.pypa.io/dev/install/
pip install hatch
# Create default environment (Hatch installs needed Python versions)
hatch env createIDE Integration:
Set your IDE's Python interpreter to .hatch/dbt-databricks/bin/python
hatch run code-quality # Format, lint, type-check
hatch run unit # Run unit tests
hatch run cluster-e2e # Run functional tests📖 See Testing Guide for comprehensive testing documentation
Required Extensions: Install these VS Code extensions:
- Ruff - Code formatting and linting
- Mypy Type Checker - Type checking
- Log Viewer - View dbt logs in real-time
Settings: Add to .vscode/settings.json:
{
"mypy-type-checker.importStrategy": "fromEnvironment",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": ["--color=yes", "-n=auto", "--dist=loadscope"],
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"logViewer.watch": [
{
"title": "dbt logs",
"pattern": "${workspaceFolder}/logs/**/dbt.log"
}
],
"logViewer.showStatusBarItemOnChange": true
}Test Debugging: Add to .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Tests",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
]
}Features you'll get:
- Automatic code formatting and linting with Ruff
- Type checking with mypy
- Test running from Test Explorer
- Real-time dbt log viewing
- Test debugging capabilities
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following established patterns
-
Run code quality checks:
hatch run code-quality
-
Run relevant tests:
hatch run unit # Always run unit tests hatch run cluster-e2e # Run functional tests if adapter changes
-
Update documentation if needed (code comments, this guide)
Before submitting:
- All tests pass locally
- Code quality checks pass
- Code comments updated if needed
After PR creation:
- Update CHANGELOG.md for user-facing changes (requires PR link)
Breaking changes require:
- GitHub Issue for design discussion first
- Implementation behind behavior flag (see existing flags in
behaviors/) - Clear migration documentation
Two types of documentation:
- Development docs (this repo): Architecture, testing, contributing
- User docs (docs.getdbt.com): Features, configuration, usage
Additional Development Documentation:
- Testing Guide: Comprehensive testing strategy, environments, and best practices
- Contributing Guidelines: Code standards and contribution process
Process:
- Update development docs during development
- User docs updated before release (coordinate with dbt Labs)
- Changelog entries added after PR creation
# Environment management
hatch env create # Create default environment
hatch env remove # Remove environment
hatch shell # Enter environment shell
# Code quality
hatch run code-quality # All checks (format, lint, type-check)
hatch run ruff format # Format code only
hatch run ruff check # Lint code only
hatch run mypy # Type checking only
# Testing
hatch run unit # Unit tests (Python 3.9)
hatch run test:unit # Unit tests (all Python versions)
hatch run cluster-e2e # Functional tests (HMS cluster)
hatch run uc-cluster-e2e # Functional tests (Unity Catalog)
hatch run sqlw-e2e # Functional tests (SQL Warehouse)
# Building
hatch build # Build wheel and sdist
hatch version # Show current versionIf Hatch isn't respecting changes to pyproject.toml:
hatch env prune # Remove all environments
hatch env create # Recreate default environment- Issues: GitHub Issues
- Contributing: See CONTRIBUTING.MD for guidelines