Skip to content

Commit

Permalink
Improve default template (#1046)
Browse files Browse the repository at this point in the history
## Changes
- Tweak strings, documentation in template
- Extend requirements-dev.txt with setuptools/wheel for building whl
files
- Clarify what the "_job.yml" file is for for users who are only
interested in DLT pipelines (answering a question that came up recently)

## Tests
Existing tests exercise this template
  • Loading branch information
lennartkats-db authored Dec 11, 2023
1 parent 42c0626 commit 8b9930a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"welcome_message": "\nWelcome to the sample Databricks Asset Bundle template! Please enter the following information to initialize your sample DAB.\n",
"welcome_message": "\nWelcome to the default Python template for Databricks Asset Bundles!",
"properties": {
"project_name": {
"type": "string",
"default": "my_project",
"description": "Unique name for this project",
"description": "Please provide the following details to tailor the template to your preferences.\n\nUnique name for this project",
"order": 1,
"pattern": "^[A-Za-z0-9_]+$",
"pattern_match_failure_message": "Name must consist of letters, numbers, and underscores."
Expand All @@ -31,5 +31,5 @@
"order": 4
}
},
"success_message": "\n✨ Your new project has been created in the '{{.project_name}}' directory!\n\nPlease refer to the README.md of your project for further instructions on getting started.\nOr read the documentation on Databricks Asset Bundles at https://docs.databricks.com/dev-tools/bundles/index.html."
"success_message": "Workspace to use (auto-detected, edit in '{{.project_name}}/databricks.yml'): {{workspace_host}}\n\n✨ Your new project has been created in the '{{.project_name}}' directory!\n\nPlease refer to the README.md file for \"getting started\" instructions.\nSee also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html."
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.databricks/
build/
dist/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The '{{.project_name}}' project was generated by using the default-python templa
$ databricks bundle deploy --target prod
```

5. To run a job or pipeline, use the "run" comand:
5. To run a job or pipeline, use the "run" command:
```
$ databricks bundle run
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,36 @@ include:
- resources/*.yml

targets:
# The 'dev' target, used for development purposes.
# Whenever a developer deploys using 'dev', they get their own copy.
# The 'dev' target, for development purposes. This target is the default.
dev:
# We use 'mode: development' to make sure everything deployed to this target gets a prefix
# like '[dev my_user_name]'. Setting this mode also disables any schedules and
# automatic triggers for jobs and enables the 'development' mode for Delta Live Tables pipelines.
# We use 'mode: development' to indicate this is a personal development copy:
# - Deployed resources get prefixed with '[dev my_user_name]'
# - Any job schedules and triggers are paused by default
# - The 'development' mode is used for Delta Live Tables pipelines
mode: development
default: true
workspace:
host: {{workspace_host}}

# Optionally, there could be a 'staging' target here.
# (See Databricks docs on CI/CD at https://docs.databricks.com/dev-tools/bundles/index.html.)
## Optionally, there could be a 'staging' target here.
## (See Databricks docs on CI/CD at https://docs.databricks.com/dev-tools/bundles/index.html.)
#
# staging:
# workspace:
# host: {{workspace_host}}
# workspace:
# host: {{workspace_host}}

# The 'prod' target, used for production deployment.
prod:
# For production deployments, we only have a single copy, so we override the
# workspace.root_path default of
# /Users/${workspace.current_user.userName}/.bundle/${bundle.target}/${bundle.name}
# to a path that is not specific to the current user.
{{- /*
Explaining 'mode: production' isn't as pressing as explaining 'mode: development'.
As we already talked about the other mode above, users can just
look at documentation or ask the assistant about 'mode: production'.
#
# By making use of 'mode: production' we enable strict checks
# to make sure we have correctly configured this target.
*/}}
# We use 'mode: production' to indicate this is a production deployment.
# Doing so enables strict verification of the settings below.
mode: production
workspace:
host: {{workspace_host}}
# We only have a single deployment copy for production, so we use a shared path.
root_path: /Shared/.bundle/prod/${bundle.name}
{{- if not is_service_principal}}
run_as:
# This runs as {{user_name}} in production. Alternatively,
# a service principal could be used here using service_principal_name
# (see Databricks documentation).
# This runs as {{user_name}} in production. We could also use a service principal here
# using service_principal_name (see https://docs.databricks.com/dev-tools/bundles/permissions.html).
user_name: {{user_name}}
{{end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
## pytest is the default package used for testing
pytest

## Dependencies for building wheel files
setuptools
wheel

## databricks-connect can be used to run parts of this project locally.
## See https://docs.databricks.com/dev-tools/databricks-connect.html.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# The main job for {{.project_name}}
# The main job for {{.project_name}}.

{{- /* Clarify what this job is for for DLT-only users. */}}
{{if and (eq .include_dlt "yes") (and (eq .include_notebook "no") (eq .include_python "no")) -}}
# This job runs {{.project_name}}_pipeline on a schedule.
{{end -}}

resources:
jobs:
{{.project_name}}_job:
name: {{.project_name}}_job

schedule:
# Run every day at 8:37 AM
quartz_cron_expression: '44 37 8 * * ?'
timezone_id: Europe/Amsterdam

Expand Down

0 comments on commit 8b9930a

Please sign in to comment.