CI/CD pipeline for Databricks Genie spaces - multi-workspace promotion at scale
Project description
SpaceOps ๐
CI/CD for Databricks Genie Spaces โ Multi-workspace promotion at scale
SpaceOps provides a complete pipeline to define, version, test, and promote Genie spaces (knowledge store, joins, instructions, examples, functions, benchmarks) across dev/stage/prod environments.
Why SpaceOps?
- Version Control: Store Genie space definitions as code in Git
- Drift Control: Detect and prevent configuration drift across environments
- Benchmark Testing: Block promotions if query accuracy drops
- Multi-Workspace: Promote spaces across dev โ stage โ prod with environment-specific overrides
- Snapshots & Backups: Export space state for auditing and disaster recovery
Quick Start
Installation
# Clone the repository
git clone https://github.com/your-org/spaceops.git
cd spaceops
# Install dependencies
pip install -e .
# Verify installation
spaceops --version
Environment Setup
export DATABRICKS_HOST="https://your-workspace.cloud.databricks.com"
export DATABRICKS_TOKEN="your-token"
Basic Commands
# Snapshot an existing space
spaceops snapshot <space_id> -o spaces/my-space/space.yaml
# Validate a space definition
spaceops validate spaces/my-space/space.yaml
# Push to Databricks (create or update)
spaceops push spaces/my-space/space.yaml --space-id <existing_id>
# Compare local vs remote
spaceops diff spaces/my-space/space.yaml <space_id>
# Run benchmark tests
spaceops benchmark <space_id> spaces/my-space/benchmarks/accuracy.yaml
# Promote to an environment
spaceops promote spaces/my-space/space.yaml prod --config config/promotion.yaml
Project Structure
spaceops/
โโโ spaceops/ # Python package
โ โโโ cli.py # CLI commands
โ โโโ client.py # Databricks Genie API client
โ โโโ models.py # Pydantic data models
โ โโโ diff.py # Configuration diff utilities
โ โโโ benchmark.py # Benchmark test runner
โโโ spaces/ # Space definitions (version controlled)
โ โโโ billing/
โ โโโ space.yaml # Space configuration
โ โโโ benchmarks/
โ โโโ accuracy.yaml
โโโ config/ # Environment configurations
โ โโโ dev.yaml
โ โโโ stage.yaml
โ โโโ prod.yaml
โ โโโ promotion.yaml # Multi-env promotion config
โโโ .github/workflows/
โโโ genie-cicd.yaml # CI/CD pipeline
Space Definition Format
Space definitions are YAML files that define the complete configuration:
title: "My Analytics Space"
description: "AI-powered analytics"
warehouse_id: null # Set per-environment
data_sources:
tables:
- identifier: "catalog.schema.table"
column_configs:
- column_name: "id"
enable_format_assistance: true
- column_name: "category"
enable_entity_matching: true
joins:
- left_table: "catalog.schema.orders"
right_table: "catalog.schema.customers"
left_column: "customer_id"
right_column: "id"
join_type: "left"
instructions:
- content: "When calculating revenue, use the net_amount column."
category: "calculation"
example_queries:
- question: "What was total revenue last month?"
sql: "SELECT SUM(net_amount) FROM orders WHERE..."
Benchmark Testing
Create benchmark suites to validate Genie's query accuracy:
# benchmarks/accuracy.yaml
name: "Core Accuracy Tests"
min_accuracy: 0.8 # 80% must pass
queries:
- question: "What was total usage last month?"
expected_tables:
- "system.billing.usage"
expected_sql_contains:
- "SUM"
- "usage_quantity"
- question: "Show costs by SKU"
expected_tables:
- "system.billing.usage"
- "system.billing.list_prices"
expected_sql_contains:
- "JOIN"
Run benchmarks:
spaceops benchmark <space_id> benchmarks/accuracy.yaml --min-accuracy 0.9
CI/CD Pipeline
The included GitHub Actions workflow provides:
- Validation โ Validates all space definitions on every PR
- Diff โ Shows what changes will be applied
- Dev Deploy โ Auto-deploys on merge to
develop - Stage Deploy โ Auto-deploys on merge to
main - Prod Deploy โ Requires manual approval + benchmark gates
Required Secrets
| Secret | Description |
|---|---|
DATABRICKS_DEV_HOST |
Dev workspace URL |
DATABRICKS_DEV_TOKEN |
Dev workspace token |
DATABRICKS_STAGE_HOST |
Stage workspace URL |
DATABRICKS_STAGE_TOKEN |
Stage workspace token |
DATABRICKS_PROD_HOST |
Prod workspace URL |
DATABRICKS_PROD_TOKEN |
Prod workspace token |
DEV_SPACE_ID |
Space ID in dev (after first deploy) |
STAGE_SPACE_ID |
Space ID in stage (after first deploy) |
PROD_SPACE_ID |
Space ID in prod (after first deploy) |
Environment Protection
Configure GitHub environment protection rules:
- production: Require reviewers, restrict to
mainbranch
CLI Reference
spaceops snapshot
Export a space configuration for backup or version control.
spaceops snapshot <space_id> [OPTIONS]
Options:
-o, --output PATH Output file path
--format [yaml|json] Output format (default: yaml)
--host TEXT Databricks workspace host
--token TEXT Databricks access token
spaceops push
Push a space definition to Databricks.
spaceops push <definition_path> [OPTIONS]
Options:
--space-id TEXT Existing space ID to update
--warehouse-id TEXT Override warehouse ID
--env PATH Environment config file
--dry-run Show what would be done
spaceops diff
Compare local definition with remote space.
spaceops diff <definition_path> <space_id> [OPTIONS]
spaceops validate
Validate a space definition file.
spaceops validate <definition_path>
spaceops benchmark
Run benchmark tests against a Genie space.
spaceops benchmark <space_id> <benchmark_paths>... [OPTIONS]
Options:
--min-accuracy FLOAT Minimum required accuracy (0-1)
--output PATH Output report file
--format [markdown|json]
spaceops promote
Promote a space to a target environment.
spaceops promote <definition_path> <target_env> [OPTIONS]
Options:
--config PATH Promotion config file (required)
--benchmark PATH Benchmark file to run before promotion
--min-accuracy FLOAT Minimum accuracy for benchmark
--skip-benchmark Skip benchmark validation
--dry-run Show what would be done
--force Force promotion even if benchmarks fail
spaceops list
List all Genie spaces in the workspace.
spaceops list [OPTIONS]
spaceops delete
Delete a Genie space.
spaceops delete <space_id> [OPTIONS]
Options:
-y, --yes Skip confirmation
API Reference
SpaceOps uses the Databricks Genie Management API:
GET /api/2.0/genie/spaces/{space_id}?include_serialized_space=truePOST /api/2.0/genie/spacesPATCH /api/2.0/genie/spaces/{space_id}DELETE /api/2.0/genie/spaces/{space_id}
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=spaceops
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
Built with โค๏ธ for the Databricks community
Repository: github.com/charotAmine/databricks-spaceops
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spaceops-0.2.1.tar.gz.
File metadata
- Download URL: spaceops-0.2.1.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a36c0f250bb507a6d8c1513e0a057f8308d9b53eaff1ecc21a120ac452fff482
|
|
| MD5 |
78c2d35876877468ec3f5f590376ea20
|
|
| BLAKE2b-256 |
d333320ca178f5901a671df5d28beb3d28be28aadbd64d0a9dd08d780f960b57
|
Provenance
The following attestation bundles were made for spaceops-0.2.1.tar.gz:
Publisher:
release.yaml on charotAmine/databricks-spaceops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spaceops-0.2.1.tar.gz -
Subject digest:
a36c0f250bb507a6d8c1513e0a057f8308d9b53eaff1ecc21a120ac452fff482 - Sigstore transparency entry: 891854983
- Sigstore integration time:
-
Permalink:
charotAmine/databricks-spaceops@656e7517393766582f103023c965d675104686c8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/charotAmine
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@656e7517393766582f103023c965d675104686c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file spaceops-0.2.1-py3-none-any.whl.
File metadata
- Download URL: spaceops-0.2.1-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12dd699e93a7a9c074062aaacf8f1941314e4f3bdc536e787516969998c74c3a
|
|
| MD5 |
b5da363b31014170ca49353b3878a9d4
|
|
| BLAKE2b-256 |
908e1ad15b36a08d3d8dcec97f61be04528ef2a93a0719b5ac78a0b4ce6962d8
|
Provenance
The following attestation bundles were made for spaceops-0.2.1-py3-none-any.whl:
Publisher:
release.yaml on charotAmine/databricks-spaceops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spaceops-0.2.1-py3-none-any.whl -
Subject digest:
12dd699e93a7a9c074062aaacf8f1941314e4f3bdc536e787516969998c74c3a - Sigstore transparency entry: 891855022
- Sigstore integration time:
-
Permalink:
charotAmine/databricks-spaceops@656e7517393766582f103023c965d675104686c8 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/charotAmine
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@656e7517393766582f103023c965d675104686c8 -
Trigger Event:
push
-
Statement type: