Closed
Description
Describe the bug
Hi,
I'm encountering an issue with the Tableau Python client. Specifically, the datasource_id
is missing from the ConnectionItem
object.
Here’s the scenario: after retrieving a datasource by id, I populate its connections, but the ConnectionItem
objects lack the datasource information.
From reviewing the source code:
it seems the REST method being used by the module is:
GET /api/api-version/sites/site-id/datasources/datasource-id/connections
.
According to the official documentation, this method does not appear to return datasource information.
Versions
- Tableau Cloud 2024.3
- Python version: 3.11.0
- TSC library version: 0.34
To Reproduce
import os
import tableauserverclient as TSC
token_name = 'my_token'
token_value = os.environ['TABLEAU_TOKEN']
tableau_site = 'my-site-it'
tableau_server = 'https://eu-west-1a.online.tableau.com'
datasource_id = 'REPLACE_ME'
def main():
tableau_auth = TSC.PersonalAccessTokenAuth(token_name, token_value, site_id=tableau_site)
server = TSC.Server(tableau_server, use_server_version=True)
with server.auth.sign_in(tableau_auth):
ds = server.datasources.get_by_id(datasource_id)
server.datasources.populate_connections(ds)
# This will fail
assert ds.connections[0].datasource_id
if __name__ == '__main__':
main()
Results
connections[0].datasource_id
is None
, data is not fetched from the REST API.
Thanks :)