Skip to content

Commit 076c18e

Browse files
Cleanup
1 parent 4a84af6 commit 076c18e

File tree

7 files changed

+24
-32
lines changed

7 files changed

+24
-32
lines changed

acceptance/bundle/templates/dbt-sql/output/my_dbt_sql/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ These profiles define the default warehouse, catalog, schema, and any other
9393
target-specific settings. Read more about dbt profiles on Databricks at
9494
https://docs.databricks.com/en/workflows/jobs/how-to/use-dbt-in-workflows.html#advanced-run-dbt-with-a-custom-profile.
9595
96-
To change the warehouse, catalog, or schema used by deployed dbt jobs,
97-
edit the settings in `dbt_profiles/profiles.yml`.
98-
9996
The target workspaces for staging and prod are defined in `databricks.yml`.
10097
You can manually deploy based on these configurations (see below).
10198
Or you can use CI/CD to automate deployment. See

experimental/apps-mcp/lib/middlewares/warehouse.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func getDefaultWarehouse(ctx context.Context) (*sql.EndpointInfo, error) {
8585
return nil, fmt.Errorf("get databricks client: %w", err)
8686
}
8787

88+
// first resolve DATABRICKS_WAREHOUSE_ID env variable
8889
warehouseID := env.Get(ctx, "DATABRICKS_WAREHOUSE_ID")
8990
if warehouseID != "" {
9091
warehouse, err := w.Warehouses.Get(ctx, sql.GetWarehouseRequest{

libs/databrickscfg/cfgpickers/clusters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func AskForCluster(ctx context.Context, w *databricks.WorkspaceClient, filters .
194194
Items: compatible,
195195
Searcher: func(input string, idx int) bool {
196196
lower := strings.ToLower(compatible[idx].ClusterName)
197-
return strings.Contains(lower, input)
197+
return strings.Contains(lower, strings.ToLower(input))
198198
},
199199
StartInSearchMode: true,
200200
Templates: &promptui.SelectTemplates{

libs/databrickscfg/cfgpickers/warehouses.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/manifoldco/promptui"
1818
)
1919

20-
var ErrNoCompatibleWarehouses = errors.New("no compatible warehouses. You can explicitly set the warehouse ID using the DATABRICKS_WAREHOUSE_ID environment variable")
20+
var ErrNoCompatibleWarehouses = errors.New("no compatible warehouses")
2121

2222
type warehouseFilter func(sql.EndpointInfo) bool
2323

libs/jsonschema/schema.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ type Schema struct {
6565
// here: https://github.com/google/re2/wiki/Syntax
6666
Pattern string `json:"pattern,omitempty"`
6767

68-
// Format defines a semantic format for string values (e.g., "date-time", "email", "uri").
69-
// For templates, custom formats like "warehouse_path" trigger special input handling.
68+
// Format specifies custom input handling. Supported: "warehouse_path".
7069
Format string `json:"format,omitempty"`
7170

7271
// Extension embeds our custom JSON schema extensions.

libs/template/config.go

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,14 @@ func (c *config) assignDefaultValues(r *renderer) error {
115115
continue
116116
}
117117

118+
// Resolve custom formats (e.g., warehouse_path auto-selects the default warehouse)
118119
if property.Format != "" {
119120
val, err := c.resolveFormat(property.Format, "")
120121
if err != nil {
121122
return err
122123
}
123-
if val != "" {
124-
c.values[name] = val
125-
continue
126-
}
124+
c.values[name] = val
125+
continue
127126
}
128127

129128
// No default value defined for the property
@@ -200,34 +199,33 @@ func (c *config) skipPrompt(p jsonschema.Property, r *renderer) (bool, error) {
200199

201200
func (c *config) promptOnce(property *jsonschema.Schema, name, defaultVal, description string) error {
202201
var userInput string
203-
var err error
204202

205203
if property.Format != "" {
204+
var err error
206205
userInput, err = c.resolveFormat(property.Format, description)
207206
if err != nil {
208207
return err
209208
}
210-
}
211-
212-
if userInput == "" {
213-
if property.Enum != nil {
214-
options, err := property.EnumStringSlice()
215-
if err != nil {
216-
return err
217-
}
218-
userInput, err = cmdio.AskSelect(c.ctx, description, options)
219-
if err != nil {
220-
return err
221-
}
222-
} else {
223-
userInput, err = cmdio.Ask(c.ctx, description, defaultVal)
224-
if err != nil {
225-
return err
226-
}
209+
} else if property.Enum != nil {
210+
// List options for the user to select from
211+
options, err := property.EnumStringSlice()
212+
if err != nil {
213+
return err
214+
}
215+
userInput, err = cmdio.AskSelect(c.ctx, description, options)
216+
if err != nil {
217+
return err
218+
}
219+
} else {
220+
var err error
221+
userInput, err = cmdio.Ask(c.ctx, description, defaultVal)
222+
if err != nil {
223+
return err
227224
}
228225
}
229226

230227
// Convert user input string back to a Go value
228+
var err error
231229
c.values[name], err = property.ParseString(userInput)
232230
if err != nil {
233231
// Show error and retry if validation fails

libs/template/templates/dbt-sql/template/{{.project_name}}/README.md.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ These profiles define the default warehouse, catalog, schema, and any other
9393
target-specific settings. Read more about dbt profiles on Databricks at
9494
https://docs.databricks.com/en/workflows/jobs/how-to/use-dbt-in-workflows.html#advanced-run-dbt-with-a-custom-profile.
9595

96-
To change the warehouse, catalog, or schema used by deployed dbt jobs,
97-
edit the settings in `dbt_profiles/profiles.yml`.
98-
9996
The target workspaces for staging and prod are defined in `databricks.yml`.
10097
You can manually deploy based on these configurations (see below).
10198
Or you can use CI/CD to automate deployment. See

0 commit comments

Comments
 (0)