Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tutorials/create-hello-world-mta/create-hello-world-mta.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/create-hello-world-mta/create-hello-world-mta.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/body-no-steps

No step headings found (expected at least one '## ' heading that is not 'You will learn' or 'Prerequisites')

Check warning on line 1 in tutorials/create-hello-world-mta/create-hello-world-mta.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_profile

Check warning on line 1 in tutorials/create-hello-world-mta/create-hello-world-mta.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_name
parser: v2
auto_validation: true
time: 20
Expand Down Expand Up @@ -96,7 +96,7 @@

2. Using a text editor, enter the following data in the file:

```YAML
```YAML
_schema-version: '3.1'
ID: com.example.demo.basic.config
extends: com.example.demo.basic
Expand All @@ -109,7 +109,7 @@
id: dbalias
user-id: myuser
password : mypassword
```
```

The example above instructs the SAP BTP to:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/hana-cloud-collaborative-database-development-5/hana-cloud-collaborative-database-development-5.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_profile

Check warning on line 1 in tutorials/hana-cloud-collaborative-database-development-5/hana-cloud-collaborative-database-development-5.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_name
parser: v2
auto_validation: true
time: 15
Expand Down Expand Up @@ -198,22 +198,22 @@

3. In the SQL Console, copy and paste the following code. Run it to create a role for the object owner (OO).

```SQL
```SQL
create role "genericRoleForOO";
```
> The Object Owner, in this example, will be assigned to the user who owns the project and creates calculation views. This role will need Select privileges with grant option that will be assigned to it in the next steps.

4. Next, copy and paste the following code in the SQL Console and run it to create a role for application users (AP).

```SQL
```SQL
create role "genericRoleForAP";
```
```

> The Application User, in this example, will be assigned to the user who uses the data preview on the calculation views created by the object owner. This role will need Select privileges that will be assigned to it in the next steps.

5. Copy and paste the following code in the SQL Console. Run the code to view the schema name for the role inventory created earlier in this tutorial group.

```SQL
```SQL
select role_schema_name,* from roles where role_name='inventory';
```

Expand All @@ -229,23 +229,23 @@

1. Here, you will assign the two roles you have created in the fourth tutorial ("`inventory_with_grant#`" and "`inventory_without_grant`") to the two new roles you have just created. Copy and paste the following code in the SQL Console and make sure the schema name ("`WS3_1_HDI_DB_1`") matches the schema name you have just checked with the previous statement. Run the statement to grant roles to the object owner and application user.

```SQL
```SQL
grant "WS3_1_HDI_DB_1"."inventory_with_grant#" to "genericRoleForOO";
grant "WS3_1_HDI_DB_1"."inventory_without_grant" to "genericRoleForAP";
```
```

2. Create a database user by running the following SQL statement. `UPS_GRANTOR` means **User-Provided Service Granter**. In the next step, this user will be allowed to grant the roles created above.

```SQL
```SQL
create user UPS_GRANTOR password "DnATBG!1" NO FORCE_FIRST_PASSWORD_CHANGE;
```
```

3. Assign the roles you have created to this user `UPS_GRANTOR` by running the statements below.

```SQL
```SQL
grant "genericRoleForOO" to UPS_GRANTOR WITH ADMIN OPTION;
grant "genericRoleForAP" to UPS_GRANTOR WITH ADMIN OPTION;
```
```

4. Now the user `UPS_GRANTOR` is assigned both roles that were created previously for collaborating on the project.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/hana-cloud-connection-guide-2/hana-cloud-connection-guide-2.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_profile

Check warning on line 1 in tutorials/hana-cloud-connection-guide-2/hana-cloud-connection-guide-2.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_name
parser: v2
auto_validation: true
time: 15
Expand Down Expand Up @@ -68,22 +68,22 @@

2. Import the packages using the following lines of code:

```Python
```Python
import hdbcli
from hdbcli import dbapi
import hana_ml
```

3. To check if the package has been imported correctly, you can check the package version. Just type the following:

```Python
```Python
print(hdbcli.__version__) #Use two underscores '_''_' for __version__
print(hana_ml.__version__) #Use two underscores '_''_' for __version__
```

4. Next, import the following packages required for this tutorial:

```Python
```Python
from hana_ml import dataframe
from hana_ml.dataframe import ConnectionContext
import pandas as pd
Expand Down Expand Up @@ -134,19 +134,19 @@

1. Now that you have a table in your database, to access this table we execute the following lines of code. Replace the XXXX with your schema name and table with your table name.

```Python
```Python
flight_hdf=conn2.sql ('select * from XXXX.(table) ')
```

2. To check the data types of the table, you can execute the following command:

```Python
```Python
flight_hdf.dtypes()
```

3. To explore the SAP HANA data-frame, you can execute the following command:

```Python
```Python
flight_hdf.describe().collect()
```
![Access SAP HANA Cloud Table](ss-03-access-SAP-HANA-Cloud-table.png)
Expand All @@ -157,13 +157,13 @@

1. To add visualizations to your data, import `EDAVisualizer` using the command:

```Python
```Python
from hana_ml.visualizers.eda import EDAVisualizer
```

2. Next, import the following packages required for this tutorial.

```Python
```Python
from hana_ml import dataframe
import pandas as pd
import matplotlib.pyplot as plt
Expand All @@ -176,7 +176,7 @@

3. Now we will create a pie chat using the database table to find the most frequently travelled destination. To create a pie chart using run the following:

```Python
```Python
f = plt.figure(figsize=(10,10))
ax1 = f.add_subplot(111)
start=time.time()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,20 @@ Once you have filled in all information in this statement, you can run it to cre

1. To trigger the actual calculation of the required anonymization steps, the view then needs to be refreshed:

```SQL
```SQL
-- refresh creates the metadata (before, it's not queryable)
REFRESH VIEW "[view_name]" ANONYMIZATION;
```

2. To show the results of the anonymization, you can use a SELECT statement:

```SQL
```SQL
-- shows the results
SELECT * FROM "[view_name]";
```
3. If you want to double-check if there are no individual cases with unique combinations of quasi-identifiers left in the view, you can run this statement:

```SQL
```SQL
-- double checks if there are any singled-out ones left --> should be empty
SELECT "column1", "column2", "column_n", count(*) FROM "[view_name]"
GROUP BY "column1", "column2", "column_n"
Expand All @@ -181,7 +181,7 @@ HAVING count(*)=1;

4. To examine if your anonymization was successful, you might also check how many people are indistinguishable as specified by the parameter k. To do so, you can run this statement:

```SQL
```SQL
-- show the actual counts
SELECT "[column1]", "[column2]", "[column_n]", count(*) as "Count" FROM "[view_name]"
GROUP BY "[column1]","[column2]","[column_n]"
Expand Down Expand Up @@ -212,7 +212,7 @@ If you open the **Explain Plan** of your anonymization view, you can examine the

4. To understand the need for anonymization, run the SQL query on the sample data as given below:

```SQL
```SQL
SELECT "start_year", "gender", "zipcode", "salary", count(*) as "Count" FROM "ANON_SAMPLE"
GROUP BY "start_year", "gender", "zipcode", "salary" ORDER by "Count" ASC;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To use L-Diversity, you only need to slightly change the statement for creating

4. You need to add a `COLUMN PARAMETERS` expression defining the type of data in the sensitive column {`"is sensitive":true`}

```SQL
```SQL
CREATE VIEW "[view_name]" ("id", "[column1]", "[column_n], "[column_sensitive]")
AS
SELECT "id", "[column1]", "[column_n], "[column_sensitive]"
Expand All @@ -76,7 +76,7 @@ The higher the value you specify for the L-parameter, the more people in each gr

1. First, you must create a sample table `PERSONALDATA` that has sensitive information on people regarding their age. Run the following SQL codes in your SAP HANA Database Explorer.

```SQL
```SQL
CREATE COLUMN TABLE PERSONALDATA (
-- sequence column
ID BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
Expand All @@ -92,7 +92,7 @@ AGE NVARCHAR(3) NOT NULL);

2. Now, you need to insert information into each column of your table.

```SQL
```SQL
INSERT INTO PERSONALDATA VALUES ('Peter', 'm', 'Berlin', '30');
INSERT INTO PERSONALDATA VALUES ('Sigrid', 'f', 'Cologne', '31');
INSERT INTO PERSONALDATA VALUES ('François', 'm', 'Paris', '24');
Expand All @@ -105,7 +105,7 @@ INSERT INTO PERSONALDATA VALUES ('Fabienne', 'f', 'Toulouse', '28');

3. Based on the table created above, here is an example of how a completed statement could look like for an anonymized view on a table that contains two quasi-identifying columns (gender and location) as well as a sensitive age column. In this view, at least `K=2` people should be indistinguishable based on their quasi-identifiers and at least `L=2` people should have different age values:

```SQL
```SQL
CREATE VIEW PERSONALDATA_L_ANON (ID, GENDER, LOCATION, AGE)
AS SELECT ID, GENDER, CITY AS LOCATION, AGE
FROM PERSONALDATA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pandas_df = hana_df.collect()

Add the following content into the file:

```Python
```Python
{
"user": "YourUserName",
"pwd": "YourPassword",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/hana-cloud-smart-multi-model-2/hana-cloud-smart-multi-model-2.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_profile

Check warning on line 1 in tutorials/hana-cloud-smart-multi-model-2/hana-cloud-smart-multi-model-2.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_name
parser: v2
auto_validation: true
time: 10
Expand Down Expand Up @@ -63,19 +63,19 @@

2. Set the schema `DAT260` by executing this statement:

```SQL
```SQL
SET SCHEMA DAT260;
```

3. Paste this statement to the console and execute it:

```SQL
```SQL
CREATE PREDEFINED SPATIAL REFERENCE SYSTEM IDENTIFIED BY 32630;
```

4. A list of all installed Spatial Reference Systems can be found in the table [`ST_SPATIAL_REFERENCE_SYSTEMS`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/7a2ea357787c101488ecd1b725836f07.html). To confirm that the above statement has installed `SRS 32630`, you can check the result by executing this statement:

```SQL
```SQL
SELECT * FROM ST_SPATIAL_REFERENCE_SYSTEMS WHERE SRS_ID = 32630;
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in tutorials/hana-cloud-smart-multi-model-3/hana-cloud-smart-multi-model-3.md

View workflow job for this annotation

GitHub Actions / checks / checks

content/frontmatter-missing-field

Required frontmatter field missing or empty: author_name
parser: v2
auto_validation: true
time: 10
Expand Down Expand Up @@ -49,32 +49,32 @@

3. Next, you need to bring these coordinates into SAP HANA Cloud, SAP HANA database. To do that, you can use the function [`ST_GeomFromText`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/7a194a8e787c1014bed49b5134e6b930.html). This constructor for geometries expects a [ **Well-known Text (WKT)** ](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) as well as the associated spatial reference system as input. Latitude and longitude can be easily assembled to match the expected WKT string. The associated spatial reference system in this case has `id 4326 (WGS84)`.

```SQL
```SQL
SELECT ST_GeomFromText('POINT(-0.026859 51.505748)', 4326) FROM DUMMY;
```
```

4. If you use a SQL editor with built-in spatial visualization, like `DBeaver`, you will be able to preview the location and double-check that it matches your previously selected location.

![Dbeaver.io preview location](ss-03-dbeaver-preview-location.png)

5. To make the following exercises more convenient, it is a good idea to transform this point to the same spatial reference system as our data from OpenStreetMap (SRS with `id 32630`). We can extract the Well-known Text representation by using the function [`ST_AsWKT`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/7a169dff787c1014a095b86992806f14.html).

```SQL
```SQL
SELECT ST_GeomFromText('POINT(-0.026859 51.505748)', 4326) .ST_Transform(32630) .ST_AsWKT() FROM DUMMY;
```
```

6. In the Results Panel you should now see the transformed coordinates:

```
```
POINT (706327.107445 5710259.94449)
```


7. Next, you need to select this point with Spatial Reference System `32630` by executing the following statement.

```SQL
```SQL
SELECT ST_GeomFromText('POINT (706327.107445 5710259.94449)', 32630) FROM DUMMY;
```
```


### Select a target POI
Expand All @@ -83,31 +83,31 @@

1. Your target destination is a bar called **Blues Kitchen** in Camden. All points of interest are stored in the table `LONDON_POI`. You can search our POI based on field name and amenity. The latter describes the type of POI. In our case we would like to filter for value **bar** by executing this statement:

```SQL
```SQL
SELECT *
FROM LONDON_POI lp
WHERE LOWER("name") LIKE '%blues kitchen%' AND "amenity" = 'bar'
```
```

2. You should receive 4 records in the **Results** panel.

3. You can use a visualization tool to see the location of these records. If you do not have a visualization tool installed, you can use online tools such as [Wicket](https://arthur-e.github.io/Wicket/sandbox-gmaps3.html). Wicket is able to visualize geometries in WKT format in spatial reference system 4326. To obtain these geometries from SAP HANA Cloud we can use [`ST_Transform`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/e2b1e876847a47de86140071ba487881.html) in combination with [`ST_AsWKT`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/7a169dff787c1014a095b86992806f14.html).

```SQL
```SQL
SELECT "osmid", SHAPE.ST_Transform(4326).ST_AsWKT()
FROM LONDON_POI lp
WHERE LOWER("name") LIKE '%blues kitchen%' AND "amenity" = 'bar';
```
```

4. When you copy over the geometries in WKT format to your (online) visualizer, you will see that two records are not located in Camden and the two other records are actually referring to the same location - one being a polygon depicting the outline of the building and the other being a point depicting the location of the building.

![Dbeaver.io Camden bar](ss-04-dbeaver-camden-bar.png)

5. In the next step we will work with the POI with OSM ID (field `osmid`) **6274057185**. Select it by executing this statement:

```SQL
```SQL
SELECT * FROM LONDON_POI lp WHERE "osmid" = 6274057185;
```
```



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Before creating the query, you need to make an adjustment in the SAP HANA Databa

4. Now that this setting has been adjusted, you can start with your query. To perform a spatial union operation and construct one geometry out of the result set of the above query, use the function [`ST_UnionAggr`(*)](https://help.sap.com/viewer/bc9e455fe75541b8a248b4c09b086cf5/LATEST/en-US/601aa9fb93e241af96faafcb8f01b12e.html). The following query creates the SVG as a CLOB:

```SQL
```SQL
SELECT ST_UnionAggr(le.SHAPE).ST_AsSVG(Attribute=>'stroke="red" stroke-width="0.1%"')
FROM LONDON_EDGES le
JOIN LONDON_VERTICES u ON le.SOURCE = u."osmid"
Expand Down
Loading
Loading