WorkspaceTree
laktory.models.resources.databricks.WorkspaceTree
ยค
Bases: BaseModel, VirtualTerraformResource
Databricks Workspace Tree (collections of directories, notebooks and workspace files)
Examples:
import io
from laktory import models
tree_yaml = '''
source: ./source/
path: /.laktory/source
'''
tree = models.resources.databricks.WorkspaceTree.model_validate_yaml(
io.StringIO(tree_yaml)
)
By default, file content is uploaded verbatim. Opt individual files into
variable rendering (${vars.x} / ${{ expr }}) via render_paths -
useful for deploying an environment-specific Databricks App source tree,
for example. Resolved content is staged under settings.build_root,
the original files on disk are never modified.
import io
from laktory import models
tree_yaml = '''
source: ./app/
path: /apps/myapp
render_paths:
- '*.json'
- configs/*.yaml
variables:
env: dev
'''
tree = models.resources.databricks.WorkspaceTree.model_validate_yaml(
io.StringIO(tree_yaml)
)
Files can be excluded from the tree with exclude_paths, using
.gitignore syntax (including negation) - independent of git, so a file
can be committed to the repo and still be kept out of the deployed tree.
A real .gitignore found at the root of source can also be honored via
use_gitignore, for the common case where "don't commit" and "don't
deploy" coincide. Dotfiles and dot-directories (e.g. .git, .venv) are
excluded by default; re-include one explicitly with a negated pattern
(e.g. !.streamlit/, !.streamlit/**) - useful for a Databricks App
source tree that relies on a dotdir like .streamlit/config.toml.
import io
from laktory import models
tree_yaml = '''
source: ./app/
path: /apps/myapp
exclude_paths:
- '*.log'
- build/
- '!.streamlit/'
- '!.streamlit/**'
use_gitignore: true
'''
tree = models.resources.databricks.WorkspaceTree.model_validate_yaml(
io.StringIO(tree_yaml)
)
| PARAMETER | DESCRIPTION |
|---|---|
access_controls
|
Access controls list
TYPE:
|
exclude_paths
|
Gitignore-style patterns, relative to
TYPE:
|
path
|
Workspace filepath for the tree. If not specified, workspace laktory root is used.
TYPE:
|
render_paths
|
Glob patterns, relative to
TYPE:
|
source
|
Path to directory on local filesystem.
TYPE:
|
use_gitignore
|
If
TYPE:
|