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
24 changes: 12 additions & 12 deletions tutorials/hana-clients-cf/hana-clients-cf.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u

The API URL, if requested, can be found in the Overview page in [SAP BTP cockpit](https://account.hanatrial.ondemand.com/trial/).

![api URL](api.png)
![API URL](api.png)

The API URL can be set with the below command.

Expand Down Expand Up @@ -212,7 +212,7 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u

Open a browser and enter a URL similar to http://localhost:3000/Customers.

![running locally](local.png)
![Running locally](local.png)

### Deploy and test in SAP BTP or XS Advanced

Expand Down Expand Up @@ -251,23 +251,23 @@ The command line interface (CLI) for Cloud Foundry is named `cf` while the CLI u

If necessary, you can add the entitlement by clicking Edit. Don't forget to save your changes when finished.

![Add CF Memory service plan](add-cf-runtime-entitlement.png)
![Add CF memory service plan](add-cf-runtime-entitlement.png)

After verifying that you have the necessary entitlements, run the following:

```Shell
cf push
```

![push result](cfPush.png)
![Push result](cfPush.png)

Notice above the URL to open the app was generated as the `manifest.yml` contained the random-route setting.

```Shell
xs push
```

![push result](xsPush.png)
![Push result](xsPush.png)

Alternatively, the URL of the app can be found by running the following command:

Expand Down Expand Up @@ -324,7 +324,7 @@ For additional details see:
cf events nodeQueryCF
```

![events](events.png)
![Events](events.png)

4. The logs of the application can be seen with the below command:

Expand Down Expand Up @@ -352,7 +352,7 @@ For additional details see:

Refresh the browser and notice that the trace information can now be seen.

![trace](trace.png)
![Trace](trace.png)

6. The deployed app can also be managed in the associated cockpit.

Expand Down Expand Up @@ -380,19 +380,19 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit

- Navigate to **Service Bindings** and choose **Bind Service**.

![bind service](bind-service1.png)
![Bind service](bind-service1.png)

- Add the **Connectivity** service.

![connectivity service](connectivity-service.png)
![Connectivity service](connectivity-service.png)

- Provide an instance name such as `MyConnectivityService`.

![connectivity service](connectivity-service2.png)
![Connectivity service](connectivity-service2.png)

- Examine the values of the connectivity service. The indicated values below are used for the `proxyPort` and `proxyHostname` values in the `server.js` file. It will be to access the proxy service which enables communication with the cloud connector.

![connectivity service](connectivity-service3.png)
![Connectivity service](connectivity-service3.png)

3. Add the service name to the project's manifest.yml.

Expand Down Expand Up @@ -526,4 +526,4 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit

Congratulations, you have built, deployed, and run an app that queries SAP HANA in Cloud Foundry and XS advanced as well as become familiar with the command line interface.

---
---
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 27 additions & 11 deletions tutorials/hana-clients-trace/hana-clients-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ primary_tag: software-product>sap-hana-cloud

Trace files can help SAP Support diagnose unexpected behavior.

Tracing can be configured using executables included with the SAP HANA Client installation. [SQLDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/0c20691739094593855ece908b4a3cde.html)-based interfaces use `hdbsqldbc_cons`, except for [ODBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/35368f78f6884b019caee12c125b255a.html), which uses `hdbodbc_cons`. For [JDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4033f8e603504c0faf305ab77627af03.html), use `ngdbc.jar`.
Tracing can be configured using executables included with the SAP HANA Client installation. [SQLDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/0c20691739094593855ece908b4a3cde.html)-based interfaces use `hdbsqldbc_cons`, except for [ODBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/35368f78f6884b019caee12c125b255a.html), which uses `hdbodbc_cons`. For [JDBC](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/4033f8e603504c0faf305ab77627af03.html), use `ngdbc.jar`.

Trace settings can also be configured using environment variables, or via connection parameters.

Expand All @@ -43,7 +43,6 @@ Trace settings can also be configured using environment variables, or via connec

> `hdbsqldbc_cons` utility can be found in the `sap/hdbclient` folder.


2. To enable tracing of SQL statements at the INFO level, to enable tracing of TIMING info, and to specify the trace file location and name, enter the following commands:

```Shell (Microsoft Windows)
Expand Down Expand Up @@ -86,7 +85,7 @@ Trace settings can also be configured using environment variables, or via connec
hdbsqldbc_cons SHOW ALL
```

![trace settings](trace-settings.png)
![Trace settings](trace-settings.png)

3. Run the following command to connect to HDBSQL and query for the status. Since tracing is enabled, a trace file will be generated and can be used to see which SQL statements are called by `\s`.

Expand All @@ -108,7 +107,7 @@ Trace settings can also be configured using environment variables, or via connec
pico SQLDBC-####.txt
```

![Replace Process ID](ReplaceProcessID.png)
![Replace process ID](ReplaceProcessID.png)

Notice that the trace settings are shown at the top of the file.

Expand Down Expand Up @@ -232,9 +231,9 @@ The following are some additional options for tracing.

4. In situations where `hdbsqldbc_cons` is not accessible, perhaps because a driver was installed directly using npm or pip, trace settings can be set using environment variables. The following values can be used in the trace file name.

* %p represents the process ID
* %a represents the application user
* %c represents the connection ID
- %p represents the process ID
- %a represents the application user
- %c represents the connection ID

```Shell (Windows)
set HDB_SQLDBC_TRACEFILE=c:\temp\traces\SQLDBC-%p.txt
Expand Down Expand Up @@ -267,22 +266,39 @@ The following are some additional options for tracing.
printenv | grep HDB_SQLDBC_TRACE
```

![Environment Variable Values](EnvironmentVariable.png)
![Environment variable values](EnvironmentVariable.png)

5. Trace information can be directed to `stdout` or `stderr`. See below for a few examples.

```Shell
hdbsql -U User1UserKey -Z traceFile=stdout -Z traceOptions=sql=warning "SELECT * FROM HOTELS.CUSTOMER"
hdbsql -U User1UserKey -Z traceFile=stdout -Z traceOptions=SQL=ERROR,DEBUG=FATAL,FLUSH=ON "SELECT * FROM HOTELS.CUSTOMER"
```

```Shell
set HDB_SQLDBC_TRACEOPTS=SQL=WARN
set HDB_SQLDBC_TRACEOPTS=SQL=ERROR,DEBUG=FATAL,FLUSH=ON
set HDB_SQLDBC_TRACEFILE=stdout
hdbsql -U User1UserKey "SELECT * FROM HOTELS.CUSTOMER"
set HDB_SQLDBC_TRACEOPTS=
set HDB_SQLDBC_TRACEFILE=
```

![Environment variables set using -Z](environment-variables-z.png)

It is also possible to set in a Cloud Foundry manifest file or in the SAP BTP Cockpit.

```manifest.yaml
applications:
- name: test-hana-node-tracing
memory: 1G
instances: 1
path: ../
env:
HDB_SQLDBC_TRACEFILE: stdout
HDB_SQLDBC_TRACEOPTS: SQL=ERROR,DEBUG=FATAL,FLUSH=ON
```

![Application variables](BTP-app-variables.png)

6. Tracing can also be enabled in an application's connection properties. For further details see `traceFile` and `traceOptions` in [SQLDBC Connection Properties](https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/f6fb06ffe4484f6fa61f10082b11663d.html).

### Tracing a JDBC Connection
Expand Down Expand Up @@ -314,7 +330,7 @@ javac -version
java -jar ~/sap/hdbclient/ngdbc.jar
```

![JDBC Driver GUI](JDBC-Driver-Trace-Config.png)
![JDBC driver GUI](JDBC-Driver-Trace-Config.png)

2. Turn on the tracing for SQL statements using either the GUI or the commands below:

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

Check warning on line 1 in tutorials/hana-cloud-sqltools-console/hana-cloud-sqltools-console.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')
parser: v2
auto_validation: true
time: 10
time: 15
author_name: Dan van Leeuwen
author_profile: https://github.com/danielva
tags: [tutorial>beginner, software-product>sap-hana-cloud, software-product-function>sap-hana-cloud--sap-hana-database, software-product-function>sap-hana-cloud--data-lake]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parser: v2
auto_validation: true
author_name: Dan van Leeuwen
author_profile: https://github.com/danielva
time: 15
time: 25
tags: [ tutorial>beginner, software-product>sap-hana-cloud, software-product-function>sap-hana-cloud--sap-hana-database, programming-tool>sql]
primary_tag: software-product>sap-hana-cloud
---
Expand Down Expand Up @@ -84,6 +84,12 @@ The following steps create a sample hotel dataset using CREATE and INSERT statem

> ![User & role management in SAP HANA Cloud Central](user-management.png)

It is also possible to use the explain option in regions that support the feature for an explanation of SQL statements.

![Explain SQL](explain.png)

This is covered further in the tutorial [Query Databases Using the SQL Console in SAP HANA Cloud Central](hana-cloud-sqltools-console).

3. Open a new SQL console tab by pressing the **+** in the tab bar. This time we wish to connect with USER1 and to set the schema to HOTELS so we will not use the cached credentials (DBADMIN).

Click on **Select an Instance** and choose the SAP HANA database.
Expand Down Expand Up @@ -325,6 +331,18 @@ Execute the below SQL and notice that USER2 does not have the privilege to perfo

For further details, consult [Identifiers and Case Sensitivity](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/introduction-to-sql#loio209f5020751910148fd8fe88aa4d79d9__identifiers_case).

4. Monitoring views contain information about the objects within a database. For further details see [Monitoring Views](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/monitoring-views?locale=en-US).

```SQL
--List of tables and record counts in the schema HOTELS
SELECT SCHEMA_NAME, TABLE_NAME, RECORD_COUNT, TABLE_SIZE
FROM M_TABLES WHERE SCHEMA_NAME = 'HOTELS' ORDER BY RECORD_COUNT DESC;

--List of columns and data types for the tables in schema HOTELS
SELECT SCHEMA_NAME, TABLE_NAME, COLUMN_NAME, DATA_TYPE_NAME
FROM TABLE_COLUMNS WHERE SCHEMA_NAME = 'HOTELS' ORDER BY TABLE_NAME ASC, COLUMN_NAME ASC;
```

### Explore auto-commit (optional)

Auto-commit is a setting that when enabled, causes each SQL statement to be immediately committed to the database. When auto-commit is off, multiple statements can be executed and then committed or rolled back together.
Expand Down Expand Up @@ -616,20 +634,6 @@ Another option for less frequently accessed data is the SAP HANA data lake. Add

For additional details see [Procedures](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-sqlscript-reference/procedures).

### Examine the created objects using monitoring views

Monitoring views contain information about the objects within a database. For further details see [Monitoring Views](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/monitoring-views?locale=en-US).

```SQL
--List of tables and record counts in the schema HOTELS
SELECT SCHEMA_NAME, TABLE_NAME, RECORD_COUNT, TABLE_SIZE
FROM M_TABLES WHERE SCHEMA_NAME = 'HOTELS' ORDER BY RECORD_COUNT DESC;

--List of columns and data types for the tables in schema HOTELS
SELECT SCHEMA_NAME, TABLE_NAME, COLUMN_NAME, DATA_TYPE_NAME
FROM TABLE_COLUMNS WHERE SCHEMA_NAME = 'HOTELS' ORDER BY TABLE_NAME ASC, COLUMN_NAME ASC;
```

### Schedule a stored procedure

Procedures can be scheduled to run automatically in SAP HANA Cloud.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Local connections are added directly in Visual Studio Code by specifying the hos

1. In the **Database List** section, navigate to **Local Connections** and click the **+** button to **Add SAP HANA Database**.

2. Select **SAP HANA Cloud** as the database type and enter values for **Host**, **Port**, **User**, and **Password**. You may also set a display name. This tutorial makes use of the `HOTELS` schema, in **Advanced Options** set `currentSchema=HOTELS;`
2. Select **SAP HANA Cloud** as the database type and enter values for **Host**, **Port**, **User**, and **Password**. These values can be obtained from the actions menu **Copy SQL Endpoint** of an instance in SAP HANA Cloud Central. Remember to remove the :443 and for the host value and to add 443 as the port. You may also set a display name. This tutorial makes use of the `HOTELS` schema, in **Advanced Options** set `currentSchema=HOTELS;`

> Enable the **Connect to database securely using TLS/SSL** checkbox to ensure the connection is secure. If you do not check **Save Password**, you will be prompted for your password each time the extension starts.

Expand Down Expand Up @@ -163,5 +163,3 @@ The SAP HANA Database Explorer extension includes a built-in collection of SQL s
### Knowledge check

Congratulations! You have now used the SAP HANA Database Explorer extension for Visual Studio Code and have become familiar with some of the features it provides.

[VALIDATE_7]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
author_name: Michelle Wang
author_profile: https://github.com/MichelleWangSAP
auto_validation: true
time: 15
time: 20
tags: [ tutorial>beginner, software-product>sap-hana-cloud, software-product-function>sap-hana-cloud--sap-hana-database, software-product-function>sap-hana-cloud--data-lake]
primary_tag: software-product>sap-hana-cloud
parser: v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ parser: v2
auto_validation: true
author_name: Dan van Leeuwen
author_profile: https://github.com/danielva
time: 15
time: 20
tags: [ tutorial>beginner, software-product>sap-hana-cloud, software-product-function>sap-hana-cloud--sap-hana-database, software-product-function>sap-hana-multi-model-processing, software-product-function>sap-hana-spatial, software-product-function>sap-hana-graph, tutorial>license]
primary_tag: software-product>sap-hana-cloud
---

# Try Out Multi-Model Functionality with SAP HANA Cloud Central and Database Objects App

<!-- description --> Explore knowledge graph, property graph, JSON document store, and spatial capabilities in SAP HANA Cloud Central.
<!-- description --> Explore vector, knowledge graph, property graph, JSON document store, and spatial capabilities in SAP HANA Cloud Central.

## Prerequisites

Expand All @@ -23,6 +23,8 @@ primary_tag: software-product>sap-hana-cloud

## Overview

The [SAP HANA Cloud vector engine](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/introduction) enables similarity search using vector embeddings and built in functions.

A [knowledge graph](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-knowledge-graph-guide/sap-hana-cloud-sap-hana-database-knowledge-graph-engine-guide) can be used to store facts in triples providing additional meaning and relationships.

A [property graph](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-property-graph-engine-reference/sap-hana-cloud-sap-hana-database-property-graph-engine-reference) can be used to show the connections between items such as the connections between airports or between people or groups in a social network.
Expand All @@ -33,6 +35,51 @@ This tutorial is meant to be an introduction to these topics. For additional co

---

### Similarity searches using the vector engine

The ability to embed text as a vector and to then use that in a similarity search will be demonstrated in the instructions that follow. A pre-requisite for these steps is to have enabled the Natural Language Processing (NLP) on the advanced settings tab of the instance provisioning or manage configuration wizard.

1. Open the SQL console and examine the DESCRIPTION column in hte table MAINTENANCE.

```SQL
SET SCHEMA HOTELS;
SELECT * FROM MAINTENANCE;
``

![Maintenance work in the hotels dataset](maintenance-table.png)

2. Run the SQL below to see an example of the built-in VECTOR_EMBEDDING function that takes a string and converts it to a vector representation.

```SQL
SELECT VECTOR_EMBEDDING('Roof repair due to storm', 'DOCUMENT', 'SAP_NEB.20240715') FROM DUMMY;
```

3. Create a new column in the MAINTENANCE table and populate it with a vector representation of the DESCRIPTION column.

```SQL
ALTER TABLE MAINTENANCE ADD (V_DESCRIPTION REAL_VECTOR GENERATED ALWAYS AS VECTOR_EMBEDDING(DESCRIPTION, 'DOCUMENT', 'SAP_NEB.20240715'));

SELECT * FROM MAINTENANCE;
```

![Added a vector column](new-vector-column.png)

4. Use the new V_DESCRIPTION column in a similarity search (COSINE_SIMILARITY).

```SQL
SELECT TOP 1 COSINE_SIMILARITY(V_DESCRIPTION, TO_REAL_VECTOR(VECTOR_EMBEDDING('shingles', 'DOCUMENT', 'SAP_NEB.20240715'))) AS SCORE, *
FROM MAINTENANCE ORDER BY SCORE DESC;
SELECT TOP 1 COSINE_SIMILARITY(V_DESCRIPTION, TO_REAL_VECTOR(VECTOR_EMBEDDING('swim', 'DOCUMENT', 'SAP_NEB.20240715'))) AS SCORE, *
FROM MAINTENANCE ORDER BY SCORE DESC;

--Optionally remove the added EMBEDDING column
ALTER TABLE MAINTENANCE DROP (V_DESCRIPTION);
```

![Similarity search](similarity-search.png)

For further details, see [SAP HANA Cloud, SAP HANA Database AI Development Guide](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-sap-hana-database-ai-development-guide/overview), [Creating Text Embeddings with NLP](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/creating-text-embeddings-with-nlp-51eb170d038d4099a9bbb85c08fda888), and [Similarity Measures](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-vector-engine-guide/similarity-measures).

### Enable the triple store and create a knowledge graph (optional)

The following steps will create a knowledge graph that provides information on additional hotel amenities, explores the created knowledge graph using the database objects app, and then will perform a query on the knowledge graph. Knowledge graphs are also known as resource description framework (RDF) named graphs and are stored in a triple store.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading