Skip to content
2 changes: 1 addition & 1 deletion samples/update_connection_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def main():
connection = connections[0]
connection.username = args.datasource_username
connection.password = args.datasource_password
connection.authentication_type = args.authentication_type
connection.auth_type = args.authentication_type
connection.embed_password = True

updated_connection = update_function(resource, connection)
Expand Down
2 changes: 1 addition & 1 deletion samples/update_connections_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main():
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)

tableau_auth = TSC.TableauAuth(args.token_name, args.token_value, site_id=args.site)
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
server = TSC.Server(args.server, use_server_version=True)

with server.auth.sign_in(tableau_auth):
Expand Down
2 changes: 2 additions & 0 deletions tableauserverclient/server/request_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,8 @@ def update_req(self, xml_request: ET.Element, connection_item: "ConnectionItem")
connection_element.attrib["userName"] = connection_item.username
if connection_item.password is not None:
connection_element.attrib["password"] = connection_item.password
if connection_item.auth_type is not None:
connection_element.attrib["authenticationType"] = connection_item.auth_type
if connection_item.embed_password is not None:
connection_element.attrib["embedPassword"] = str(connection_item.embed_password).lower()
if connection_item.query_tagging is not None:
Expand Down
1 change: 1 addition & 0 deletions test/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def test_update_connections(self) -> None:
updated_ids = [conn.id for conn in connection_items]

self.assertEqual(updated_ids, connection_luids)
self.assertEqual("auth-keypair", connection_items[0].auth_type)

def test_populate_permissions(self) -> None:
with open(asset(POPULATE_PERMISSIONS_XML), "rb") as f:
Expand Down
1 change: 1 addition & 0 deletions test/test_workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ def test_update_workbook_connections(self) -> None:
updated_ids = [conn.id for conn in connection_items]

self.assertEqual(updated_ids, connection_luids)
self.assertEqual("AD Service Principal", connection_items[0].auth_type)

def test_get_workbook_all_fields(self) -> None:
self.server.version = "3.21"
Expand Down
Loading