Skip to content

Fix W-21968404: Make authentication_type optional in update_connections#1778

Open
vchavatapalli wants to merge 2 commits intotableau:developmentfrom
vchavatapalli:fix-update-connections-optional-auth
Open

Fix W-21968404: Make authentication_type optional in update_connections#1778
vchavatapalli wants to merge 2 commits intotableau:developmentfrom
vchavatapalli:fix-update-connections-optional-auth

Conversation

@vchavatapalli
Copy link
Copy Markdown
Contributor

Make the authentication_type parameter optional in update_connections
methods for both datasources and workbooks, allowing users to update
connection credentials without modifying the authentication type.

Problem

Users were confused by the update_connections method, attempting to use
it for general credential updates but encountering errors because
authentication_type was required. This forced them to specify an auth
type even when they only wanted to update usernames/passwords.

Solution

  • Made authentication_type parameter optional (default=None) in:

    • Datasources.update_connections()
    • Workbooks.update_connections()
    • DatasourceRequest.update_connections_req()
    • WorkbookRequest.update_connections_req()
  • Updated XML request generation to only include authenticationType
    attribute when explicitly provided

  • Enhanced docstrings to clarify that omitting authentication_type
    preserves the existing configuration

Changes

  • tableauserverclient/server/endpoint/datasources_endpoint.py
  • tableauserverclient/server/endpoint/workbooks_endpoint.py
  • tableauserverclient/server/request_factory.py
  • samples/update_connections_auth.py (made CLI args optional)
  • test/test_datasource.py (added test without auth_type)
  • test/test_workbook.py (added test without auth_type)
  • test/assets/*.xml (added test fixtures)

Benefits

✓ Backward compatible - existing code continues to work
✓ More flexible - update credentials independently of auth type
✓ Better UX - eliminates confusion about method purpose
✓ Safer - no risk of accidentally changing auth type

Testing

Added comprehensive tests for both datasources and workbooks that verify:

  • Connections can be updated without providing authentication_type
  • Existing authentication_type is preserved in response
  • All connection LUIDs are successfully updated

@salesforce-cla
Copy link
Copy Markdown

salesforce-cla Bot commented May 5, 2026

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Vineeth Sai Surya Chavatapalli <v***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request.

@vchavatapalli vchavatapalli force-pushed the fix-update-connections-optional-auth branch 2 times, most recently from ca52d17 to f0481fc Compare May 5, 2026 12:58
Copy link
Copy Markdown
Contributor

@jorwoods jorwoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits and what may be a collision in pyproject.toml

Comment thread samples/update_connections_auth.py Outdated
Comment thread test/test_datasource.py Outdated
Comment thread test/test_datasource.py Outdated
Comment thread test/test_datasource.py Outdated
Comment thread test/test_datasource.py Outdated
Comment thread test/test_workbook.py Outdated
Comment thread test/test_workbook.py Outdated
Comment thread test/test_workbook.py Outdated
Comment thread pyproject.toml
@vchavatapalli vchavatapalli force-pushed the fix-update-connections-optional-auth branch from d3dbd7f to 78e9e81 Compare May 5, 2026 19:19
@salesforce-cla
Copy link
Copy Markdown

salesforce-cla Bot commented May 5, 2026

Thanks for the contribution! Unfortunately we can't verify the commit author(s): ivan.baldinotti@digitecgalaxus.ch <i***@.DG-CH-NBS-22242>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated.

@vchavatapalli vchavatapalli force-pushed the fix-update-connections-optional-auth branch from 78e9e81 to 2a6e274 Compare May 5, 2026 19:28
@salesforce-cla
Copy link
Copy Markdown

salesforce-cla Bot commented May 5, 2026

Thanks for the contribution! Unfortunately we can't verify the commit author(s): Chris Shin <c***@t***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated.

vchavatapalli and others added 2 commits May 5, 2026 14:40
This change addresses a usability issue where users were confused by the
update_connections method name and were using it for general connection
updates without realizing it required an authentication_type parameter.

Changes:
- Made authentication_type parameter optional in both datasource and workbook
  update_connections methods
- Updated request_factory to only set authenticationType in XML when provided
- Enhanced docstrings to clarify that authentication_type is optional and
  existing auth types are preserved when not specified
- Updated sample script to demonstrate optional parameter usage
- Added comprehensive tests for both datasources and workbooks when
  authentication_type is not provided

Benefits:
- Backward compatible: existing code continues to work
- More flexible: users can now update credentials without changing auth type
- Clearer intent: function can be used for both auth type changes and
  general credential updates
- Better UX: eliminates confusion about the function's purpose

The function safely iterates through each connection LUID independently,
so there's no risk of cross-contamination when auth type is omitted.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove unnecessary default=None from argparse arguments (implicit for optional args)
- Add test_update_connections_without_auth_type for datasources
- Add test_update_workbook_connections_without_auth_type for workbooks
- Tests verify that auth_type is preserved from server response when not specified

These tests ensure the optional authentication_type parameter works correctly
and that existing authentication types are preserved when updating only
credentials without changing auth type.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@vchavatapalli vchavatapalli force-pushed the fix-update-connections-optional-auth branch from 0571bf8 to 54fada7 Compare May 5, 2026 19:40
@vchavatapalli vchavatapalli requested a review from jorwoods May 5, 2026 19:42
@vchavatapalli
Copy link
Copy Markdown
Contributor Author

@jorwoods Fixed your comments.
pyproject.toml is basically because I created branch from master instead of development.
Now i fixed all those issues. Please do a re-review at your convenience. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants