Skip to content

Commit 516a4a5

Browse files
committed
PR feedback
1 parent c37999c commit 516a4a5

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

sqlmesh/core/config/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def _expand_json_strings_to_concrete_types(cls, data: t.Any) -> t.Any:
196196
for maybe_json_field_name in cls._get_list_and_dict_field_names():
197197
if (value := data.get(maybe_json_field_name)) and isinstance(value, str):
198198
# crude JSON check as we dont want to try and parse every string we get
199+
value = value.strip()
199200
if value.startswith("{") or value.startswith("["):
200201
data[maybe_json_field_name] = from_json(value)
201202

tests/core/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ def test_config_complex_types_supplied_as_json_strings_from_env(tmp_path: Path)
10041004
with mock.patch.dict(
10051005
os.environ,
10061006
{
1007-
"SQLMESH__GATEWAYS__BIGQUERY__CONNECTION__SCOPES": '["a","b","c"]',
1007+
"SQLMESH__GATEWAYS__BIGQUERY__CONNECTION__SCOPES": ' ["a","b","c"]', # note: leading whitespace is deliberate
10081008
"SQLMESH__GATEWAYS__BIGQUERY__CONNECTION__KEYFILE_JSON": '{ "foo": "bar" }',
10091009
},
10101010
):

0 commit comments

Comments
 (0)