Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file.
Empty file.
17 changes: 17 additions & 0 deletions acceptance/bundle/python/apps-support/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"
mutators:
- "mutators:update_app"

resources:
apps:
my_app_1:
name: "my_app_1"
description: "My app"
source_code_path: "./app1"
11 changes: 11 additions & 0 deletions acceptance/bundle/python/apps-support/mutators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataclasses import replace

from databricks.bundles.apps import App
from databricks.bundles.core import app_mutator


@app_mutator
def update_app(app: App) -> App:
assert isinstance(app.name, str)

return replace(app, name=f"{app.name} (updated)")
4 changes: 4 additions & 0 deletions acceptance/bundle/python/apps-support/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions acceptance/bundle/python/apps-support/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json
{
"experimental": {
"python": {
"mutators": [
"mutators:update_app"
],
"resources": [
"resources:load_resources"
]
}
},
"resources": {
"apps": {
"my_app_1": {
"description": "My app",
"name": "my_app_1 (updated)",
"source_code_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/app1"
},
"my_app_2": {
"description": "My app (2)",
"name": "my_app_2 (updated)",
"source_code_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/app2"
}
}
}
}
16 changes: 16 additions & 0 deletions acceptance/bundle/python/apps-support/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from databricks.bundles.core import Resources


def load_resources() -> Resources:
resources = Resources()

resources.add_app(
"my_app_2",
{
"name": "my_app_2",
"description": "My app (2)",
"source_code_path": "./app2",
},
)

return resources
5 changes: 5 additions & 0 deletions acceptance/bundle/python/apps-support/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

trace uv run $UV_ARGS -q $CLI bundle validate --output json | \
jq "pick(.experimental.python, .resources)"

rm -fr .databricks __pycache__
4 changes: 4 additions & 0 deletions acceptance/bundle/python/apps-support/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cloud = false # tests don't interact with APIs

# apps are only supported in the current version of the wheel
EnvMatrix.PYDAB_VERSION = ["current"]
17 changes: 17 additions & 0 deletions acceptance/bundle/python/clusters-support/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"
mutators:
- "mutators:update_cluster"

resources:
clusters:
my_cluster_1:
cluster_name: "my_cluster_1"
spark_version: "13.3.x-scala2.12"
num_workers: 1
11 changes: 11 additions & 0 deletions acceptance/bundle/python/clusters-support/mutators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataclasses import replace

from databricks.bundles.clusters import Cluster
from databricks.bundles.core import cluster_mutator


@cluster_mutator
def update_cluster(cluster: Cluster) -> Cluster:
assert isinstance(cluster.cluster_name, str)

return replace(cluster, cluster_name=f"{cluster.cluster_name} (updated)")
4 changes: 4 additions & 0 deletions acceptance/bundle/python/clusters-support/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions acceptance/bundle/python/clusters-support/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json
{
"experimental": {
"python": {
"mutators": [
"mutators:update_cluster"
],
"resources": [
"resources:load_resources"
]
}
},
"resources": {
"clusters": {
"my_cluster_1": {
"autotermination_minutes": 60,
"cluster_name": "my_cluster_1 (updated)",
"num_workers": 1,
"spark_version": "13.3.x-scala2.12"
},
"my_cluster_2": {
"autotermination_minutes": 60,
"cluster_name": "my_cluster_2 (updated)",
"num_workers": 1,
"spark_version": "13.3.x-scala2.12"
}
}
}
}
16 changes: 16 additions & 0 deletions acceptance/bundle/python/clusters-support/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from databricks.bundles.core import Resources


def load_resources() -> Resources:
resources = Resources()

resources.add_cluster(
"my_cluster_2",
{
"cluster_name": "my_cluster_2",
"spark_version": "13.3.x-scala2.12",
"num_workers": 1,
},
)

return resources
5 changes: 5 additions & 0 deletions acceptance/bundle/python/clusters-support/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

trace uv run $UV_ARGS -q $CLI bundle validate --output json | \
jq "pick(.experimental.python, .resources)"

rm -fr .databricks __pycache__
4 changes: 4 additions & 0 deletions acceptance/bundle/python/clusters-support/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cloud = false # tests don't interact with APIs

# clusters are only supported in the current version of the wheel
EnvMatrix.PYDAB_VERSION = ["current"]
17 changes: 17 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"
mutators:
- "mutators:update_database_catalog"

resources:
database_catalogs:
my_database_catalog_1:
database_instance_name: "test_instance"
database_name: "test_db"
name: "my_database_catalog_1"
11 changes: 11 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/mutators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataclasses import replace

from databricks.bundles.core import database_catalog_mutator
from databricks.bundles.database_catalogs import DatabaseCatalog


@database_catalog_mutator
def update_database_catalog(database_catalog: DatabaseCatalog) -> DatabaseCatalog:
assert isinstance(database_catalog.name, str)

return replace(database_catalog, name=f"{database_catalog.name} (updated)")

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json
{
"experimental": {
"python": {
"mutators": [
"mutators:update_database_catalog"
],
"resources": [
"resources:load_resources"
]
}
},
"resources": {
"database_catalogs": {
"my_database_catalog_1": {
"database_instance_name": "test_instance",
"database_name": "test_db",
"name": "my_database_catalog_1 (updated)"
},
"my_database_catalog_2": {
"database_instance_name": "test_instance",
"database_name": "test_db_2",
"name": "my_database_catalog_2 (updated)"
}
}
}
}
16 changes: 16 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from databricks.bundles.core import Resources


def load_resources() -> Resources:
resources = Resources()

resources.add_database_catalog(
"my_database_catalog_2",
{
"database_instance_name": "test_instance",
"database_name": "test_db_2",
"name": "my_database_catalog_2",
},
)

return resources
5 changes: 5 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

trace uv run $UV_ARGS -q $CLI bundle validate --output json | \
jq "pick(.experimental.python, .resources)"

rm -fr .databricks __pycache__
4 changes: 4 additions & 0 deletions acceptance/bundle/python/database_catalogs-support/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cloud = false # tests don't interact with APIs

# database_catalogs are only supported in the current version of the wheel
EnvMatrix.PYDAB_VERSION = ["current"]
16 changes: 16 additions & 0 deletions acceptance/bundle/python/database_instances-support/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"
mutators:
- "mutators:update_database_instance"

resources:
database_instances:
my_database_instance_1:
name: "my_database_instance_1"
capacity: "CU_1"
11 changes: 11 additions & 0 deletions acceptance/bundle/python/database_instances-support/mutators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataclasses import replace

from databricks.bundles.database_instances import DatabaseInstance
from databricks.bundles.core import database_instance_mutator


@database_instance_mutator
def update_database_instance(database_instance: DatabaseInstance) -> DatabaseInstance:
assert isinstance(database_instance.name, str)

return replace(database_instance, name=f"{database_instance.name} (updated)")

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions acceptance/bundle/python/database_instances-support/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json
{
"experimental": {
"python": {
"mutators": [
"mutators:update_database_instance"
],
"resources": [
"resources:load_resources"
]
}
},
"resources": {
"database_instances": {
"my_database_instance_1": {
"capacity": "CU_1",
"name": "my_database_instance_1 (updated)"
},
"my_database_instance_2": {
"capacity": "CU_1",
"name": "my_database_instance_2 (updated)"
}
}
}
}
15 changes: 15 additions & 0 deletions acceptance/bundle/python/database_instances-support/resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from databricks.bundles.core import Resources


def load_resources() -> Resources:
resources = Resources()

resources.add_database_instance(
"my_database_instance_2",
{
"name": "my_database_instance_2",
"capacity": "CU_1",
},
)

return resources
5 changes: 5 additions & 0 deletions acceptance/bundle/python/database_instances-support/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

trace uv run $UV_ARGS -q $CLI bundle validate --output json | \
jq "pick(.experimental.python, .resources)"

rm -fr .databricks __pycache__
4 changes: 4 additions & 0 deletions acceptance/bundle/python/database_instances-support/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cloud = false # tests don't interact with APIs

# database_instances are only supported in the current version of the wheel
EnvMatrix.PYDAB_VERSION = ["current"]
15 changes: 15 additions & 0 deletions acceptance/bundle/python/experiments-support/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"
mutators:
- "mutators:update_mlflow_experiment"

resources:
experiments:
my_experiment_1:
name: "/my_experiment_1"
11 changes: 11 additions & 0 deletions acceptance/bundle/python/experiments-support/mutators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dataclasses import replace

from databricks.bundles.experiments import MlflowExperiment
from databricks.bundles.core import mlflow_experiment_mutator


@mlflow_experiment_mutator
def update_mlflow_experiment(experiment: MlflowExperiment) -> MlflowExperiment:
assert isinstance(experiment.name, str)

return replace(experiment, name=f"{experiment.name} (updated)")
4 changes: 4 additions & 0 deletions acceptance/bundle/python/experiments-support/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading