thoughtspot / cs_tools

Scale your ThoughtSpot adoption with tools created by the ThoughtSpot Solutions Consulting organization.
https://thoughtspot.github.io/cs_tools/
Other
8 stars 5 forks source link

Error on scriptability when exporting connections #145

Open felipemm opened 3 months ago

felipemm commented 3 months ago

First Stop

Platform Configuration

image

Description

running cs_tools tools scriptability export --include-types connection --org 0 . --config prod causes the following error:

TMLDecodeError: init() got an unexpected keyword argument 'code'
supplied data does not produce a valid TML (Connection) document

felipe.matos@8486-MB: /Users/felipe.matos/dataviz/cs_tools/tmlfs  
➜   cs_tools tools scriptability export --include-types connection --org 0 . --config prod        
[12:44:39] INFO     Attempting Basic authentication                                                                                                                         thoughtspot.py:213
[12:44:40] INFO     Attempting Basic authentication in org id 0                                                                                                             thoughtspot.py:213
                    ╭──────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────╮                    
                    │ /Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.9/site-packages/cs_tools/cli/tools/scriptability/app.py:256 in      │                    
                    │ scriptability_export                                                                                                                               │                    
                    │                                                                                                                                                    │                    
                    │   253 │   exported. For example, if you export for the "finance" tag and author "user123",                                                         │                    
                    │   254 │   then only content owned by that user with the "finance" tag will be exported.                                                            │                    
                    │   255 │   """                                                                                                                                      │                    
                    │ ❱ 256 │   export(                                                                                                                                  │                    
                    │   257 │   │   ts=ctx.obj.thoughtspot,                                                                                                              │                    
                    │   258 │   │   path=directory,                                                                                                                      │                    
                    │   259 │   │   tags=tags,                                                                                                                           │                    
                    │                                                                                                                                                    │                    
                    │ /Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.9/site-packages/cs_tools/cli/tools/scriptability/_export.py:130 in  │                    
                    │ export                                                                                                                                             │                    
                    │                                                                                                                                                    │                    
                    │   127 │   │   with rich_console.status(f"[b green]exporting {guid} ({metadata_type}) {with_} a                                                     │                    
                    │   128 │   │   │   try:                                                                                                                             │                    
                    │   129 │   │   │   │   if metadata_type == TMLSupportedContent.connection:                                                                          │                    
                    │ ❱ 130 │   │   │   │   │   r = _download_connection(ts=ts, tmlfs=tmlfs, guid=guid)                                                                  │                    
                    │   131 │   │   │   │   else:                                                                                                                        │                    
                    │   132 │   │   │   │   │   r = _download_tml(ts=ts, tmlfs=tmlfs, guid=guid, export_associated=e                                                     │                    
                    │   133                                                                                                                                              │                    
                    │                                                                                                                                                    │                    
                    │ /Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.9/site-packages/cs_tools/cli/tools/scriptability/_export.py:164 in  │                    
                    │ _download_connection                                                                                                                               │                    
                    │                                                                                                                                                    │                    
                    │   161 │   Connections aren't supported by TML yet.                                                                                                 │                    
                    │   162 │   """                                                                                                                                      │                    
                    │   163 │   r = ts.api.v1.connection_export(guid=guid)                                                                                               │                    
                    │ ❱ 164 │   tml = Connection.loads(r.text)                                                                                                           │                    
                    │   165 │   tml.guid = guid                                                                                                                          │                    
                    │   166 │                                                                                                                                            │                    
                    │   167 │   r = TMLExportResponse(                                                                                                                   │                    
                    │                                                                                                                                                    │                    
                    │ /Users/felipe.matos/Library/Application Support/cs_tools/.cs_tools/lib/python3.9/site-packages/thoughtspot_tml/_tml.py:179 in loads                │                    
                    │                                                                                                                                                    │                    
                    │   176 │   │   try:                                                                                                                                 │                    
                    │   177 │   │   │   instance = cls(**document)                                                                                                       │                    
                    │   178 │   │   except TypeError as e:                                                                                                               │                    
                    │ ❱ 179 │   │   │   raise TMLDecodeError(cls, data=document, message=str(e)) from None  # type:                                                      │                    
                    │   180 │   │                                                                                                                                        │                    
                    │   181 │   │   return instance                                                                                                                      │                    
                    │   182                                                                                                                                              │                    
                    ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                    
                    TMLDecodeError: __init__() got an unexpected keyword argument 'code'                                                                                                      
                    supplied data does not produce a valid TML (Connection) document                                                                                                          

                                                      ╭───────────────────── 🤷  This is an unhandled error!  🤷 ─────────────────────╮                                                       
                                                      │                                                                               │                                                       
                                                      │ If you encounter this message more than once, please help by letting us know! │                                                       
                                                      │                                                                               │                                                       
                                                      │           GitHub: https://github.com/thoughtspot/cs_tools/issues/new/choose   │                                                       
                                                      │                                                                               │                                                       
                                                      ╰──────────── Run cs_tools logs report to send us your last error. ─────────────╯                                                       
boonhapus commented 3 months ago

@felipemm What ThoughtSpot version are you on?

felipemm commented 3 months ago

9.10.5

felipemm commented 3 months ago

I know 9.12 we tml for conns, is this why?

boonhapus commented 3 months ago

That's the most likely cause, @felipemm . I have to build the latest version of thoughtspot_tml. I should have some time on Tuesday to be able to do that. There's a cs_tools self sync command which brings this dependency up to date, so that I can push code to that project without requiring a bunch of cs_tools users to update.

boonhapus commented 2 months ago

@felipemm just looking into this after deploying the newest thoughtspot_tml (2.0.16) ... I don't see any attribute for .code in the new Connection TML spec. I'm thinking this may actually be that the API call to fetch the connection details actually failed and returned an error code instead.

Can you try re-running the command and if you see the error again, load your last few log files here?

cs_tools logs report --latest 5

Then use the secure file share link below, which routes to the CS Tools team directly. https://thoughtspot.egnyte.com/ul/1bK0dz05L6