Skip to content

Commit 7bad235

Browse files
Updated connection_fetch_connection to use the public V1 endpoint similar to connection_fetch_live_columns
1 parent aebbc48 commit 7bad235

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = thoughtspot_rest_api_v1
3-
version = 1.4.2
3+
version = 1.5.0
44
description = Library implementing the ThoughtSpot V1 REST API
55
long_description = file: README.md
66
long_description_content_type = text/markdown
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.2'
1+
__version__ = '1.5.0'

src/thoughtspot_rest_api_v1/tsrestapiv1.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,10 +1830,18 @@ def connection_detail(self, connection_guid: str, sort: str = 'MODIFIED', sort_a
18301830
response.raise_for_status()
18311831
return response.json()
18321832

1833-
def connection_fetch_connection(self, connection_guid, config_json_string, include_columns=False, authentication_type='SERVICE_ACCOUNT'):
1833+
def connection_fetch_connection(self, connection_guid: str, include_columns=False,
1834+
authentication_type='SERVICE_ACCOUNT', config_json_string: Optional[str] = None,
1835+
use_internal_endpoint=False):
18341836
endpoint = 'connection/fetchConnection'
18351837

1836-
url = self.non_public_base_url + endpoint
1838+
if use_internal_endpoint is True:
1839+
url = self.non_public_base_url + endpoint
1840+
if config_json_string is None:
1841+
raise Exception('The config_json_string (a JSON object converted to string using json.dumps() ) is required')
1842+
else:
1843+
url = self.base_url + endpoint
1844+
18371845
# Example of a config_json, which may vary per connection
18381846
#
18391847
# config_json_string_example = '''
@@ -1846,11 +1854,13 @@ def connection_fetch_connection(self, connection_guid, config_json_string, inclu
18461854
# '''
18471855
#
18481856
post_data = {'id': connection_guid,
1849-
'config': config_json_string,
18501857
'includeColumns': str(include_columns).lower(),
18511858
'authentication_type': authentication_type
18521859
}
18531860

1861+
if config_json_string is not None:
1862+
post_data['config'] = config_json_string
1863+
18541864
response = self.requests_session.post(url=url, data=post_data)
18551865
response.raise_for_status()
18561866
return response.json()

0 commit comments

Comments
 (0)