Skip to content

Commit f952166

Browse files
committed
update for dedicated _Snowflake SQL endpoint_
1 parent df3cd9d commit f952166

4 files changed

Lines changed: 80 additions & 138 deletions

File tree

docs/build/snowflake-tutorial/index.md

Lines changed: 80 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -22,104 +22,67 @@ This integration enables organizations to make informed decisions, improve their
2222

2323
This tutorial contains the following step-by-step instructions to connect the Snowflake data-warehouse with eccenca corporate memory:
2424

25-
- [1. Configure Custom JDBC Driver](#1-configure-custom-jdbc-driver)
26-
- [2. Create a database in Snowflake](#2-create-a-database-in-snowflake)
27-
- [3. Create a project in eccenca Corporate Memory](#3-create-a-project-in-eccenca-corporate-memory)
28-
- [4. Create a transformation to build mapping rules](#4-create-a-transformation-to-build-mapping-rules)
29-
- [5. Create a knowledge graph](#5-create-a-knowledge-graph)
25+
- [1. Create a database in Snowflake](#1-create-a-database-in-snowflake)
26+
- [2. Create a project in eccenca Corporate Memory](#2-create-a-project-in-eccenca-corporate-memory)
27+
- [3. Create a transformation to build mapping rules](#3-create-a-transformation-to-build-mapping-rules)
28+
- [4. Create a knowledge graph](#4-create-a-knowledge-graph)
3029

3130
## Sample material
3231

3332
The following material is used in this tutorial, you should download the files and have them at hand throughout the tutorial:
3433

3534
- The product data vocabulary [products_vocabulary.nt](products_vocabulary.nt)
3635

37-
## 1. Configure Custom JDBC Driver
38-
39-
To connect to the Snowflake cloud data warehouse a JDBC driver is required.
40-
41-
The SQL-Dataset of eccenca Corporate Memory can access any database that offers a (supported/tested) JDBC driver.
42-
This happens partly via Apache Spark SQL but requires no Spark specific configuration for eccenca Corporate Memory.
43-
For Snowflake supported (e.g. 3.13.34) JDBC drivers can be found at:
44-
45-
- [MVN Repository](https://repo1.maven.org/maven2/net/snowflake/snowflake-jdbc/) ([direct jar download](https://repo1.maven.org/maven2/net/snowflake/snowflake-jdbc/3.13.34/snowflake-jdbc-3.13.34.jar))
46-
- to verify and build yourself: [github.com/snowflakedb/snowflake-jdbc](https://github.com/snowflakedb/snowflake-jdbc)
47-
48-
To use the driver it needs to be part of the classpath of eccenca Build (DataIntegration).
49-
That can be achieved in multiple ways but it is recommended to register the driver via the `dataintegration.conf` configuration file.
50-
51-
There are 3 settings to specify:
52-
53-
1. The most important is to add the driver name to `spark.sql.options.jdbc.drivers` - a comma separated list of drivers.
54-
The names in this list are the same as the database name in its JDBC-connection string (i.e. `snowflake` for its connection URL which looks like `jdbc:snowflake://<account_identifier>.snowflakecomputing.com/?<connection_params>`).
55-
2. Snowflake specific property for the jar file location: `spark.sql.options.jdbc.snowflake.jar="/location/for/snowflake-*-jdbc.jar"`
56-
3. Snowflake specific property for the driver class name: `spark.sql.options.jdbc.snowflake.name="com.snowflake.client.jdbc.SnowflakeDriver"`
57-
58-
!!! example "Example configuration snippet"
59-
60-
```properties
61-
# …
62-
spark.sql.options {
63-
# …
64-
# configure Snowflake JDBC driver
65-
jdbc.drivers = "snowflake"
66-
jdbc.snowflake.jar = ${ELDS_HOME}"/etc/dataintegration/conf/snowflake-jdbc-3.13.30.jar"
67-
jdbc.snowflake.name = "net.snowflake.client.jdbc.SnowflakeDriver"
68-
# …
69-
}
70-
# …
71-
```
72-
73-
## 2. Create a database in Snowflake
36+
## 1. Create a database in Snowflake
7437

7538
- Login to Snowflake enter the **username** and **password**, then click on **Sign in**.
7639

77-
![image](snowflake-login.png){ width="50%" class="bordered" }
40+
![image](snowflake-login.png){ width="50%" class="bordered" }
7841

7942
- Click on **Database** on the left side of the page.
8043

81-
![image](snowflake-click_on_database.png){ class="bordered" }
44+
![image](snowflake-click_on_database.png){ class="bordered" }
8245

8346
- Click on **+Database** on the right side of the page.
8447

85-
![image](snowflake-add-database.png){ class="bordered" }
48+
![image](snowflake-add-database.png){ class="bordered" }
8649

8750
- Type the database name **Product**, then click on **Create**.
8851

89-
![image](snowflake-product-name-database.png){ width="50%" class="bordered" }
52+
![image](snowflake-product-name-database.png){ width="50%" class="bordered" }
9053

9154
- Click on database **product**, then click on **+Schema** on the right side of the page.
9255

93-
![image](snowflake-dd-schema.png){ class="bordered" }
56+
![image](snowflake-dd-schema.png){ class="bordered" }
9457

9558
- Type the schema name **products_vocabulary** and click on **Create**.
9659

97-
![image](snowflake-schema-name.png){ width="50%" class="bordered" }
60+
![image](snowflake-schema-name.png){ width="50%" class="bordered" }
9861

9962
- Click on scheme **products_vocabulary** on the left side of the page then click on **Create** on the right side of the page, then click on **Table**, then select then **Standard**.
10063

101-
![image](snowflake-click-on-standard.png){ class="bordered" }
64+
![image](snowflake-click-on-standard.png){ class="bordered" }
10265

10366
- Click on schema name **products_vocabulary** on the left side of the page and type the **sql query** for creating a table in the center, then click on **Run** on the right side of the page.
10467

105-
You can create the _PRODUCT_ table with the following SQL query:
106-
107-
```sql
108-
CREATE TABLE product(
109-
product_id VARCHAR(12) NOT NULL PRIMARY KEY
110-
,product_name VARCHAR(50) NOT NULL
111-
,height INTEGER NOT NULL
112-
,width INTEGER NOT NULL
113-
,depth INTEGER NOT NULL
114-
,weigth INTEGER NOT NULL
115-
,product_manager VARCHAR(50) NOT NULL
116-
,price VARCHAR(10) NOT NULL
117-
) ;
118-
```
68+
You can create the _PRODUCT_ table with the following SQL query:
69+
70+
```sql
71+
CREATE TABLE product(
72+
product_id VARCHAR(12) NOT NULL PRIMARY KEY
73+
, product_name VARCHAR(50) NOT NULL
74+
, height INTEGER NOT NULL
75+
, width INTEGER NOT NULL
76+
, depth INTEGER NOT NULL
77+
, weigth INTEGER NOT NULL
78+
, product_manager VARCHAR(50) NOT NULL
79+
, price VARCHAR(10) NOT NULL
80+
) ;
81+
```
11982

12083
- Type or copy the **SQL** query for creating a database in the table that is created, then click on **Run**.
12184

122-
![image](snowflake-sql-for-table.png){ class="bordered" }
85+
![image](snowflake-sql-for-table.png){ class="bordered" }
12386

12487
In the **Worksheets** view (you might need to create a new worksheet), select the **product** database, the **products_vocabulary** schema and finally the **product** table.
12588
Here you can populate some test data with the following SQL query:
@@ -1127,7 +1090,7 @@ Here you can populate some test data with the following SQL query:
11271090
,('D844-3535311','Resistor Gauge Encoder',12,36,17,11,'Bert.Blumstein@company.org','0,90 EUR')
11281091
,('K898-8238720','Multiplexer Transformer',33,76,18,10,'Thomas.Mueller@company.org','5,10 EUR')
11291092
,('Y299-9772513','Log-periodic Oscillator Transformer',62,40,17,3,'Kevin.Feigenbaum@company.org','0,38 EUR')
1130-
,('X716-6172862','Coil Resonator',74,36,16,8,'Baldwin.Guenther@company.org','3,20 EUR');
1093+
,('X716-6172862','Coil Resonator',74,36,16,8,'Baldwin.Guenther@company.org','3,20 EUR') ;
11311094
```
11321095

11331096
![image](snowflake-sql-query-data.png){ class="bordered" }
@@ -1138,188 +1101,167 @@ Here you can populate some test data with the following SQL query:
11381101

11391102
![image](snowflake-table-created.png){ class="bordered" }
11401103

1141-
## 3. Create a project in eccenca Corporate Memory
1104+
## 2. Create a project in eccenca Corporate Memory
11421105

11431106
- Click on **Create** on the right side of the page.
11441107

1145-
![image](snowflake-create-project.png){ class="bordered" }
1108+
![image](snowflake-create-project.png){ class="bordered" }
11461109

11471110
- Click on Project, then click on **Add**.
11481111

1149-
![image](snowflake-add-project.png){ class="bordered" }
1112+
![image](snowflake-add-project.png){ class="bordered" }
11501113

11511114
- Type the project name **product** in the title field, then click on **Create**.
11521115

1153-
![image](snowflake-project-name.png){ class="bordered" }
1116+
![image](snowflake-project-name.png){ class="bordered" }
11541117

11551118
- Click on **Create** on the right side of the page.
11561119

1157-
![image](snowflake-create.png){ class="bordered" }
1120+
![image](snowflake-create.png){ class="bordered" }
11581121

1159-
- Click on **JDBC endpoint**, then click on **Add**.
1122+
- Click on **Snowflake SQL endpoint**, then click on **Add**.
11601123

1161-
![image](snowflake-jdbc.png){ class="bordered" }
1124+
![image](snowflake-jdbc.png){ class="bordered" }
11621125

1163-
- Type the name **product table (JDBC)** in the label field.
1126+
- Type the name **Product table (JDBC)** in the label field.
11641127

1165-
![image](snowflake-product-name.png){ class="bordered" }
1128+
- In the **CONNECTION** section populate the required details.
11661129

1167-
- Type the **JDBC URL** path in the **JDBC Driver connection URL** field.
1130+
![image](snowflake-connection.png){ class="bordered" }
11681131

1169-
!!! Note
1132+
- Replace `<orgname>` and `<account_name>` in the **Account URL hostname** field.
1133+
`kiaouyb-fe21477.snowflakecomputing.com` is the URL for the snowflake account you want to connect to.
1134+
The number `WTXSZXM-FS77078` is the organization and account number you will get from Snowflake as shown below.
11701135

1171-
This is a JDBC connection string for connecting to Snowflake data warehouse in eccenca corporate memory.
1136+
![image](snowflake-organization-number.png){ class="bordered" }
11721137

1173-
<!-- Note -> :snowflake: gives an emoji so, using \:snowflake\: for documentation-->
1138+
- Type your **User** and **Password**.
11741139

1175-
!!! Example
1140+
- Select your **Database**, `product` in this case.
11761141

1177-
`jdbc:snowflake://kiaouyb-fe21477.snowflakecomputing.com/?db=product&schema=products_vocabulary`
1142+
- Select your **Schema**, `products_vocabulary` in this case
11781143

1179-
Here is a breakdown of the elements of this example connection string.
1180-
1181-
- `jdbc:snowflake://` is the prefix for the snowflake JDBC driver.
1182-
1183-
- `kiaouyb-fe21477.snowflakecomputing.com` is the URL for the snowflake account you want to connect to.
1184-
The number `WTXSZXM-FS77078` is the organization number you will get from Snowflake as shown below.
1185-
1186-
![image](snowflake-organization-number.png){ class="bordered" }
1187-
1188-
- `?db=product` specifies the name of the Snowflake database you want to connect to.In this case, the database is named product.
1189-
1190-
- `&schema=products_vocabulary` specifies the name of the Snowflake schema that you want to use within the specified database.
1191-
In this case, the schema name is _products_vocabulary_.
1192-
1193-
![image](snowflake-jdbc-uri-name.png){ class="bordered" }
1194-
1195-
- Type Source query as
1144+
- In the **READ** section specify **Source query** as
11961145

11971146
```sparql
11981147
SELECT * from product
11991148
```
12001149

1201-
![image](snowflake-query-source.png){ class="bordered" }
1150+
![image](snowflake-query-source.png){ class="bordered" }
12021151

1203-
- Select the **Query strategy** as **Execute the given source query.No paging or virtual query**.
1152+
- Select the **Query strategy** as **Execute the given source query. No paging or virtual query**.
12041153

1205-
![image](snowflake-query-strategy.png){ class="bordered" }
1154+
![image](snowflake-query-strategy.png){ class="bordered" }
12061155

12071156
- Select the **Write strategy** as **An exception will be thrown, if the table already exists.**
12081157

1209-
![image](snowflake-write-stategy.png){ class="bordered" }
1158+
![image](snowflake-write-stategy.png){ class="bordered" }
12101159

1211-
- Click on the **ADVANCED OPTIONS**.
1212-
1213-
![image](snowflake-jdbc-dataset-advanced-options.png){ class="bordered" }
1214-
1215-
- Type **Username** and **Password** in the dialog window, then click on **Create**.
1216-
1217-
![image](snowflake-userpassword.png){ class="bordered" }
1160+
- Then click on **Create**.
12181161

12191162
!!! success "Step Result"
12201163

12211164
JDBC endpoint is created and data is transferred from Snowflake to eccenca Corporate Memory.
12221165

12231166
![image](snowflake-jdbc-created.png){ class="bordered" }
12241167

1225-
## 4. Create a transformation to build mapping rules
1168+
## 3. Create a transformation to build mapping rules
12261169

12271170
- Click on **Create** on the right side of the page.
12281171

1229-
![image](snowflake-click-on-create.png){ class="bordered" }
1172+
![image](snowflake-click-on-create.png){ class="bordered" }
12301173

12311174
- Click on **Transform** on the left side of the page, then on **Transform** in the centre of the page, then click on **Add**.
12321175

1233-
![image](snowflake-transformation.png){ class="bordered" }
1176+
![image](snowflake-transformation.png){ class="bordered" }
12341177

12351178
- Type the name **product** in the **Label** field, in the **INPUT TASK Dataset** select **Product Table (JDBC)** and in the **Type** field select **table**.
12361179

1237-
![image](snowflake-trans-connect.png){ class="bordered" }
1180+
![image](snowflake-trans-connect.png){ class="bordered" }
12381181

1239-
![image](snowflake-type-table.png){ class="bordered" }
1182+
![image](snowflake-type-table.png){ class="bordered" }
12401183

12411184
- In the **Output** dataset field select **product graph**, then click on **Create** .
12421185

1243-
![image](snowflake-output-gp.png){ class="bordered" }
1186+
![image](snowflake-output-gp.png){ class="bordered" }
12441187

12451188
- Click on **Mapping**, then click on **Edit**.
12461189

1247-
![image](snowflake-click-on-mapping.png){ class="bordered" }
1190+
![image](snowflake-click-on-mapping.png){ class="bordered" }
12481191

12491192
- For the target entity select **Product (pv:product)**.
12501193

1251-
![image](snowflake-target-entity.png){ class="bordered" }
1194+
![image](snowflake-target-entity.png){ class="bordered" }
12521195

12531196
- Click on **create custom pattern**.
12541197

1255-
![image](snowflake-custom-pattern.png){ class="bordered" }
1198+
![image](snowflake-custom-pattern.png){ class="bordered" }
12561199

12571200
- Type the URI pattern as `<http://id.company.org/product/jdbc>`.
12581201
You can use either company.org or company.com as per your requirement.
12591202
Then type the label name as **product** and then click on **save**.
12601203

1261-
![image](snowflake-uri-pattern.png){ class="bordered" }
1204+
![image](snowflake-uri-pattern.png){ class="bordered" }
12621205

12631206
- Click on **+Icon**, then select the **Add value mapping**.
12641207

1265-
![image](snowflake-add-value.png){ class="bordered" }
1208+
![image](snowflake-add-value.png){ class="bordered" }
12661209

12671210
- Select the **target property** according to transformation requirements, for example name, id, etc., then select the **value path** according to the target property as the product name, product id etc.
12681211
This step will help in mapping the data from the source to the target property.
12691212

1270-
![image](snowflake-target-property.png){ class="bordered" }
1213+
![image](snowflake-target-property.png){ class="bordered" }
12711214

12721215
- Type the label name **product name**, then click on **Save**.
12731216

1274-
![image](snowflake-trans-label.png){ class="bordered" }
1217+
![image](snowflake-trans-label.png){ class="bordered" }
12751218

1276-
!!! success "Step Result"
1219+
!!! success "Step Result"
12771220

1278-
Mapping rule is created successfully.
1221+
Mapping rule is created successfully.
12791222

1280-
![image](snowflake-mapping-rule.png){ class="bordered" }
1223+
![image](snowflake-mapping-rule.png){ class="bordered" }
12811224

1282-
!!! note
1225+
!!! note
12831226

1284-
We have the suggestion option as well; click on the **+Icon** and select the **Suggestion mapping**.
1227+
We have the suggestion option as well; click on the **+Icon** and select the **Suggestion mapping**.
12851228

1286-
![image](snowflake-suggestions.png){ class="bordered" }
1229+
![image](snowflake-suggestions.png){ class="bordered" }
12871230

1288-
!!! success "Step Result"
1231+
!!! success "Step Result"
12891232

1290-
Suggestion appears as below can select as per the requirement.
1233+
Suggestion appears as below can select as per the requirement.
12911234

1292-
![image](snowflake-suggestion-result.png){ class="bordered" }
1235+
![image](snowflake-suggestion-result.png){ class="bordered" }
12931236

1294-
!!! note
1237+
!!! note
12951238

1296-
Suggestions generated are based on vocabulary which describes the data in the CSV files: [products_vocabulary.nt](products_vocabulary.nt)
1239+
Suggestions generated are based on vocabulary which describes the data in the CSV files: [products_vocabulary.nt](products_vocabulary.nt)
12971240

12981241
- **Tick** the box to select the suggestions to be added, then click on **Add**.
12991242

13001243
![image](snowflake-tick.png){ class="bordered" }
13011244

1302-
## 5. Create a knowledge graph
1245+
## 4. Create a knowledge graph
13031246

13041247
- Click on **Create** on the right side of the page.
13051248

1306-
![image](snowflake-trans-result.png){ class="bordered" }
1249+
![image](snowflake-trans-result.png){ class="bordered" }
13071250

13081251
- Select **Knowledge Graph**, then click on **Add**.
13091252

1310-
![image](snowflake-kg-graph.png){ class="bordered" }
1253+
![image](snowflake-kg-graph.png){ class="bordered" }
13111254

13121255
- Select the **target project** from the drop down menu as **product**.
13131256

1314-
![image](snowflake-graph-target.png){ class="bordered" }
1257+
![image](snowflake-graph-target.png){ class="bordered" }
13151258

13161259
- Type **product graph** in the label field, then enter the **graph URI** in the Graph field, then click on **Create**.
13171260

1318-
![image](snowflake-graph-uri.png){ class="bordered" }
1261+
![image](snowflake-graph-uri.png){ class="bordered" }
13191262

13201263
!!! success "Step Result"
13211264

13221265
Graph is created successfully.
13231266

13241267
![image](snowflake-easynav-graph.png){ class="bordered" }
1325-
233 KB
Loading
354 KB
Loading
18.2 KB
Loading

0 commit comments

Comments
 (0)