-
Notifications
You must be signed in to change notification settings - Fork 126
Add default scala template #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lennartkats-db
merged 7 commits into
databricks:main
from
garlandz-db:default_scala_template
Nov 12, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ca5a72b
Add default scala template
garlandz-db 3261ac3
cleanup messaging
garlandz-db 0f0a93d
improvements
garlandz-db f28a7e9
.
garlandz-db 0aec12a
clean
garlandz-db c851817
cleanup
garlandz-db 5c664e6
remove reedundant
garlandz-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # default-scala | ||
|
|
||
| This template helps you create Scala projects with Databricks Asset Bundles. It uses sbt to compile and package Scala files, and can be used with Databricks Connect for local development. | ||
|
|
||
| It supports two compute types: standard clusters and serverless compute. | ||
|
|
||
| Run | ||
| ``` | ||
| databricks bundle init --template-dir contrib/templates/default-scala https://github.com/databricks/bundle-examples | ||
| ``` | ||
|
|
||
| and follow the generated README.md to get started. | ||
58 changes: 58 additions & 0 deletions
58
contrib/templates/default-scala/databricks_template_schema.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| { | ||
| "welcome_message": "\nWelcome to the default-scala template for Databricks Asset Bundles!\n\nA workspace was selected based on your current profile. For information about how to change this, see https://docs.databricks.com/dev-tools/cli/profiles.html.\nworkspace_host: {{workspace_host}}", | ||
| "properties": { | ||
| "project_name": { | ||
| "type": "string", | ||
| "description": "\nPlease provide a unique name for this project.\nproject_name", | ||
| "order": 1, | ||
| "pattern": "^[A-Za-z_][A-Za-z0-9-_]+$", | ||
| "pattern_match_failure_message": "Name must consist of letters, numbers, dashes, and underscores." | ||
| }, | ||
| "compute_type": { | ||
| "type": "string", | ||
| "description": "\nPlease select the compute type.\ncompute_type", | ||
| "enum": ["standard cluster", "serverless"], | ||
| "default": "serverless", | ||
| "order": 2 | ||
| }, | ||
| "artifacts_dest_path": { | ||
| "type": "string", | ||
| "description": "\nPlease provide the Unity Catalog volume destination path in Databricks where the directory will be created containing the JAR and other artifacts to store.{{if eq .compute_type \"standard cluster\"}}\nNote: your admin must allowlist the volume JAR path you specify for your workspace (see https://docs.databricks.com/en/data-governance/unity-catalog/manage-privileges/allowlist.html){{end}}\nartifacts_dest_path [example: /Volumes/abcdef1234567890]", | ||
| "order": 3, | ||
| "pattern": "^/Volumes(?:/[a-z0-9_-]+)+/?$", | ||
| "pattern_match_failure_message": "Please enter a valid path like /Volumes/my-folder/. Only lowercase letters, numbers, dashes, and underscores are allowed in folder names." | ||
| }, | ||
| "default_catalog": { | ||
| "type": "string", | ||
| "default": "{{default_catalog}}", | ||
| "pattern": "^\\w*$", | ||
| "pattern_match_failure_message": "Invalid catalog name.", | ||
| "description": "\nPlease provide an initial catalog{{if eq (default_catalog) \"\"}} (leave blank when not using Unity Catalog){{end}}.\ndefault_catalog", | ||
| "order": 4 | ||
| }, | ||
| "personal_schemas": { | ||
| "type": "string", | ||
| "description": "\nWould you like to use a personal schema for each user working on this project? (e.g., 'catalog.{{short_name}}')\npersonal_schemas", | ||
| "enum": [ | ||
| "yes, use a schema based on the current user name during development", | ||
| "no, use a shared schema during development" | ||
| ], | ||
| "order": 5 | ||
| }, | ||
| "shared_schema": { | ||
| "skip_prompt_if": { | ||
| "properties": { | ||
| "personal_schemas": { | ||
| "const": "yes, use a schema based on the current user name during development" | ||
| } | ||
| } | ||
| }, | ||
| "type": "string", | ||
| "default": "default", | ||
| "pattern": "^\\w+$", | ||
| "pattern_match_failure_message": "Invalid schema name.", | ||
| "description": "\nPlease provide an initial schema during development.\ndefault_schema", | ||
| "order": 6 | ||
| } | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
...scala-job/library/template_variables.tmpl → ...ult-scala/library/template_variables.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions
46
...mplates/default-scala/template/{{.project_name}}/resources/{{.project_name}}.job.yml.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # The main job for {{.project_name}} | ||
|
|
||
| resources: | ||
| jobs: | ||
| {{.project_name}}: | ||
| name: {{.project_name}} | ||
| parameters: | ||
| - name: catalog | ||
| default: ${var.catalog} | ||
| - name: schema | ||
| default: ${var.schema} | ||
| tasks: | ||
| - task_key: main_task | ||
| {{- if eq .compute_type "standard cluster"}} | ||
| job_cluster_key: job_cluster | ||
| {{- end}} | ||
| spark_jar_task: | ||
| main_class_name: {{template `main_class_name` .}} | ||
| parameters: | ||
| - "--catalog" | ||
| - "{{`{{job.parameters.catalog}}`}}" | ||
| - "--schema" | ||
| - "{{`{{job.parameters.schema}}`}}" | ||
| {{- if eq .compute_type "serverless"}} | ||
| environment_key: default | ||
| {{- else}} | ||
| libraries: | ||
| - jar: ${workspace.artifact_path}/.internal/{{.project_name}}-assembly-{{template `version` .}}.jar | ||
| {{- end}} | ||
| {{- if eq .compute_type "serverless"}} | ||
| environments: | ||
| - environment_key: default | ||
| spec: | ||
| environment_version: "4-scala-preview" | ||
| java_dependencies: | ||
| - ${workspace.artifact_path}/.internal/{{.project_name}}-assembly-{{template `version` .}}.jar | ||
| {{- else}} | ||
| job_clusters: | ||
| - job_cluster_key: job_cluster | ||
| new_cluster: | ||
| spark_version: 17.3.x-scala2.13 | ||
| node_type_id: i3.xlarge | ||
| autoscale: | ||
| min_workers: 1 | ||
| max_workers: 4 | ||
| {{- end}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
contrib/templates/scala-job/databricks_template_schema.json
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...b/templates/scala-job/template/{{.project_name}}/resources/{{.project_name}}.job.yml.tmpl
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.