Skip to content

Commit 0b5a4ca

Browse files
committed
snowflake retl source - key pair support
1 parent 6b0381d commit 0b5a4ca

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/connections/reverse-etl/reverse-etl-source-setup-guides/snowflake-setup.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ redirect_from:
77

88
Set up Snowflake as your Reverse ETL source.
99

10-
At a high level, when you set up Snowflake for Reverse ETL, the configured user/role needs read permissions for any resources (databases, schemas, tables) the query needs to access. Segment keeps track of changes to your query results with a managed schema (`__SEGMENT_REVERSE_ETL`), which requires the configured user to allow write permissions for that schema.
10+
At a high level, when you set up Snowflake for Reverse ETL, the configured user/role needs read permissions for any resources (databases, schemas, tables) the query needs to access. Segment keeps track of changes to your query results with a managed schema (`__SEGMENT_REVERSE_ETL`), which requires the configured user to allow write permissions for that schema.
11+
12+
> success ""
13+
> Segment now supports key-pair authentication for Snowflake Reverse ETL sources.
1114
1215
## Set up guide
13-
Follow the instructions below to set up the Segment Snowflake connector. Segment recommends you use the `ACCOUNTADMIN` role to execute all the commands below.
16+
Follow the instructions below to set up the Segment Snowflake connector. Segment recommends you use the `ACCOUNTADMIN` role to execute all the commands below, and that you create a user that authenticates with a key pair.
1417

1518
1. Log in to your Snowflake account.
1619
2. Navigate to *Worksheets*.
@@ -47,10 +50,23 @@ Follow the instructions below to set up the Segment Snowflake connector. Segment
4750
GRANT USAGE ON DATABASE segment_reverse_etl TO ROLE segment_reverse_etl;
4851
GRANT CREATE SCHEMA ON DATABASE segment_reverse_etl TO ROLE segment_reverse_etl;
4952
```
50-
6. Enter and run the code below to create the username and password combination that will be used to execute queries. Make sure to enter your password where it says `my_strong_password`.
53+
6. Enter and run one of the following code snippets below to create the user Segment will use to run queries. Segment recommends creating a user that authenticates using a key pair.
54+
55+
To create a user that authenticates with a key pair, [create a key pair](https://docs.snowflake.com/en/user-guide/key-pair-auth){:target="_blank”} and then execute the following SQL commands:
56+
``` sql
57+
-- create user (key-pair authentication)
58+
CREATE USER segment_reverse_etl_user
59+
DEFAULT_ROLE = segment_reverse_etl
60+
RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...'
61+
RSA_PUBLIC_KEY_FP = 'enter the passphrase you created';
62+
63+
-- role access
64+
GRANT ROLE segment_reverse_etl TO USER segment_reverse_etl_user;
65+
```
5166

67+
To create a user that authenticates with a password, execute the following SQL commands:
5268
```sql
53-
-- create user
69+
-- create user (password authentication)
5470
CREATE USER segment_reverse_etl_user
5571
MUST_CHANGE_PASSWORD = FALSE
5672
DEFAULT_ROLE = segment_reverse_etl

src/connections/storage/catalog/snowflake/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Now, create a new user by executing the following SQL command, replacing the pub
118118

119119
``` sql
120120
CREATE USER SEGMENT_USER
121-
DEFAULT_ROLE = "SEGMENT"
121+
DEFAULT_ROLE = SEGMENT
122122
RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...'
123123
RSA_PUBLIC_KEY_FP = 'enter the passphrase you created';
124124
GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";
@@ -221,6 +221,9 @@ After configuring your Snowflake resources, connect them to Segment.
221221
If you selected Key pair as your authentication method:
222222
- **Private key**: Upload your private key (stored in .p8 format) that you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
223223
- **Passphrase** _(Optional)_ : If you created an encrypted key, enter the passphrase you created in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
224+
225+
> info "Segment supports uploading one key at a time"
226+
> Although you can create up to two keys in Snowflake, Segment only supports authenticating with one key at a time. To change the key that is in Segment, return to your Snowflake destination's settings and upload a new key in the **Private Key** field.
224227
225228
If you selected Password as your authentication method:
226229
- **Password**: The password that you set in [Step 4: Create a user for Segment](#step-4-create-user-for-segment)
@@ -243,6 +246,8 @@ At this time, the Segment Snowflake destination is not compatible with Snowflake
243246

244247
Segment recommends that you authenticate with your Snowflake warehouse using key-pair authentication. Key-pair authentication uses PKCS#8 private keys, which are typically exchanged in the PEM base64-encoded format.
245248

249+
Although you can create up to two keys in Snowflake, Segment only supports authenticating with one key at a time. To change the key that is in Segment, return to your Snowflake destination's settings and upload a new key in the **Private Key** field.
250+
246251
### Auto Suspend and Auto Resume
247252

248253
Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) to minimize the credit consumption of Segment's syncing process.

0 commit comments

Comments
 (0)