Skip to content

Commit 949d602

Browse files
jacalataclaude
andcommitted
Fold keypair sample into existing update_connection_auth
update_connection_auth.py already covers exactly this workflow (change a connection's auth_type + credentials via the update-connection endpoint). The prior keypair-specific sample added no new code path -- only Snowflake-keypair context that belongs in the shared sample's header. Delete the dedicated keypair sample; expand update_connection_auth's header comment to list common authentication_type values (including auth-keypair) and to spell out the pre-saved-credential prerequisite that applies to any embed_password=True conversion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 09b87b9 commit 949d602

2 files changed

Lines changed: 28 additions & 130 deletions

File tree

samples/update_connection_auth.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
####
2+
# This script updates a single connection on a datasource or workbook to embed
3+
# credentials. It's a generic authentication-change helper: the same code path
4+
# works whether you're setting username+password, switching to OAuth, or moving
5+
# a Snowflake connection to keypair auth.
6+
#
7+
# Common authentication_type values:
8+
# - "Username Password" -- username + password auth
9+
# - "oauth" -- OAuth
10+
# - "auth-keypair" -- Snowflake keypair auth (see prerequisite below)
11+
# - "AD Service Principal" -- Azure AD Service Principal
12+
# - "sqlserver" -- SQL Server username + password
13+
#
14+
# When embed_password=True the server binds the connection to a matching
15+
# pre-saved credential on the site (looked up by username, connection class,
16+
# and role). For keypair-auth conversions this means the Snowflake private key
17+
# MUST already be saved on the site under Site Settings -> Saved Credentials
18+
# for Data Sources before running this script. If not, the update writes the
19+
# new auth type into metadata but subsequent extract refreshes and connection
20+
# tests fail because no bound credential is found.
21+
#
22+
# Ability to change a connection's authentication type via this endpoint was
23+
# added in REST API v3.27 for datasource and workbook connections; flow
24+
# connections gained the same capability in v3.28.
25+
#
26+
# See: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source_connection
27+
####
28+
129
import argparse
230
import logging
331
import tableauserverclient as TSC

samples/update_connection_to_keypair.py

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)