技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
sap-hana-cloud【数据与研究】SAP HANA Cloud database development and administration skill. Use when writing SQLScript procedures, creating calculation views, managing HDI containers, optimizing HANA SQL, using spatial/graph/JSON engines, or configuring data tiering (NSE). If the user mentions HANA Cloud, SQLScript, calculation view, HDI container, or HANA performance tuning, use…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
sap-rap-comprehensive — CDS views consumed by HANA modelssap-s4hana-extensibility — Custom CDS/HANA artifacts in S/4HANA extensionssap-business-ai-joule — Vector engine for AI/RAG scenariossap-hana-tools — hdbsql CLI, HDI management, and HANA client toolingsap-cap-advanced — CAP with HANA Cloud native artifactsChoose your development approach:
| Scenario | Tool | Artifact |
|---|---|---|
| BTP CAP application | SAP Business Application Studio | .hdbcds, .hdbprocedure in db/src/ |
| Native HANA development | SAP HANA Database Explorer | HDI container objects |
| Data warehouse / analytics | SAP HANA Cloud Central | Calculation views, flowgraphs |
| Data tiering | HANA Cloud Central | Data Lake / Native Storage Extension |
Minimal HDI procedure:
PROCEDURE "mySchema.myProc" (
IN iv_customer_id NVARCHAR(10),
OUT et_orders TABLE (order_id NVARCHAR(10), amount DECIMAL(15,2))
)
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
READS SQL DATA
AS
BEGIN
et_orders = SELECT order_id, amount
FROM "ORDERS"
WHERE customer_id = :iv_customer_id;
END;
.hdbcds, .hdbprocedure, .hdbtable) has a build plugin.hdbgrantsundeploy.json controls what can be removed on redeploy| Engine | Use Case | Key Type |
|---|---|---|
| Relational | Standard OLTP/OLAP | TABLE, VIEW |
| Document Store | Schema-flexible JSON | COLLECTION |
| Graph | Network/relationship analysis | GRAPH WORKSPACE |
| Spatial | Geospatial queries | ST_GEOMETRY, ST_POINT |
| Vector | AI embeddings / similarity search | REAL_VECTOR |
-- .hdbtable
COLUMN TABLE "SALES_HISTORY" (
"ID" BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
"CUSTOMER_ID" NVARCHAR(10) NOT NULL,
"ORDER_DATE" DATE NOT NULL,
"AMOUNT" DECIMAL(15,2),
"DETAILS" NCLOB
) WITH PARAMETERS ('PARTITION_SPEC' = 'RANGE (ORDER_DATE)
(PARTITION VALUE <= ''2023-12-31'' PAGE LOADABLE,
PARTITION OTHERS COLUMN LOADABLE)');
PROCEDURE "processOrders" (
IN iv_date DATE,
OUT ov_count INTEGER,
OUT ov_status NVARCHAR(20)
)
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ov_status = 'ERROR';
ov_count = 0;
END;
DECLARE lv_count INTEGER;
SELECT COUNT(*) INTO lv_count
FROM "ORDERS"
WHERE order_date = :iv_date
AND status = 'PENDING';
UPDATE "ORDERS"
SET status = 'PROCESSED', processed_at = CURRENT_TIMESTAMP
WHERE order_date = :iv_date
AND status = 'PENDING';
ov_count = :lv_count;
ov_status = 'SUCCESS';
END;
-- .hdbgraphworkspace
GRAPH WORKSPACE "EMPLOYEE_ORG"
EDGE TABLE "ORG_EDGES"
SOURCE COLUMN "MANAGER_ID"
TARGET COLUMN "EMPLOYEE_ID"
KEY COLUMN "EDGE_ID"
VERTEX TABLE "EMPLOYEES"
KEY COLUMN "EMPLOYEE_ID";
-- Query: find all reports (direct + indirect) for a manager
SELECT * FROM "EMPLOYEES" e
WHERE e."EMPLOYEE_ID" IN (
SELECT "EMPLOYEE_ID" FROM GRAPH_TABLE("EMPLOYEE_ORG"
MATCH (mgr)-[EDGE * 1..10]->(emp)
WHERE mgr."EMPLOYEE_ID" = 'MGR001'
COLUMNS (emp."EMPLOYEE_ID")
)
);
CREATE COLLECTION "DEVICE_EVENTS";
INSERT INTO "DEVICE_EVENTS" VALUES('{"deviceId":"D001","ts":"2026-01-15T10:30:00Z","temp":22.5,"status":"OK"}');
-- Query nested JSON
SELECT "deviceId", "ts", "temp"
FROM "DEVICE_EVENTS"
WHERE "temp" > 30.0
ORDER BY "ts" DESC;
CREATE TABLE "KNOWLEDGE_BASE" (
"ID" BIGINT PRIMARY KEY,
"CONTENT" NCLOB,
"EMBEDDING" REAL_VECTOR(1536)
);
-- Similarity search (cosine)
SELECT TOP 5 "ID", "CONTENT",
COSINE_SIMILARITY("EMBEDDING", TO_REAL_VECTOR(:iv_query_embedding)) AS score
FROM "KNOWLEDGE_BASE"
ORDER BY score DESC;
// .hdbgrants file
{
"external_service": {
"object_owner": {
"schema_privileges": [
{ "schema_reference": "external_schema", "privileges": ["SELECT"] }
]
},
"application_user": {
"schema_privileges": [
{ "schema_reference": "external_schema", "privileges": ["SELECT"] }
]
}
}
}
// .hdbsynonym file
{
"EXT_CUSTOMERS": {
"target": {
"object": "CUSTOMERS",
"schema.configure": "external_schema"
}
}
}
Calculation views are typically created in SAP Business Application Studio graphical editor. Key design principles:
| Error Code | Message | Root Cause | Fix |
|---|---|---|---|
ERR_SQL_INV_TABLE | Invalid table name | Object not in HDI container / wrong schema | Check synonym config or .hdbgrants |
258 | Insufficient privilege | Missing SELECT/EXECUTE grant | Update .hdbgrants, redeploy container |
429 | Memory allocation failed | Query exceeds memory limit | Add filters, use NSE, check statement_memory_limit |
131 | Transaction rolled back: lock wait timeout | Long-running concurrent updates | Reduce transaction scope, check FOR UPDATE usage |
2048 | Column store error | Corrupt delta merge or index | Run ALTER TABLE ... MERGE DELTA OF ... |
| Build error | Plugin not found | Missing HDI build plugin in .hdiconfig | Add plugin mapping for artifact suffix |
ALTER TABLE ... PAGE LOADABLE for columns accessed < dailyWITH HINT(NO_CS_JOIN) only after plan analysisM_SQL_PLAN_CACHE, M_EXPENSIVE_STATEMENTS, M_SERVICE_MEMORYANALYTIC_VIEW_PARAMETERS for optimizer pruning.hdbsynonym and .hdbview will fail — use .hdbsynonymconfig for external schemasSET 'variable' = 'value' does NOT persist across connections in cloudM_EXPENSIVE_STATEMENTS{
"mcpServers": {
"hana-mcp": {
"command": "npx", "args": ["-y", "hana-mcp-server"],
"env": { "HANA_HOST": "your-instance.hana.trial-us10.hanacloud.ondemand.com",
"HANA_PORT": "443", "HANA_USER": "YOUR_USER", "HANA_PASSWORD": "YOUR_PASSWORD" }
}
}
}