@@ -511,10 +511,7 @@ def databases(
511511 df_dict : Dict [str , List ] = {"Database" : [], "Description" : []}
512512 for db in dbs :
513513 df_dict ["Database" ].append (db ["Name" ])
514- if "Description" in db :
515- df_dict ["Description" ].append (db ["Description" ])
516- else : # pragma: no cover
517- df_dict ["Description" ].append ("" )
514+ df_dict ["Description" ].append (db .get ("Description" , "" ))
518515 return pd .DataFrame (data = df_dict )
519516
520517
@@ -660,10 +657,7 @@ def tables(
660657 for tbl in tbls :
661658 df_dict ["Database" ].append (tbl ["DatabaseName" ])
662659 df_dict ["Table" ].append (tbl ["Name" ])
663- if "Description" in tbl :
664- df_dict ["Description" ].append (tbl ["Description" ])
665- else :
666- df_dict ["Description" ].append ("" )
660+ df_dict ["Description" ].append (tbl .get ("Description" , "" ))
667661 if "Columns" in tbl ["StorageDescriptor" ]:
668662 df_dict ["Columns" ].append (", " .join ([x ["Name" ] for x in tbl ["StorageDescriptor" ]["Columns" ]]))
669663 else :
@@ -1634,7 +1628,7 @@ def get_table_parameters(
16341628
16351629def get_table_description (
16361630 database : str , table : str , catalog_id : Optional [str ] = None , boto3_session : Optional [boto3 .Session ] = None
1637- ) -> str :
1631+ ) -> Optional [ str ] :
16381632 """Get table description.
16391633
16401634 Parameters
@@ -1651,8 +1645,8 @@ def get_table_description(
16511645
16521646 Returns
16531647 -------
1654- str
1655- Description.
1648+ Optional[ str]
1649+ Description if exists .
16561650
16571651 Examples
16581652 --------
@@ -1667,7 +1661,7 @@ def get_table_description(
16671661 args ["DatabaseName" ] = database
16681662 args ["Name" ] = table
16691663 response : Dict [str , Any ] = client_glue .get_table (** args )
1670- desc : str = response ["Table" ][ "Description" ]
1664+ desc : Optional [ str ] = response ["Table" ]. get ( "Description" , None )
16711665 return desc
16721666
16731667
0 commit comments