Skip to content

Commit fb647df

Browse files
committed
fix(feature-flags): preserve case-insensitive boolean values
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
1 parent 4ed012f commit fb647df

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/databricks/sql/common/feature_flag.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _get_value(self, name: str) -> Any:
119119
try:
120120
return json.loads(raw) if raw is not None else None
121121
except (TypeError, ValueError):
122-
return None
122+
return {"true": True, "false": False}.get(str(raw).lower())
123123

124124
def get_bool(self, name: str, default_value: bool = False) -> bool:
125125
value = self._get_value(name)

‎tests/unit/test_telemetry.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,13 @@ def test_remove_instance_and_executor_cleanup(self):
11261126
"getter,raw,expected",
11271127
[
11281128
("bool", "true", True),
1129+
("bool", "True", True),
1130+
("bool", "TRUE", True),
1131+
("bool", "tRuE", True),
1132+
("bool", "false", False),
1133+
("bool", "False", False),
1134+
("bool", "FALSE", False),
1135+
("bool", "fAlSe", False),
11291136
("bool", '"true"', False),
11301137
("int32", "2147483647", 2147483647),
11311138
("int32", "2147483648", None),

0 commit comments

Comments
 (0)