Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Dependency updates

### Bundles
* Prompt for serverless compute in `dbt-sql` template (defaults to `yes`) ([#3668](https://github.com/databricks/cli/pull/3668))

### API Changes
* Added `databricks account account-groups-v2` command group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resources:

tasks:
- task_key: dbt
environment_key: default
dbt_task:
project_directory: ../
# The default schema, catalog, etc. are defined in ../dbt_profiles/profiles.yml
Expand All @@ -25,17 +26,9 @@ resources:
- 'dbt seed --target=${bundle.target} --vars "{ dev_schema: ${workspace.current_user.short_name} }"'
- 'dbt run --target=${bundle.target} --vars "{ dev_schema: ${workspace.current_user.short_name} }"'

libraries:
- pypi:
package: dbt-databricks>=1.8.0,<2.0.0

new_cluster:
spark_version: 15.4.x-scala2.12
node_type_id: [NODE_TYPE_ID]
data_security_mode: SINGLE_USER
num_workers: 0
spark_conf:
spark.master: "local[*, 4]"
spark.databricks.cluster.profile: singleNode
custom_tags:
ResourceClass: SingleNode
environments:
- environment_key: default
spec:
environment_version: "2"
dependencies:
- dbt-databricks>=1.8.0,<2.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"uploadTime": [UNIX_TIME_MILLIS],
"items": [],
"protoLogs": [
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[CMD-EXEC-ID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"bundle_init\",\"operating_system\":\"[OS]\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"bundle_init_event\":{\"bundle_uuid\":\"[BUNDLE-UUID]\",\"template_name\":\"dbt-sql\",\"template_enum_args\":[{\"key\":\"personal_schemas\",\"value\":\"yes, use a schema based on the current user name during development\"}]}}}}"
"{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[CMD-EXEC-ID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"bundle_init\",\"operating_system\":\"[OS]\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"bundle_init_event\":{\"bundle_uuid\":\"[BUNDLE-UUID]\",\"template_name\":\"dbt-sql\",\"template_enum_args\":[{\"key\":\"personal_schemas\",\"value\":\"yes, use a schema based on the current user name during development\"},{\"key\":\"serverless\",\"value\":\"yes\"}]}}}}"
]
}
}
4 changes: 4 additions & 0 deletions acceptance/bundle/templates/telemetry/dbt-sql/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Refer to the README.md file for full "getting started" guide and production setu
{
"key": "personal_schemas",
"value": "yes, use a schema based on the current user name during development"
},
{
"key": "serverless",
"value": "yes"
}
]
}
Expand Down
19 changes: 11 additions & 8 deletions libs/template/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,18 @@ func TestBuiltinDbtTemplateValid(t *testing.T) {
for _, personal_schemas := range []string{"yes", "no"} {
for _, target := range []string{"dev", "prod"} {
for _, isServicePrincipal := range []bool{true, false} {
config := map[string]any{
"project_name": "my_project",
"http_path": "/sql/1.0/warehouses/123",
"default_catalog": "hive_metastore",
"personal_schemas": personal_schemas,
"shared_schema": "lennart",
for _, serverless := range []string{"yes", "no"} {
config := map[string]any{
"project_name": "my_project",
"http_path": "/sql/1.0/warehouses/123",
"default_catalog": "hive_metastore",
"personal_schemas": personal_schemas,
"shared_schema": "lennart",
"serverless": serverless,
}
build := false
assertBuiltinTemplateValid(t, "dbt-sql", config, target, isServicePrincipal, build, t.TempDir())
}
build := false
assertBuiltinTemplateValid(t, "dbt-sql", config, target, isServicePrincipal, build, t.TempDir())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
"pattern_match_failure_message": "Invalid schema name.",
"description": "\nPlease provide an initial schema during development.\ndefault_schema",
"order": 5
},
"serverless": {
"type": "string",
"default": "yes",
"enum": ["yes", "no"],
"description": "Use serverless compute",
"order": 6
}
},
"success_message": "\n📊 Your new project has been created in the '{{.project_name}}' directory!\nIf you already have dbt installed, just type 'cd {{.project_name}}; dbt init' to get started.\nRefer to the README.md file for full \"getting started\" guide and production setup instructions.\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{$with_serverless := (eq .serverless "yes") -}}

resources:
jobs:
{{.project_name}}_job:
Expand All @@ -15,6 +17,9 @@ resources:

tasks:
- task_key: dbt
{{- if $with_serverless }}
environment_key: default
{{- end }}
dbt_task:
project_directory: ../
# The default schema, catalog, etc. are defined in ../dbt_profiles/profiles.yml
Expand All @@ -32,6 +37,8 @@ resources:
- 'dbt run --target=${bundle.target}'
{{- end}}

{{- if not $with_serverless }}

libraries:
- pypi:
package: dbt-databricks>=1.8.0,<2.0.0
Expand All @@ -46,3 +53,14 @@ resources:
spark.databricks.cluster.profile: singleNode
custom_tags:
ResourceClass: SingleNode
{{- end }}

{{- if $with_serverless }}

environments:
- environment_key: default
spec:
environment_version: "2"
dependencies:
- dbt-databricks>=1.8.0,<2.0.0
{{- end }}
Loading