Skip to content

Commit 2c0f303

Browse files
docstring for _filter_session_configuration
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent e48a6fb commit 2c0f303

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/databricks/sql/backend/sea/backend.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,27 @@
5252
def _filter_session_configuration(
5353
session_configuration: Optional[Dict[str, Any]],
5454
) -> Dict[str, str]:
55+
"""
56+
Filter and normalise the provided session configuration parameters.
57+
58+
The Statement Execution API supports only a subset of SQL session
59+
configuration options. This helper validates the supplied
60+
``session_configuration`` dictionary against the allow-list defined in
61+
``ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP`` and returns a new
62+
dictionary that contains **only** the supported parameters.
63+
64+
Args:
65+
session_configuration: Optional mapping of session configuration
66+
names to their desired values. Key comparison is
67+
case-insensitive.
68+
69+
Returns:
70+
Dict[str, str]: A dictionary containing only the supported
71+
configuration parameters with lower-case keys and string values. If
72+
*session_configuration* is ``None`` or empty, an empty dictionary is
73+
returned.
74+
"""
75+
5576
if not session_configuration:
5677
return {}
5778

0 commit comments

Comments
 (0)