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 @@ -18,5 +18,6 @@ See more details here: ([#3225](https://github.com/databricks/cli/pull/3225))
* [Breaking Change] Remove deprecated path fallback mechanism for jobs and pipelines ([#3225](https://github.com/databricks/cli/pull/3225))
* Add support for Lakebase synced database tables in DABs ([#3467](https://github.com/databricks/cli/pull/3467))
* Rename Delta Live Tables to Lakeflow Declarative Pipelines in the default-python template ([#3476](https://github.com/databricks/cli/pull/3476)).
* Fixed bundle init not working on Standard tier ([#3496](https://github.com/databricks/cli/pull/3496))

### API Changes
7 changes: 7 additions & 0 deletions acceptance/bundle/templates/default-python/no-uc/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"project_name": "my_default_python",
"include_notebook": "yes",
"include_dlt": "yes",
"include_python": "yes",
"serverless": "no"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need also to test serverless=yes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's useful, serverless requires UC by definition

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Local = true
Cloud = false

[EnvMatrix]
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
10 changes: 10 additions & 0 deletions acceptance/bundle/templates/default-python/no-uc/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

>>> [CLI] bundle init default-python --config-file ./input.json --output-dir output

Welcome to the default Python template for Databricks Asset Bundles!
Workspace to use (auto-detected, edit in 'my_default_python/databricks.yml'): [DATABRICKS_URL]

✨ Your new project has been created in the 'my_default_python' directory!

Please refer to the README.md file for "getting started" instructions.
See also the documentation at https://docs.databricks.com/dev-tools/bundles/index.html.
3 changes: 3 additions & 0 deletions acceptance/bundle/templates/default-python/no-uc/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trace $CLI bundle init default-python --config-file ./input.json --output-dir output

rm -rf output
4 changes: 4 additions & 0 deletions acceptance/bundle/templates/default-python/no-uc/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[Server]]
Pattern = "GET /api/2.1/unity-catalog/current-metastore-assignment"
Response.StatusCode = 404
Response.Body = "{\"error_code\": \"FEATURE_DISABLED\", \"message\": \"Unity Catalog is not available for feature tier STANDARD_TIER.\"}"
9 changes: 8 additions & 1 deletion libs/template/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"os"
"regexp"
"slices"
"strings"
"text/template"

Expand Down Expand Up @@ -38,6 +39,12 @@ var (
cachedCatalog *string
)

var metastoreDisabledErrorCodes = []string{
"PERMISSION_DENIED",
"METASTORE_DOES_NOT_EXIST", // Default metastore is not assigned to the workspace.
"FEATURE_DISABLED", // Unity Catalog is not available for feature tier STANDARD_TIER.
}

// UUID that is stable for the duration of the template execution. This can be used
// to populate the `bundle.uuid` field in databricks.yml by template authors.
//
Expand Down Expand Up @@ -141,7 +148,7 @@ func loadHelpers(ctx context.Context) template.FuncMap {
metastore, err := w.Metastores.Current(ctx)
if err != nil {
var aerr *apierr.APIError
if errors.As(err, &aerr) && (aerr.ErrorCode == "PERMISSION_DENIED" || aerr.ErrorCode == "METASTORE_DOES_NOT_EXIST") {
if errors.As(err, &aerr) && slices.Contains(metastoreDisabledErrorCodes, aerr.ErrorCode) {
// Ignore: access denied or workspace doesn't have a metastore assigned
empty_default := ""
cachedCatalog = &empty_default
Expand Down
Loading