Skip to content

Commit 7e63d36

Browse files
authored
Merge pull request #5022 from segmentio/DOC-712
Databricks and Postgres Reverse ETL setup guides
2 parents 1d80d68 + 1e58a13 commit 7e63d36

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed

src/_data/sidenav/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ sections:
187187
section:
188188
- path: /connections/reverse-etl/reverse-etl-source-setup-guides/bigquery-setup
189189
title: BigQuery Reverse ETL Setup
190+
- path: /connections/reverse-etl/reverse-etl-source-setup-guides/databricks-setup
191+
title: Databricks Reverse ETL Setup
192+
- path: /connections/reverse-etl/reverse-etl-source-setup-guides/postgres-setup
193+
title: Postgres Reverse ETL Setup
190194
- path: /connections/reverse-etl/reverse-etl-source-setup-guides/redshift-setup
191195
title: Redshift Reverse ETL Setup
192196
- path: /connections/reverse-etl/reverse-etl-source-setup-guides/snowflake-setup

src/connections/reverse-etl/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ To add your warehouse as a source:
4242
3. Select the source you want to add. You can choose between BigQuery, Redshift, and Snowflake.
4343
4. Follow the corresponding setup guide for your Reverse ETL source.
4444
* [BigQuery Reverse ETL setup guide](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/bigquery-setup/)
45+
* [Databricks Reverse ETL setup guide](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/databricks-setup/)
46+
* [Postgres Reverse ETL setup guide](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/postgres-setup/)
4547
* [Redshift Reverse ETL setup guide](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/redshift-setup/)
4648
* [Snowflake Reverse ETL setup guide](/docs/connections/reverse-etl/reverse-etl-source-setup-guides/snowflake-setup/)
4749
5. Add the account information for your source.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Databricks Reverse ETL Setup
3+
---
4+
5+
> info ""
6+
> The Databricks Reverse ETL source is in beta and Segment is actively working on this feature. Segment's [First-Access and Beta terms](https://segment.com/legal/first-access-beta-preview/) govern this feature.
7+
8+
Set up Databricks as your Reverse ETL source.
9+
10+
At a high level, when you set up Databricks for Reverse ETL, the configured user 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+
## Required permissions
13+
* Make sure the user or the service principal you use to connect to Segment has permissions to use that warehouse. In the Databricks console go to **SQL warehouses** and select the warehouse you're using. Navigate to **Overview > Permissions** and make sure the user or the service principal you use to connect to Segment has *can use* permissions.
14+
15+
* To grant access to read data from the tables used in the model query, run:
16+
17+
```
18+
GRANT USAGE ON SCHEMA <schema_name> TO `<user or service principal you are using to connect to Segment>`;
19+
GRANT SELECT, READ_METADATA ON SCHEMA <schema_name> TO `<user or service principal you are using to connect to Segment>`;
20+
```
21+
22+
* To grant Segment access to create a schema to keep track of the running syncs, run:
23+
24+
```
25+
GRANT CREATE on catalog <name of the catalog, usually hive_metastore or main if using unity-catalog> TO `<user or service principal you are using to connect to Segment>`;
26+
```
27+
28+
* If you want to create the schema yourself instead and then give Segment access to it, run:
29+
30+
```
31+
CREATE SCHEMA IF NOT EXISTS __segment_reverse_etl;
32+
GRANT ALL PRIVILEGES ON SCHEMA __segment_reverse_etl TO `<user or service principal you are using to connect to Segment>`;
33+
```
34+
35+
## Set up guide
36+
37+
To set up Databricks as your Reverse ETL source:
38+
39+
1. Log in to your Databricks account.
40+
2. Navigate to **Workspaces** and select the workspace you want to use.
41+
3. Select **SQL** in the main navigation.
42+
4. Select **SQL Warehouses** and select the warehouse you want to use.
43+
5. Go to the **Connection details** tab.
44+
6. In a new tab on your browser, go to the Segment app.
45+
7. Navigate to **Connections > Sources > Reverse ETL**.
46+
8. Click **+ Add Reverse ETL source**.
47+
9. Select **Databricks** and click **Add Source**.
48+
10. Enter the configuration settings for your Databricks source.
49+
* Copy the Hostname, Http Path, and Port from the Databricks console from step 5.
50+
* To generate a **Token**, follow the steps listed in the [Databricks docs](https://docs.databricks.com/dev-tools/auth.html#pat){:target="_blank"}. Segment recommends you create a token with no expiration date by leaving the lifetime field empty when creating it. If you already have a token with an expiration date, be sure to keep track of the date and renew it on time.
51+
11. Click **Test Connection** to see if the connection works. If the connection fails, make sure you have the right permissions and credentials, then try again.
52+
12. Click **Create Source** if the test connection is successful.
53+
54+
Once you've added your Databricks source, [add a model](/docs/connections/reverse-etl/#step-2-add-a-model) and follow the rest of the steps in the Reverse ETL setup guide.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: Postgres Reverse ETL Setup
3+
---
4+
5+
> info ""
6+
> The Postgres Reverse ETL source is in beta and Segment is actively working on this feature. Segment's [First-Access and Beta terms](https://segment.com/legal/first-access-beta-preview/) govern this feature.
7+
8+
Set up Postgres as your Reverse ETL source.
9+
10+
At a high level, when you set up Postgres 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+
## Set up guide
13+
To set up Postgres with Reverse ETL:
14+
15+
1. Log in to your Postgres account.
16+
2. Configure the correction network and security settings for your Postgres database.
17+
* If you're using RDS Postgres, follow [this guide](/docs/connections/storage/catalog/postgres/#network-permissions-for-segment-to-rds).
18+
* Make sure [the following IP addresses](/docs/connections/storage/warehouses/faq/#which-ips-should-i-allowlist) can access the database.
19+
3. Run the SQL commands below to create a user named `segment`.
20+
21+
```sql
22+
-- create a user named "segment" that Segment will use when connecting to your Postgres cluster.
23+
CREATE USER segment PASSWORD '<enter password here>';
24+
25+
-- allows the "segment" user to create new schemas on the specified database. (this is the name you chose when provisioning your cluster)
26+
GRANT CREATE ON DATABASE "<enter database name here>" TO "segment";
27+
```
28+
4. Make sure the user has correct access permissions to the database.
29+
5. Follow the steps listed in the [Add a source](/docs/connections/reverse-etl/#step-1-add-a-source) section to finish adding Postgres as a source.
30+
31+
## Extra permissions
32+
* Give the `segment` user read permissions for any resources (databases, schemas, tables) the query needs to access.
33+
34+
* Give the `segment` user write permissions for the Segment managed schema (`__SEGMENT_REVERSE_ETL`), which keeps track of changes to the query results.

0 commit comments

Comments
 (0)