Hi @Glasier
Thanks for the question and using MS Q&A platform.
It seems like the issue is with the way you are passing the Boolean value from Datafactory to the Databricks notebook. When using bool(dbutils.widgets.get("bool_var"))
, it always evaluates to True because the string is non-empty. To handle this correctly, you should explicitly check the string value and convert it to a Boolean accordingly:
bool_var_str = dbutils.widgets.get("bool_var")
# Convert the string to a Boolean
test_var = bool_var_str.lower() == 'true'
This code snippet ensures that test_var
correctly reflects the Boolean value based on the string received from DataFactory. Remember to pass 'False' from DataFactory when you want the Boolean variable to be False, and 'True' when you want it to be True.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.