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

Getting an error while using the cs_tools #167

Closed senapathi-at-hyatt closed 1 week ago

senapathi-at-hyatt commented 3 weeks ago

First Stop

Platform Configuration

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ Info snapshot taken on 2024-08-16 │ │ │ │ CS Tools: 1.5.9 │ │ Python Version: Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] │ │ System Info: Windows (detail: Windows-10-10.0.19045-SP0) │ │ Configs Directory: C:\Users\ {anonymous} \AppData\Roaming\cs_tools │ │ Activate VirtualEnv: C:\Users\ {anonymous} \AppData\Roaming\cs_tools.cs_tools\Scripts\Activate.ps1 │ │ System Python Path: C:\Program Files\Python312\python.exe │ │ Platform Tags: win-amd64 │ │ │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Description

cstools searchable is failing with below error.

cs_tools tools searchable bi-server --syncer file://C:\srinivas\thoughtspot\tools\Definition.toml --compact --config IDENTIFIER

below is the content of definition.toml.

[configuration] directory = 'C:\srinivas\thoughtspot\tools\result' delimiter = '|' escape_character = '\' save_strategy = APPEND

Need to upload log files securely?

cs_tools_logs.txt

boonhapus commented 3 weeks ago

@senapathi-at-hyatt the command you ran was...

cs_tools tools searchable bi-server --syncer file://C:\\srinivas\\thoughtspot\\tools\\Definition.toml --compact --config IDENTIFIER

can you change --syncer file:// to --syncer csv:// here?

senapathi-at-hyatt commented 3 weeks ago

Hi boonhapus, I got different error with cs_tools tools searchable bi-server --syncer csv://C:\srinivas\thoughtspot\tools\Definition.toml --compact --config IDENTIFIER


[INFO - 2024-08-16T12:08:10-0500] [cs_tools.thoughtspot - thoughtspot.login 213] Attempting Basic authentication [DEBUG - 2024-08-16T12:08:10-0500] [cs_tools.api._client - _client.__before_request__ 81] >>> [17:08:10] HTTP POST -> /callosum/v1/tspublic/v1/session/login === HEADERS === Headers({'host': 'hdp-ts-dev.thoughtspot.cloud', 'accept': '/', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'x-requested-by': 'CS Tools', 'user-agent': 'cs_tools/1.5.9 (+github: thoughtspot/cs_tools)', 'content-length': '58', 'content-type': 'application/x-www-form-urlencoded', 'cs-tools-request-start-utc-timestamp': '2024-08-16T17:08:10.907475+00:00'}) === DATA === {'username': 'Thought-API', 'password': '[secure]', 'rememberme': 'true', 'auth_token': '[secure]', 'secret_key': '[secure]', 'access_token': '[secure]'}

[DEBUG - 2024-08-16T12:09:08-0500] [cs_tools.api._client - _client.after_response__ 115] <<< [17:09:08] HTTP 204 <- /callosum/v1/tspublic/v1/session/login (57.179442s) [DEBUG - 2024-08-16T12:09:08-0500] [cs_tools.api._client - _client.before_request__ 81] >>> [17:09:08] HTTP GET -> /callosum/v1/tspublic/v1/session/info === HEADERS === Headers({'host': 'hdp-ts-dev.thoughtspot.cloud', 'accept': '/', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'x-requested-by': 'CS Tools', 'user-agent': 'cs_tools/1.5.9 (+github: thoughtspot/cs_tools)', 'cookie': 'JSESSIONID=fe999041-0fbf-4aaf-841c-bc667cd52445; clientId=9b1d63bc-1668-43a4-a0a2-1bda14559e0c', 'cs-tools-request-start-utc-timestamp': '2024-08-16T17:09:08.089634+00:00'})

[DEBUG - 2024-08-16T12:12:03-0500] [cs_tools.api._client - _client.__after_response__ 115] <<< [17:12:03] HTTP 502 <- /callosum/v1/tspublic/v1/session/info (175.303358s)

Invalid code.
Invalid Error Code
Back to home

[DEBUG - 2024-08-16T12:12:03-0500] [cs_tools.api._client - _client.__before_request__ 81] >>> [17:12:03] HTTP GET -> /callosum/v1/tspublic/v1/session/orgs === HEADERS === Headers({'host': 'hdp-ts-dev.thoughtspot.cloud', 'accept': '/', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'x-requested-by': 'CS Tools', 'user-agent': 'cs_tools/1.5.9 (+github: thoughtspot/cs_tools)', 'cookie': 'JSESSIONID=fe999041-0fbf-4aaf-841c-bc667cd52445; clientId=9b1d63bc-1668-43a4-a0a2-1bda14559e0c', 'cs-tools-request-start-utc-timestamp': '2024-08-16T17:12:03.408626+00:00'}) === PARAMS === {'batchsize': '-1', 'offset': '-1', 'auth_token': '[secure]', 'secret_key': '[secure]', 'password': '[secure]', 'access_token': '[secure]'}

[DEBUG - 2024-08-16T12:12:03-0500] [cs_tools.api._client - _client.__after_response__ 115] <<< [17:12:03] HTTP 502 <- /callosum/v1/tspublic/v1/session/orgs (0.042933s)

Invalid code.
Invalid Error Code
Back to home

[DEBUG - 2024-08-16T12:12:03-0500] [cs_tools.cli.commands.main - main.run 129] whoopsie, something went wrong! Traceback (most recent call last): File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\cli\commands\main.py", line 100, in run return_code = app(standalone_mode=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\typer\main.py", line 326, in call raise e File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\typer\main.py", line 309, in call return get_command(self)(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\click\core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\typer\core.py", line 723, in main return _main( ^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\typer\core.py", line 193, in _main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\cli\ux.py", line 36, in invoke stack.enter_context(dependency(ctx)) File "C:\Program Files\Python312\Lib\contextlib.py", line 526, in enter_context result = _enter(cm) ^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\cli\dependencies\thoughtspot.py", line 128, in enter ctx.obj.thoughtspot = ThoughtSpot(cfg, auto_login=self.login) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\thoughtspot.py", line 71, in init self.login() File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\thoughtspot.py", line 215, in login r = self._attempt_do_authenticate(self.api.v1.session_login, login_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\cs_tools\thoughtspot.py", line 166, in _attempt_do_authenticate i.json(), ^^^^^^^^ File "C:\Users{anonymous}\AppData\Roaming\cs_tools.cs_tools\Lib\site-packages\httpx_models.py", line 764, in json return jsonlib.loads(self.content, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


boonhapus commented 3 weeks ago
[DEBUG - 2024-08-16T12:09:08-0500] [cs_tools.api._client - _client.after_response 115] <<< [17:09:08] HTTP 204 <- /callosum/v1/tspublic/v1/session/login (57.179442s)

Something doesn't seem right @senapathi-at-hyatt , it's taking 60s+ to process API calls that should happen in less than a second. Additionally, you're seeing error/response content that ThoughtSpot is not known to generate.

[DEBUG - 2024-08-16T12:12:03-0500] [cs_tools.api._client - _client.after_response 115] <<< [17:12:03] HTTP 502 <- /callosum/v1/tspublic/v1/session/info (175.303358s)
<script> /** * This file can simply be linked as error_code.html in the same directory * to generate an error code page. */ var errorCode = 502; var title = "Bad gateway"; var desc = "Server while working as a gateway got an invalid response."; window.addEventListener('DOMContentLoaded', (event) => { document.getElementById("code").innerText = errorCode; document.getElementById("message").innerText = title; document.getElementById("desc").innerText = desc; }); </script>
Invalid code.
Invalid Error Code

My guess is that your IT department has some sort of content filtering gateway sitting between your machine and ThoughtSpot, or that you may need to jump through a proxy to connect to ThoughtSpot via API.

senapathi-at-hyatt commented 3 weeks ago

Through the ThoughtSpot Cloud URL, we can typically access liveboards, answers, worksheets, and table views etc,. Could you please clarify the format in which the results are returned in the above cs_tools command? This information will enable us to request the IT department to allow specific content.

boonhapus commented 3 weeks ago

CS Tools interacts with primarily the V1 REST APIs. It looks like the filtering happens even on the v1/session/login and v1/session/info endpoints.

senapathi-at-hyatt commented 3 weeks ago

In that case, the login should also have failed.

Thanks, Srinivas.

From: SN @.> Sent: Friday, August 16, 2024 5:43 PM To: thoughtspot/cs_tools @.> Cc: Senapathi, Srinivasa (CHICO-C) @.>; Mention @.> Subject: Re: [thoughtspot/cs_tools] Getting an error while using the cs_tools (Issue #167)

CS Tools interacts with primarily the V1 REST APIs. It looks like the filtering happens even on the v1/session/login and v1/session/info endpoints. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this

CS Tools interacts with primarily the V1 REST APIshttps://urldefense.com/v3/__https:/developers.thoughtspot.com/docs/rest-apis__;!!PoGYGYb4!lo4qU1s4HPa0MLt5TvCVem8hv9I_wYH3vhwPUZBnaL06kSteoa7vEBoAg7OrS9K64DV8PEy_1lpumElVoT1XLEH8cQIQmyc$. It looks like the filtering happens even on the v1/session/login and v1/session/info endpoints.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/thoughtspot/cs_tools/issues/167*issuecomment-2294410778__;Iw!!PoGYGYb4!lo4qU1s4HPa0MLt5TvCVem8hv9I_wYH3vhwPUZBnaL06kSteoa7vEBoAg7OrS9K64DV8PEy_1lpumElVoT1XLEH8J5Jx9sw$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BKN3HPXC2PHAQA7JZSBZMHDZRZ6ALAVCNFSM6AAAAABMTKMSF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJUGQYTANZXHA__;!!PoGYGYb4!lo4qU1s4HPa0MLt5TvCVem8hv9I_wYH3vhwPUZBnaL06kSteoa7vEBoAg7OrS9K64DV8PEy_1lpumElVoT1XLEH8XedS6tM$. You are receiving this because you were mentioned.Message ID: @.**@.>>

boonhapus commented 1 week ago

We synced live to unblock you, so I'll be closing this one now. If there's further issues, please feel free to reopen it.