Repository navigation
Add features bundle resource #6952
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
Open
Daniel114510
wants to merge
11
commits into
main
Choose a base branch
from
add-features-bundle-resource
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1cf9fc9
Add features bundle resource
Daniel114510 c8fb635
Add the pydabs support fixture and public API snapshot for features
Daniel114510 7ed10fb
Fix generated enum alignment and the changelog fragment
Daniel114510 3aaa0c2
Merge remote-tracking branch 'origin/main' into add-features-bundle-r…
Daniel114510 17080fa
Update feature goldens for the WORKSPACE_ID placeholder rename
Daniel114510 71fba4e
Run the features lifecycle test locally only until the service reache…
Daniel114510 3d4b75f
Enable the features invariant configs and recreate via deploy
Daniel114510 659921a
Run the features cloud tests now that the service is in production
Daniel114510 8dea686
Merge remote-tracking branch 'origin/main' into add-features-bundle-r…
Daniel114510 249b998
Regenerate for the Feature API public-preview spec and set the pydabs…
Daniel114510 c17ea2d
Skip the features deployment-history cloud legs until the service acc…
Daniel114510 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
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 @@ | ||
| * Add support for the `features` resource type. ([#6952](https://github.com/databricks/cli/pull/6952)) |
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,18 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| features: | ||
| feature1: | ||
| full_name: main.myschema.boundfeature | ||
| description: bound feature | ||
| source: | ||
| delta_table_source: | ||
| full_name: main.myschema.mysource | ||
| function: | ||
| column_selection: | ||
| column: amount | ||
| entities: | ||
| - name: account_id | ||
| timeseries_column: | ||
| name: event_ts |
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,2 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = [""] |
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,30 @@ | ||
|
|
||
| >>> [CLI] bundle deployment bind feature1 main.myschema.boundfeature --auto-approve | ||
| Successfully bound feature with an id 'main.myschema.boundfeature' | ||
| Run 'bundle deploy' to deploy changes to your workspace | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test-bundle | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default | ||
| Resources: | ||
| Features: | ||
| feature1: | ||
| Name: main.myschema.boundfeature | ||
| URL: [DATABRICKS_URL]/explore/data/features/main/myschema/boundfeature?w=[WORKSPACE_ID] | ||
|
|
||
| >>> [CLI] bundle deployment unbind feature1 | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test-bundle | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default | ||
| Resources: | ||
| Features: | ||
| feature1: | ||
| Name: main.myschema.boundfeature | ||
| URL: (not deployed) |
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,5 @@ | ||
| trace $CLI bundle deployment bind feature1 main.myschema.boundfeature --auto-approve | ||
| trace $CLI bundle summary | ||
|
|
||
| trace $CLI bundle deployment unbind feature1 | ||
| trace $CLI bundle summary |
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,22 @@ | ||
| Cloud = false | ||
|
|
||
| Ignore = [ | ||
| ".databricks", | ||
| ] | ||
|
|
||
| # The bind flow issues a GET to confirm the remote feature exists before binding. | ||
| [[Server]] | ||
| Pattern = "GET /api/2.0/feature-engineering/features/{full_name}" | ||
| Response.Body = ''' | ||
| { | ||
| "full_name": "main.myschema.boundfeature", | ||
| "catalog_name": "main", | ||
| "schema_name": "myschema", | ||
| "name": "boundfeature", | ||
| "description": "bound feature", | ||
| "source": {"delta_table_source": {"full_name": "main.myschema.mysource"}}, | ||
| "function": {"column_selection": {"column": "amount"}}, | ||
| "entities": [{"name": "account_id"}], | ||
| "timeseries_column": {"name": "event_ts"} | ||
| } | ||
| ''' |
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
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,23 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| features: | ||
| foo: | ||
| full_name: main.feat_inv_$UNIQUE_NAME.test_feature | ||
| description: This is a test feature # CAN_REMOVE | ||
| source: | ||
| delta_table_source: | ||
| full_name: main.feat_inv_$UNIQUE_NAME.source_table | ||
| function: | ||
| aggregation_function: | ||
| count_function: | ||
| input: value | ||
| time_window: | ||
| sliding: | ||
| window_duration: 604800s | ||
| slide_duration: 86400s | ||
| entities: | ||
| - name: id | ||
| timeseries_column: | ||
| name: timestamp | ||
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/invariant/configs/feature.yml.tmpl-cleanup.sh
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,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "Cleaning up temporary source table" | ||
| $CLI tables delete main.feat_inv_$UNIQUE_NAME.source_table || true | ||
| $CLI schemas delete main.feat_inv_$UNIQUE_NAME || true |
14 changes: 14 additions & 0 deletions
14
acceptance/bundle/invariant/configs/feature.yml.tmpl-init.sh
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,14 @@ | ||
| #!/bin/bash | ||
|
|
||
| # The feature's delta_table_source must already exist, and the invariant harness provisions no | ||
| # tables of its own. | ||
| echo "Creating temporary source table: main.feat_inv_$UNIQUE_NAME.source_table" | ||
|
|
||
| $CLI schemas create feat_inv_$UNIQUE_NAME main -o json | jq '{full_name}' | ||
|
|
||
| # MSYS_NO_PATHCONV=1 prevents Git Bash on Windows from converting /api/... to a filesystem path. | ||
| MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/sql/statements/" --json "{ | ||
| \"warehouse_id\": \"$TEST_DEFAULT_WAREHOUSE_ID\", | ||
| \"statement\": \"CREATE TABLE main.feat_inv_$UNIQUE_NAME.source_table (id INT, value STRING, timestamp TIMESTAMP) USING DELTA\", | ||
| \"wait_timeout\": \"45s\" | ||
| }" > /dev/null |
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
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
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
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
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
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
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,27 @@ | ||
| bundle: | ||
| name: my_project | ||
|
|
||
| sync: {paths: []} # don't need to copy files | ||
|
|
||
| python: | ||
| resources: | ||
| - "resources:load_resources" | ||
| mutators: | ||
| - "mutators:update_feature" | ||
|
|
||
| resources: | ||
| features: | ||
| my_feature_1: | ||
| full_name: main.default.my_feature_1 | ||
| description: "My Feature" | ||
| source: | ||
| delta_table_source: | ||
| full_name: main.default.my_source_1 | ||
| function: | ||
| aggregation_function: | ||
| count_function: | ||
| input: value | ||
| time_window: | ||
| sliding: | ||
| window_duration: 604800s | ||
| slide_duration: 86400s |
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,11 @@ | ||
| from dataclasses import replace | ||
|
|
||
| from databricks.bundles.core import feature_mutator | ||
| from databricks.bundles.features import Feature | ||
|
|
||
|
|
||
| @feature_mutator | ||
| def update_feature(feature: Feature) -> Feature: | ||
| assert isinstance(feature.description, str) | ||
|
|
||
| return replace(feature, description=f"{feature.description} (updated)") |
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,3 @@ | ||
| Cloud = true | ||
| EnvMatrix.DMS = ["", "true"] | ||
| EnvMatrix.PYDAB_VERSION = ["current"] |
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,62 @@ | ||
|
|
||
| >>> uv run [UV_ARGS] -q [CLI] bundle validate --output json | ||
| { | ||
| "experimental": { | ||
| "python": { | ||
| "mutators": [ | ||
| "mutators:update_feature" | ||
| ], | ||
| "resources": [ | ||
| "resources:load_resources" | ||
| ] | ||
| } | ||
| }, | ||
| "resources": { | ||
| "features": { | ||
| "my_feature_1": { | ||
| "description": "My Feature (updated)", | ||
| "full_name": "main.default.my_feature_1", | ||
| "function": { | ||
| "aggregation_function": { | ||
| "count_function": { | ||
| "input": "value" | ||
| }, | ||
| "time_window": { | ||
| "sliding": { | ||
| "slide_duration": "86400s", | ||
| "window_duration": "604800s" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "source": { | ||
| "delta_table_source": { | ||
| "full_name": "main.default.my_source_1" | ||
| } | ||
| } | ||
| }, | ||
| "my_feature_2": { | ||
| "description": "My Feature (2) (updated)", | ||
| "full_name": "main.default.my_feature_2", | ||
| "function": { | ||
| "aggregation_function": { | ||
| "count_function": { | ||
| "input": "value" | ||
| }, | ||
| "time_window": { | ||
| "sliding": { | ||
| "slide_duration": "86400s", | ||
| "window_duration": "604800s" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "source": { | ||
| "delta_table_source": { | ||
| "full_name": "main.default.my_source_2" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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,29 @@ | ||
| from databricks.bundles.core import Resources | ||
|
|
||
|
|
||
| def load_resources() -> Resources: | ||
| resources = Resources() | ||
|
|
||
| resources.add_feature( | ||
| "my_feature_2", | ||
| { | ||
| "full_name": "main.default.my_feature_2", | ||
| "description": "My Feature (2)", | ||
| "source": { | ||
| "delta_table_source": {"full_name": "main.default.my_source_2"}, | ||
| }, | ||
| "function": { | ||
| "aggregation_function": { | ||
| "count_function": {"input": "value"}, | ||
| "time_window": { | ||
| "sliding": { | ||
| "window_duration": "604800s", | ||
| "slide_duration": "86400s", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| ) | ||
|
|
||
| return resources |
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,5 @@ | ||
|
|
||
| trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ | ||
| jq "pick(.experimental.python, .resources)" | ||
|
|
||
| rm -fr .databricks __pycache__ |
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,4 @@ | ||
| Cloud = true | ||
|
|
||
| # features are only supported in the current version of the wheel | ||
| EnvMatrix.PYDAB_VERSION = ["current"] |
Oops, something went wrong.
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.