Skip to content

Commit adfc914

Browse files
committed
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.
1 parent 5e49f38 commit adfc914

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

tableauserverclient/models/connection_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def from_response(cls, resp, ns) -> list["ConnectionItem"]:
108108
connection_item.embed_password = string_to_bool(connection_xml.get("embedPassword", ""))
109109
connection_item.server_address = connection_xml.get("serverAddress", connection_xml.get("server", None))
110110
connection_item.server_port = connection_xml.get("serverPort", connection_xml.get("port", None))
111-
connection_item.username = connection_xml.get("userName", None)
111+
connection_item.username = connection_xml.get("userName", connection_xml.get("username", None))
112112
connection_item._query_tagging = (
113113
string_to_bool(s) if (s := connection_xml.get("queryTagging", None)) else None
114114
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-2.3.xsd">
33
<virtualConnectionConnections>
4-
<connection id="37ca6ced-58d7-4dcf-99dc-f0a85223cbef" dbClass="postgres" serverAddress="localhost" userName="pgadmin" serverPort="5432"/>
4+
<connection id="37ca6ced-58d7-4dcf-99dc-f0a85223cbef" dbClass="postgres" serverAddress="localhost" username="pgadmin" serverPort="5432"/>
55
</virtualConnectionConnections>
66
</tsResponse>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-2.3.xsd">
33
<virtualConnectionConnections>
4-
<connection connectionId="37ca6ced-58d7-4dcf-99dc-f0a85223cbef" dbClass="postgres" server="localhost" userName="pgadmin" port="5432"/>
4+
<connection connectionId="37ca6ced-58d7-4dcf-99dc-f0a85223cbef" dbClass="postgres" server="localhost" username="pgadmin" port="5432"/>
55
</virtualConnectionConnections>
66
</tsResponse>

0 commit comments

Comments
 (0)