thoughtspot / thoughtspot_rest_api_v1_python

Python implementations of ThoughtSpot REST APIs V1 and V2
Other
3 stars 6 forks source link

metadata_tml_export optional parameters not checked in if statement #19

Closed charlieyu1996 closed 5 months ago

charlieyu1996 commented 5 months ago

Encountering an error when calling metadata_tml_export() with the following request:

    resp = self.client.metadata_tml_export(
        [],
        export_associated=False,
        export_fqn=True,
        metadata_request=request,
    )

File "/Users/username/Library/Caches/pypoetry/virtualenvs/turbotscli-9vOn4szK-py3.11/lib/python3.11/site-packages/thoughtspot_rest_api_v1/tsrestapiv2.py", line 465, in metadata_tml_export if edoc_format.upper() == 'YAML': ^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'upper'

This is caused by the method not checking edoc_format if it is not part of the request. And since it is set to optional, and defaulted to none, it should first check if edoc_format is not none first to avoid this error.

bryanthowell-ts commented 5 months ago

Thank you for finding this, I've added the additional check to v1.6.1 which will be available soon