dbutils.widgets.dropdown() issue: com.databricks.dbutils_v1.TooManyDefaultChoices: Too many default choices (1116). Limit is 1024

2020-09-21T12:44:16.483+00:00

HI, While running dbutils.widgets.dropdown(), I face the following issue: com.databricks.dbutils_v1.TooManyDefaultChoices: Too many default choices (1116). Limit is 1024. I searched but could not find an answer, how to change the default value. For sure, I have more than 1024 unique values. Please try to provide the answers. Thanks in advance. Regards, Chaitanya

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,047 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,376 Reputation points Microsoft Employee
    2020-09-21T23:30:30.267+00:00

    Hello @Chaitanya Kumar Dondapati (Volkswagen) ,

    The error seems to be misleading here . The below code just works fine .

    dbutils.widgets.dropdown("1", "500", [str(x) for x in range(1, 1024)], "test")  
    

    Now lets increase the range by 1

    dbutils.widgets.dropdown("0", "500", [str(x) for x in range(0, 1024)], "test")  
    


    com.databricks.dbutils_v1.TooManyDefaultChoices: Too many default choices (1024). Limit is 1024.

    Even though the the error message says defaults , i am very confident that its nothing to do with that .

    On your side the work around should be to reduce the dataset . Unfortunately i have not found any documentation on this limitation .

    Thanks Himanshu

    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members