Skip to content
Draft
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 .nextchanges/bundles/features-uppercase-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix a feature whose `full_name` contains uppercase letters being recreated on every deploy. ([#7398](https://github.com/databricks/cli/pull/7398))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix a materialization set member whose `feature_name` contains uppercase letters failing to deploy, or recreating the set on every deploy. ([#7398](https://github.com/databricks/cli/pull/7398))
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
bundle:
name: test-bundle

resources:
features:
feature1:
full_name: main.myschema.MyFeature
source:
delta_table_source:
full_name: main.myschema.mysource
function:
aggregation_function:
count_function:
input: amount
time_window:
sliding:
window_duration: 604800s
slide_duration: 86400s
entities:
- name: account_id
timeseries_column:
name: event_ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.DMS = [""]
140 changes: 140 additions & 0 deletions acceptance/bundle/resources/features/uppercase-name/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
Created features.feature1
Files: 1 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py //feature-engineering
{
"method": "POST",
"path": "/api/2.0/feature-engineering/features",
"body": {
"entities": [
{
"name": "account_id"
}
],
"full_name": "main.myschema.MyFeature",
"function": {
"aggregation_function": {
"count_function": {
"input": "amount"
},
"time_window": {
"sliding": {
"slide_duration": "86400s",
"window_duration": "604800s"
}
}
}
},
"source": {
"delta_table_source": {
"full_name": "main.myschema.mysource"
}
},
"timeseries_column": {
"name": "event_ts"
}
}
}

=== UC lowercases the name, so the id is lowercase
>>> [CLI] bundle summary -o json
"main.myschema.myfeature"

=== A plan on an unchanged bundle skips the name instead of recreating the feature
>>> [CLI] bundle plan -o json
{
"resources.features.feature1": {
"action": "skip",
"changes": {
"full_name": {
"action": "skip",
"reason": "id_field"
}
}
}
}

>>> [CLI] bundle plan
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

=== Renaming the feature still recreates it
>>> update_file.py databricks.yml main.myschema.MyFeature main.myschema.MyOtherFeature

>>> [CLI] bundle plan
recreate features.feature1

Plan: 1 to add, 0 to change, 1 to delete, 0 unchanged

>>> [CLI] bundle deploy --auto-approve
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...

This action will result in the deletion or recreation of the following Feature Views.
A Feature View that has materialized features in a materialization set cannot be deleted or
recreated. Remove its materialized features from the set in a separate deploy first, then delete
or recreate the Feature View. Deleting or recreating a Feature View that a FeatureSpec serves is
not blocked, and leaves the FeatureSpec stale:
recreate resources.features.feature1
Recreated features.feature1
Files: 1 uploaded, 0 deleted
Resources: 1 created, 0 changed, 1 deleted, 0 unchanged

>>> print_requests.py //feature-engineering
{
"method": "DELETE",
"path": "/api/2.0/feature-engineering/features/main.myschema.myfeature"
}
{
"method": "POST",
"path": "/api/2.0/feature-engineering/features",
"body": {
"entities": [
{
"name": "account_id"
}
],
"full_name": "main.myschema.MyOtherFeature",
"function": {
"aggregation_function": {
"count_function": {
"input": "amount"
},
"time_window": {
"sliding": {
"slide_duration": "86400s",
"window_duration": "604800s"
}
}
}
},
"source": {
"delta_table_source": {
"full_name": "main.myschema.mysource"
}
},
"timeseries_column": {
"name": "event_ts"
}
}
}

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.features.feature1

This action will result in the deletion of the following Feature Views.
Deleting a Feature View that a FeatureSpec serves is not blocked, and leaves the FeatureSpec stale:
delete resources.features.feature1

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default

Destroy: 1 deleted

>>> print_requests.py //feature-engineering
{
"method": "DELETE",
"path": "/api/2.0/feature-engineering/features/main.myschema.myotherfeature"
}
18 changes: 18 additions & 0 deletions acceptance/bundle/resources/features/uppercase-name/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
trace $CLI bundle deploy
trace print_requests.py //feature-engineering

title "UC lowercases the name, so the id is lowercase"
trace $CLI bundle summary -o json | jq .resources.features.feature1.id

title "A plan on an unchanged bundle skips the name instead of recreating the feature"
trace $CLI bundle plan -o json | jq '.plan | map_values({action, changes: (.changes // {} | map_values({action, reason}) | with_entries(select(.key == "full_name")))})'
trace $CLI bundle plan

title "Renaming the feature still recreates it"
trace update_file.py databricks.yml "main.myschema.MyFeature" "main.myschema.MyOtherFeature"
trace $CLI bundle plan
trace $CLI bundle deploy --auto-approve
trace print_requests.py //feature-engineering

trace $CLI bundle destroy --auto-approve
trace print_requests.py //feature-engineering
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ignore = [
".databricks",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
bundle:
name: test-bundle

resources:
schemas:
myschema:
catalog_name: main
name: MySchema

features:
# The schema part of each name becomes ${resources.schemas.myschema.name}, which resolves to
# MySchema.
feata:
full_name: main.MySchema.FeatA
source:
delta_table_source:
full_name: main.myschema.mysource
function:
aggregation_function:
count_function:
input: amount
time_window:
sliding:
window_duration: 604800s
slide_duration: 86400s
entities:
- name: account_id
timeseries_column:
name: event_ts
featb:
full_name: main.MySchema.FeatB
source:
delta_table_source:
full_name: main.myschema.mysource
function:
aggregation_function:
count_function:
input: amount
time_window:
sliding:
window_duration: 604800s
slide_duration: 86400s
entities:
- name: account_id
timeseries_column:
name: event_ts

materialization_sets:
set1:
lifecycle:
depends_on:
- resource: features.featb
materialized_features:
- feature_name: ${resources.features.feata.full_name}
offline_store_config:
catalog_name: main
schema_name: myschema
table_name_prefix: offline
cron_schedule_trigger:
mode: MANUAL
cron_expression: "0 0 * * * ?"
- feature_name: main.MySchema.FeatB
offline_store_config:
catalog_name: main
schema_name: myschema
table_name_prefix: offline
cron_schedule_trigger:
mode: MANUAL
cron_expression: "0 0 * * * ?"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.DMS = [""]
Loading
Loading