Skip to content

Commit 09b1932

Browse files
robert-schmidtkeRobert Schmidtkekukushkingjaidisido
authored
fix: Return None for missing column and partition key comment (#2449)
* Return None for missing column and partition key comment * fix return type * extend returned example --------- Co-authored-by: Robert Schmidtke <[email protected]> Co-authored-by: kukushking <[email protected]> Co-authored-by: jaidisido <[email protected]>
1 parent fc50ec9 commit 09b1932

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

awswrangler/catalog/_get.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ def get_columns_comments(
961961
query_as_of_time: Optional[str] = None,
962962
catalog_id: Optional[str] = None,
963963
boto3_session: Optional[boto3.Session] = None,
964-
) -> Dict[str, str]:
964+
) -> Dict[str, Optional[str]]:
965965
"""Get all columns comments.
966966
967967
Note
@@ -987,8 +987,8 @@ def get_columns_comments(
987987
988988
Returns
989989
-------
990-
Dict[str, str]
991-
Columns comments. e.g. {"col1": "foo boo bar"}.
990+
Dict[str, Optional[str]]
991+
Columns comments. e.g. {"col1": "foo boo bar", "col2": None}.
992992
993993
Examples
994994
--------
@@ -1005,12 +1005,12 @@ def get_columns_comments(
10051005
),
10061006
)
10071007
)
1008-
comments: Dict[str, str] = {}
1008+
comments: Dict[str, Optional[str]] = {}
10091009
for c in response["Table"]["StorageDescriptor"]["Columns"]:
1010-
comments[c["Name"]] = c["Comment"]
1010+
comments[c["Name"]] = c.get("Comment")
10111011
if "PartitionKeys" in response["Table"]:
10121012
for p in response["Table"]["PartitionKeys"]:
1013-
comments[p["Name"]] = p["Comment"]
1013+
comments[p["Name"]] = p.get("Comment")
10141014
return comments
10151015

10161016

0 commit comments

Comments
 (0)