From adfc914cd0af369434635e42e3c58f6d5fe65f22 Mon Sep 17 00:00:00 2001
From: Jordan Woods <13803242+jorwoods@users.noreply.github.com>
Date: Wed, 25 Jun 2025 06:37:35 -0500
Subject: [PATCH] fix: virtual connections username
Closes #1626
VirtualConnections leverages the ConnectionItem object to parse
the database connections server response. Most of other endpoints
return "userName" and the VirtualConnections' "Get Database Connections"
endpoint returns "username." Resolves the issue by allowing the
ConnectionItem to read either. Update the test assets to reflect the
actual returned value.
---
tableauserverclient/models/connection_item.py | 2 +-
test/assets/virtual_connection_populate_connections.xml | 2 +-
test/assets/virtual_connection_populate_connections2.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tableauserverclient/models/connection_item.py b/tableauserverclient/models/connection_item.py
index 6a8244fb1..1376b4e79 100644
--- a/tableauserverclient/models/connection_item.py
+++ b/tableauserverclient/models/connection_item.py
@@ -108,7 +108,7 @@ def from_response(cls, resp, ns) -> list["ConnectionItem"]:
connection_item.embed_password = string_to_bool(connection_xml.get("embedPassword", ""))
connection_item.server_address = connection_xml.get("serverAddress", connection_xml.get("server", None))
connection_item.server_port = connection_xml.get("serverPort", connection_xml.get("port", None))
- connection_item.username = connection_xml.get("userName", None)
+ connection_item.username = connection_xml.get("userName", connection_xml.get("username", None))
connection_item._query_tagging = (
string_to_bool(s) if (s := connection_xml.get("queryTagging", None)) else None
)
diff --git a/test/assets/virtual_connection_populate_connections.xml b/test/assets/virtual_connection_populate_connections.xml
index 77d899520..0835e478f 100644
--- a/test/assets/virtual_connection_populate_connections.xml
+++ b/test/assets/virtual_connection_populate_connections.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/test/assets/virtual_connection_populate_connections2.xml b/test/assets/virtual_connection_populate_connections2.xml
index f0ad2646d..78ff90f65 100644
--- a/test/assets/virtual_connection_populate_connections2.xml
+++ b/test/assets/virtual_connection_populate_connections2.xml
@@ -1,6 +1,6 @@
-
+