Aws-data-wrangler: KeyError getting table description

Created on 21 Jun 2020  路  7Comments  路  Source: awslabs/aws-data-wrangler

Describe the bug

Calling wr.catalog.get_table_description on a Glue table that doesn't have a description results in a KeyError exception being raised.

To Reproduce

awswrangler==1.5.0
  1. Create a Glue table without a description.
  2. Call wr.catalog.get_table_description on the table.

Example

The table item exists, but does not have a description.

image

>>> wr.catalog.get_table_parameters(database="sa-m2", table="item")
{'CrawlerSchemaDeserializerVersion': '1.0', 'CrawlerSchemaSerializerVersion': '1.0', 'UPDATED_BY_CRAWLER': 'sa-m2', 'averageRecordSize': '25', 'classification': 'parquet', 'compressionType': 'none', 'objectCount': '54', 'recordCount': '12349020', 'sizeKey': '174628122', 'typeOfData': 'file'}
>>> wr.catalog.get_table_description(database="sa-m2", table="item")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/awswrangler/catalog.py", line 1670, in get_table_description
    desc: str = response["Table"]["Description"]
KeyError: 'Description'
bug

All 7 comments

@kinghuang Thank you for reporting it. We will fix and release a new version next week.

Hi @kinghuang !

I've just fixed it in our development branch, and will be released soon on version 1.6.0.

Could you test it, and give us some feedback?

To install the development branch:

pip install git+https://github.com/awslabs/aws-data-wrangler.git@dev

I just tried the development branch. It returns None now instead of raising an exception.

>>> wr.catalog.get_table_description(database="sa-m2", table="item")
>>> print(wr.catalog.get_table_description(database="sa-m2", table="item"))
None

I just tried the development branch. It returns None now instead of raising an exception.

>>> wr.catalog.get_table_description(database="sa-m2", table="item")
>>> print(wr.catalog.get_table_description(database="sa-m2", table="item"))
None

Is this the desired behavior, right?

Yes, I believe None is an appropriate return value when there is no description.

Released on version 1.6.0!

Hi @kinghuang !

It is totally off-topic, but we are stating a _"Who uses AWS Data Wrangler?"_ section. So feel free to add yourself if you want 馃槃 .

Was this page helpful?
0 / 5 - 0 ratings