Skip to content
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

databricks warehouses set-workspace-warehouse-config errors with enable_serverless_compute is required #1560

Closed
antonsteenvoorden opened this issue Jul 3, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working CLI CLI related issues

Comments

@antonsteenvoorden
Copy link

antonsteenvoorden commented Jul 3, 2024

Describe the issue

databricks warehouses set-workspace-warehouse-config fails when providing a JSON.
The error is enable_serverless_compute is required even though this is part of the JSON on the root.

Steps to reproduce the behavior

  1. create JSON file sql-warehouse-global-settings.json with contents
{
  "security_policy":"DATA_ACCESS_CONTROL",
  "enable_serverless_compute": false,
  "data_access_config": [
    {
      "key": "spark.sql.warehouse.dir",
      "value": "/mnt/ADLS/spark-warehouse"
    }
  ],
  "enabled_warehouse_types": [
    {
      "enabled":true,
      "warehouse_type":"CLASSIC"
    },
    {
      "enabled":true,
      "warehouse_type":"PRO"
    }
  ],
  "sql_configuration_parameters": {}
}
  1. Run databricks warehouses set-workspace-warehouse-config --json @./sql-warehouse-global-settings.json
  2. See error

The same happens when:

  1. Omitting enable_serverless_compute from the JSON
  2. Adding an entry to enabled_warehouse_types with {"enabled":true, "warehouse_type":"SERVERLESS"}
  3. Enabling serverless compute via the workspace settings in the databricks UI and retrying all of the above

Expected Behavior

To have set the warehouse configuration. Also according to the API documentation this is not part of the payload.

Actual Behavior

It appears the JSON is validated against something undocumented and causes an error.
Additionally, this is also not returned in the json when calling databricks warehouses get-workspace-warehouse-config.

OS and CLI version

OS: MacOS Sonoma 14.4.1
Databricks-CLI: v0.222.0

Is this a regression?

Did this work in a previous version of the CLI? If so, which versions did you try?

Debug Logs

14:56:17  INFO start pid=84298 version=0.222.0 args="/opt/homebrew/bin/databricks, warehouses, set-workspace-warehouse-config, --json, @./config/sql-warehouse-global-settings.json, --debug"
14:56:18 DEBUG PUT /api/2.0/sql/config/warehouses
> {
>   "data_access_config": [
>     {
>       "key": "spark.sql.warehouse.dir",
>       "value": "/mnt/ADLS/spark-warehouse"
>     },
>   ],
>   "enabled_warehouse_types": [
>     {
>       "enabled": true,
>       "warehouse_type": "CLASSIC"
>     },
>     {
>       "enabled": true,
>       "warehouse_type": "PRO"
>     }
>   ],
>   "security_policy": "DATA_ACCESS_CONTROL",
>   "sql_configuration_parameters": {}
> }
< HTTP/2.0 400 Bad Request
< {
<   "error_code": "INVALID_PARAMETER_VALUE",
<   "message": "enable_serverless_compute is required."
< } pid=84298 sdk=true
14:56:18 DEBUG non-retriable error: enable_serverless_compute is required. pid=84298 sdk=true
Error: enable_serverless_compute is required.
14:56:18 ERROR failed execution pid=84298 exit_code=1 error="enable_serverless_compute is required."
@antonsteenvoorden antonsteenvoorden added the CLI CLI related issues label Jul 3, 2024
@pietern
Copy link
Contributor

pietern commented Jul 3, 2024

Thanks for reporting.

It is possible that this field hasn't been added to our API specs yet. I have flagged this with the relevant team.

In the mean time you can work around the issue by using the databricks api command and making a raw API call to /api/2.0/sql/config/warehouses with the same body.

@pietern pietern added the Bug Something isn't working label Jul 3, 2024
@andrewnester
Copy link
Contributor

This seems to be related to the issue in Go SDK when fales boolean values marked as omitempty are being dropped from request body as a result of unmarshalling

databricks/databricks-sdk-go#1002

@andrewnester andrewnester self-assigned this Oct 4, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2024
## Changes
Added JSON input validation for CLI commands. Now when invalid JSON
passed as a payload to CLI commands, CLI performs input normalisation
and detects if there are any mismatches such as incorrect types, unknown
fields and etc.

This diagnostic information is printed in standard error output and does
not block command execution, so the change is backward compatible.

Fixes #1769 #1764 #1625 #1560


## Tests
Added unit tests

```
andrew.nester@HFW9Y94129 ~ % databricks jobs create --json '{"seeti}'
Error: error decoding JSON at (inline):1:2: unexpected EOF


andrew.nester@HFW9Y94129 ~ % databricks jobs create --json '{"seeti": true}'
Warning: unknown field: seeti
  in (inline):1:9

Error: Job settings must be specified.
```

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
@andrewnester
Copy link
Contributor

The fix for passing false values in JSON has been merged in #1771 and will be released in the next CLI release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working CLI CLI related issues
Projects
None yet
Development

No branches or pull requests

3 participants