-
Notifications
You must be signed in to change notification settings - Fork 176
Added support for creating SQL warehouses in DABs #3129
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3d5cb44
Added support for creating SQL warehouses
andrewnester db9efbf
added support for direct deployment
andrewnester 8e99f9e
update schema
andrewnester fdb9db5
fix test
andrewnester 4708813
fix schema
andrewnester 9edec27
Merge branch 'main' into feature/sql-warehouse
andrewnester 1ba7364
Merge branch 'main' into feature/sql-warehouse
andrewnester fbd10ff
fix schema and test
andrewnester fdc3da5
update test output
andrewnester b01d99b
fix state test
andrewnester f75a70b
cleanup test
andrewnester 769ffdb
Merge branch 'main' into feature/sql-warehouse
andrewnester fe08986
fix lint
andrewnester e260310
added missing tests
andrewnester b3d5e87
Merge branch 'main' into feature/sql-warehouse
andrewnester ecf844b
lint + out test toml
andrewnester 967e0ec
updated defaults
andrewnester c9190e8
fixed test outout
andrewnester 94ae8bb
fixes
andrewnester 8297421
Merge branch 'main' into feature/sql-warehouse
andrewnester 47936e9
fixes
andrewnester 66631a4
changelog
andrewnester 1486db0
updated schema
andrewnester b433b74
Merge branch 'main' into feature/sql-warehouse
andrewnester 8fee42b
fix dashboard schema
andrewnester 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
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,12 @@ | ||
| bundle: | ||
| name: test_sql_warehouse | ||
|
|
||
| resources: | ||
| sql_warehouses: | ||
| test_sql_warehouse: | ||
| name: sql_warehouse_name | ||
| cluster_size: X-Large | ||
| enable_serverless_compute: true | ||
| max_num_clusters: 1 | ||
| min_num_clusters: 1 | ||
| auto_stop_mins: 120 | ||
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,6 @@ | ||
| Local = true | ||
| Cloud = true | ||
| CloudSlow = true | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"] |
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,144 @@ | ||
|
|
||
| >>> [CLI] bundle validate | ||
| Name: test_sql_warehouse | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
|
|
||
| Validation OK! | ||
|
|
||
| >>> [CLI] bundle validate -o json | ||
| { | ||
| "test_sql_warehouse": { | ||
| "auto_stop_mins": 120, | ||
| "cluster_size": "X-Large", | ||
| "enable_photon": true, | ||
| "enable_serverless_compute": true, | ||
| "max_num_clusters": 1, | ||
| "min_num_clusters": 1, | ||
| "name": "sql_warehouse_name", | ||
| "permissions": [], | ||
| "spot_instance_policy": "COST_OPTIMIZED" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test_sql_warehouse | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| test_sql_warehouse: | ||
| Name: sql_warehouse_name | ||
| URL: (not deployed) | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Verify the create request | ||
| >>> jq select(.method == "POST" and (.path | contains("/sql/warehouses"))) out.requests.txt | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/sql/warehouses", | ||
| "body": { | ||
| "auto_stop_mins": 120, | ||
| "cluster_size": "X-Large", | ||
| "enable_photon": true, | ||
| "enable_serverless_compute": true, | ||
| "max_num_clusters": 1, | ||
| "min_num_clusters": 1, | ||
| "name": "sql_warehouse_name", | ||
| "spot_instance_policy": "COST_OPTIMIZED" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test_sql_warehouse | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| test_sql_warehouse: | ||
| Name: sql_warehouse_name | ||
| URL: [DATABRICKS_URL]/sql/warehouses/[UUID]?o=[NUMID] | ||
|
|
||
| === Update the warehouse name | ||
| >>> update_file.py databricks.yml sql_warehouse_name sql_warehouse_name_2 | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| === Verify the update request | ||
| >>> jq select(.method == "POST" and (.path | contains("/sql/warehouses")) and (.body."name" == "sql_warehouse_name_2")) out.requests.txt | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/sql/warehouses/[UUID]/edit", | ||
| "body": { | ||
| "auto_stop_mins": 120, | ||
| "cluster_size": "X-Large", | ||
| "enable_photon": true, | ||
| "enable_serverless_compute": true, | ||
| "max_num_clusters": 1, | ||
| "min_num_clusters": 1, | ||
| "name": "sql_warehouse_name_2", | ||
| "spot_instance_policy": "COST_OPTIMIZED" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test_sql_warehouse | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| test_sql_warehouse: | ||
| Name: sql_warehouse_name_2 | ||
| URL: [DATABRICKS_URL]/sql/warehouses/[UUID]?o=[NUMID] | ||
|
|
||
| === Destroy the warehouse | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete sql_warehouse test_sql_warehouse | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! | ||
|
|
||
| === Verify the destroy request | ||
| >>> jq select(.method == "DELETE" and (.path | contains("/sql/warehouses"))) out.requests.txt | ||
| { | ||
| "method": "DELETE", | ||
| "path": "/api/2.0/sql/warehouses/[UUID]" | ||
| } | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test_sql_warehouse | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| test_sql_warehouse: | ||
| Name: sql_warehouse_name_2 | ||
| URL: (not deployed) | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test_sql_warehouse/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
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,35 @@ | ||
| trace $CLI bundle validate | ||
| trace $CLI bundle validate -o json | jq ".resources.sql_warehouses" | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
| trace $CLI bundle deploy | ||
|
andrewnester marked this conversation as resolved.
|
||
|
|
||
| title "Verify the create request" | ||
| trace jq 'select(.method == "POST" and (.path | contains("/sql/warehouses")))' out.requests.txt | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| title "Update the warehouse name" | ||
| trace update_file.py databricks.yml sql_warehouse_name sql_warehouse_name_2 | ||
| trace $CLI bundle deploy | ||
|
|
||
| title "Verify the update request" | ||
| trace jq 'select(.method == "POST" and (.path | contains("/sql/warehouses")) and (.body."name" == "sql_warehouse_name_2"))' out.requests.txt | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| title "Destroy the warehouse" | ||
| trace $CLI bundle destroy --auto-approve | ||
|
|
||
| title "Verify the destroy request" | ||
| trace jq 'select(.method == "DELETE" and (.path | contains("/sql/warehouses")))' out.requests.txt | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| rm out.requests.txt | ||
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,9 @@ | ||
| Cloud = true | ||
| Local = true | ||
| CloudSlow = true | ||
| RecordRequests = true | ||
|
|
||
|
|
||
| Ignore = [ | ||
| "databricks.yml", | ||
| ] |
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/deployment/bind/sql_warehouse/databricks.yml
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 @@ | ||
| resources: | ||
| sql_warehouses: | ||
| sql_warehouse1: | ||
| name: "DEFAULT Test SQL Warehouse" | ||
| cluster_size: X-Large |
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/deployment/bind/sql_warehouse/out.test.toml
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 @@ | ||
| Local = true | ||
| Cloud = false | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_CLI_DEPLOYMENT = ["terraform"] |
31 changes: 31 additions & 0 deletions
31
acceptance/bundle/deployment/bind/sql_warehouse/output.txt
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,31 @@ | ||
|
|
||
| >>> [CLI] bundle deployment bind sql_warehouse1 [SQL-WAREHOUSE-ID] --auto-approve | ||
| Updating deployment state... | ||
| Successfully bound sql_warehouse with an id '[SQL-WAREHOUSE-ID]'. Run 'bundle deploy' to deploy changes to your workspace | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test-bundle-$UNIQUE_NAME | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle-$UNIQUE_NAME/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| sql_warehouse1: | ||
| Name: DEFAULT Test SQL Warehouse | ||
| URL: [DATABRICKS_URL]/sql/warehouses/[SQL-WAREHOUSE-ID]?o=[NUMID] | ||
|
|
||
| >>> [CLI] bundle deployment unbind sql_warehouse1 | ||
| Updating deployment state... | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: test-bundle-$UNIQUE_NAME | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle-$UNIQUE_NAME/default | ||
| Resources: | ||
| SQL Warehouses: | ||
| sql_warehouse1: | ||
| Name: DEFAULT Test SQL Warehouse | ||
| 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,6 @@ | ||
| SQL_WAREHOUSE_ID="0123-456789-warehouse0" | ||
| trace $CLI bundle deployment bind sql_warehouse1 "${SQL_WAREHOUSE_ID}" --auto-approve | ||
| trace $CLI bundle summary | ||
|
|
||
| trace $CLI bundle deployment unbind sql_warehouse1 | ||
| 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,49 @@ | ||
| Local = true | ||
| Cloud = false | ||
| BundleConfigTarget = "databricks.yml" | ||
|
|
||
| Ignore = [ | ||
| ".databricks" | ||
| ] | ||
|
|
||
| [[Repls]] | ||
| Old = "[0-9]{4}-[0-9]{6}-[0-9a-z]{10}" | ||
| New = "[SQL-WAREHOUSE-ID]" | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/sql/warehouses" | ||
| Response.Body = ''' | ||
| { | ||
| "warehouses": [ | ||
| { | ||
| "id": "0123-456789-warehouse0", | ||
| "name": "Test SQL Warehouse" | ||
| } | ||
| ] | ||
| } | ||
| ''' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/sql/warehouses/{warehouse_id}" | ||
| Response.Body = ''' | ||
| { | ||
| "warehouses": [ | ||
| { | ||
| "id": "0123-456789-warehouse0", | ||
| "name": "Test SQL Warehouse" | ||
| } | ||
| ] | ||
| } | ||
| ''' | ||
|
|
||
| [[Server]] | ||
| Pattern = "GET /api/2.0/preview/sql/data_sources" | ||
| Response.Body = ''' | ||
| [ | ||
| { | ||
| "id": "0123-456789-datasource0", | ||
| "name": "Test Data Source", | ||
| "warehouse_id": "0123-456789-warehouse0" | ||
| } | ||
| ] | ||
| ''' |
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
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.