From b28cd1d92d9384647e0cf9bfb31eb5707596bbd1 Mon Sep 17 00:00:00 2001 From: Jac Fitzgerald Date: Thu, 30 Jul 2026 15:58:09 -0700 Subject: [PATCH] docs: add Snowflake keypair auth conversion how-to Adds a short how-to under datasources.update_connection describing how to flip an existing connection from username/password to Snowflake keypair authentication (REST API v3.27+), including the prerequisite of saving the private key under Site Settings -> Saved Credentials for Data Sources. Links to the new samples/update_connection_to_keypair.py runnable sample. Refs #1602 Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/api-ref.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/api-ref.md b/docs/api-ref.md index b34e946f9..f9ed6bd73 100644 --- a/docs/api-ref.md +++ b/docs/api-ref.md @@ -1709,6 +1709,21 @@ conn.username = 'newuser' updated_conn = server.datasources.update_connection(datasource_item, conn) ``` +**How-to: convert an existing connection to Snowflake keypair auth** + +As of REST API v3.27, an existing connection can be flipped from username/password to Snowflake keypair authentication in place. First save the private key on the site under **Site Settings -> Saved Credentials for Data Sources** (keyed on server address + username); the update call only records the auth type and username, it does not carry the key. Then: + +```py +server.datasources.populate_connections(datasource_item) +conn = next(c for c in datasource_item.connections if c.connection_type == 'snowflake') +conn.auth_type = 'auth-keypair' +conn.username = 'my_snowflake_user' +conn.embed_password = True +server.datasources.update_connection(datasource_item, conn) +``` + +See [`samples/update_connection_to_keypair.py`](https://github.com/tableau/server-client-python/blob/master/samples/update_connection_to_keypair.py) for a runnable end-to-end example, and the REST API [authenticationType reference](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_data_sources.htm#update_data_source_connection) for the full list of supported values. +