HANA Cloud Vector Engine & Knowledge Graph Engine for RAG
As of 2026-09-23
Hands-on RAG retrieval inside SAP HANA Cloud (QRC 3/2026): REAL_VECTOR/HALF_VECTOR columns and their sizing formula, in-database embeddings with VECTOR_EMBEDDING (SAP NLP models or SAP AI Core via a sapgenaihub remote source), cosine/L2 search, HNSW indexes (M, efConstruction, efSearch, ONLINE, NO_VECTOR_INDEX), cross-encoder re-ranking, the knowledge graph engine (Triple Store, SPARQL_EXECUTE, SPARQL_TABLE, SQL_TABLE), and a five-step hybrid grounding pipeline with five SQL exercises.
What you will learn
- Create REAL_VECTOR columns with a fixed dimension and size them with SAP's formula (12 + 4 × dimension bytes)
- Generate embeddings in SQL with VECTOR_EMBEDDING using SAP NLP models or SAP AI Core models through a sapgenaihub remote source, with the correct DOCUMENT/QUERY text type
- Create and tune an HNSW vector index (M, efConstruction, efSearch, ONLINE) and measure recall against an exact NO_VECTOR_INDEX baseline
- Re-rank top-k candidates with CROSS_ENCODE
- Enable the Triple Store and query RDF with SPARQL_EXECUTE, SPARQL_TABLE and SQL_TABLE
- Design and implement a hybrid (graph + vector) retrieval query that runs under the caller's privileges
Module overview
Retrieval-augmented generation (RAG) lives or dies on retrieval. The language model only answers as well as the context you hand it, and in an SAP landscape the best context sits in two shapes: text (policies, contracts, service notes, product descriptions) and relationships (this material belongs to that product line, this supplier is certified for that plant, this cost center rolls up to that profit center). SAP HANA Cloud now handles both natively: the vector engine stores and searches embeddings in SQL, and the knowledge graph engine stores RDF triples and answers SPARQL — in the same database, in the same transaction, next to the relational data they describe.
This module is hands-on. You will create vector columns, generate embeddings inside the database, build and tune an HNSW index, re-rank with a cross-encoder, load and query a knowledge graph, and combine both into a hybrid retrieval query that a Joule agent or a CAP service can call. Every statement below follows the syntax published in the SAP HANA Cloud Vector Engine Guide and the SPARQL Reference Guide (version QRC 3/2026, read on 23 September 2026). Run them on a trial or development instance, never first on production.
Prerequisites
- SQL on SAP HANA (column tables, joins, privileges) and access to a HANA Cloud development or trial instance
- Review core concepts first: C027, C154, C182
- Recommended modules: M137 Vector Databases in SAP Context, M138 Graph Analytics & SAP HANA Graph, M054 Grounding Joule on Enterprise Data
Outcomes
- Size a HANA Cloud instance for a given corpus using the vector memory formula and SAP's two-times rule of thumb.
- Write working SQL for embedding generation, HNSW indexing, similarity search and cross-encoder re-ranking.
- Load and query a small knowledge graph and join its results to a vector search in one SQL statement.
- Explain to a security reviewer why in-database hybrid retrieval inherits existing privileges, and which grants are required.
Full module available to members. The full module adds: the decision framework · the end-to-end scenario walkthrough · the KPI scorecard · the anti-patterns · the code blocks · the knowledge check · the diagrams.