Skip to content

Commit a7af8b7

Browse files
authored
fix: virtual connections username (#1628)
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. Co-authored-by: Jordan Woods <[email protected]>
1 parent e51369c commit a7af8b7

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
@@ -120,7 +120,7 @@ def from_response(cls, resp, ns) -> list["ConnectionItem"]:
120120
connection_item.embed_password = string_to_bool(connection_xml.get("embedPassword", ""))
121121
connection_item.server_address = connection_xml.get("serverAddress", connection_xml.get("server", None))
122122
connection_item.server_port = connection_xml.get("serverPort", connection_xml.get("port", None))
123-
connection_item.username = connection_xml.get("userName", None)
123+
connection_item.username = connection_xml.get("userName", connection_xml.get("username", None))
124124
connection_item._query_tagging = (
125125
string_to_bool(s) if (s := connection_xml.get("queryTagging", None)) else None
126126
)
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)