Notebook
laktory.models.resources.databricks.Notebook
¤
Bases: RenderableFileMixin, TagsMixin, NotebookBase
Databricks Notebook
Examples:
import io
from laktory import models
notebook_yaml = '''
source: ./notebooks/dlt/dlt_laktory_pl.py
dirpath: notebooks/dlt/
access_controls:
- group_name: role-engineers
permission_level: CAN_RUN
tags:
team: engineering
'''
notebook = models.resources.databricks.Notebook.model_validate_yaml(
io.StringIO(notebook_yaml)
)
print(notebook.path)
# > /.laktory/notebooks/dlt/dlt_laktory_pl.py
References
| BASE | DESCRIPTION |
|---|---|
content_base64
|
The base64-encoded notebook source code. Conflicts with
TYPE:
|
format
|
TYPE:
|
language
|
(required with
TYPE:
|
md5
|
TYPE:
|
object_id
|
Unique identifier for a NOTEBOOK
TYPE:
|
object_type
|
TYPE:
|
| LAKTORY | DESCRIPTION |
|---|---|
access_controls
|
List of notebook access controls
TYPE:
|
dirpath
|
Workspace directory inside rootpath in which the notebook is deployed. Used only if
TYPE:
|
path_
|
Workspace filepath for the notebook. Overwrite
TYPE:
|
render_vars
|
If
TYPE:
|
source_
|
Path to notebook in source code format on local filesystem. Conflicts with
TYPE:
|
tags
|
Tags assigned to the entity as
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
build |
Render |
check_staged |
Raise a clear error if this resource is configured for variable |
get_tags_additional_resources |
Tag assignment resources for |
| ATTRIBUTE | DESCRIPTION |
|---|---|
additional_core_resources |
TYPE:
|
filename |
Notebook file name
TYPE:
|
additional_core_resources
property
¤
- permissions
- tags
filename
property
¤
Notebook file name
build(vars=None)
¤
Render ${vars.x}/${{ expr }} placeholders in the notebook
content and stage the result under settings.build_root, if
render_vars is True. No-op otherwise.
Source code in laktory/models/resources/databricks/notebook.py
118 119 120 121 122 123 124 125 | |
check_staged()
¤
Raise a clear error if this resource is configured for variable
rendering but its staged copy hasn't been written yet (i.e.
.build() hasn't run). Guards against programmatic use that
bypasses Stack.build() (the normal CLI flow always calls it
before dumping resources).
Source code in laktory/models/resources/databricks/_renderablefile.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
get_tags_additional_resources(entity_type, entity, tags=None)
¤
Tag assignment resources for entity (a name or a resource reference).
Defaults to the tags of this resource.
Source code in laktory/models/resources/databricks/_tagsmixin.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
laktory.models.resources.databricks.notebook.NotebookLookup
¤
Bases: ResourceLookup
| PARAMETER | DESCRIPTION |
|---|---|
format
|
Notebook format to export. Either
TYPE:
|
path
|
Notebook path on the workspace
TYPE:
|