You are on page 1of 35

DEV160 Intro to SAP HANA Database

Development with Deployment Infrastructure

Public
Speakers

Las Vegas, Sept 19 - 23 Bangalore, October 5 7 Barcelona, Nov 8 - 10

Rich Heilman Vivek Srinivasan Rich Heilman


Thomas Jung Shankari GR Thomas Jung
Rashmi Acharya

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 2


Disclaimer

The information in this presentation is confidential and proprietary to SAP and may not be disclosed without the permission of
SAP. Except for your obligation to protect confidential information, this presentation is not subject to your license agreement or
any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this
presentation or any related document, or to develop or release any functionality mentioned therein.

This presentation, or any related document and SAP's strategy and possible future developments, products and or platforms
directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice.
The information in this presentation is not a commitment, promise or legal obligation to deliver any material, code or functionality.
This presentation is provided without a warranty of any kind, either express or implied, including but not limited to, the implied
warranties of merchantability, fitness for a particular purpose, or non-infringement. This presentation is for informational
purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this
presentation, except if such damages were caused by SAPs intentional or gross negligence.

All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially
from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only
as of their dates, and they should not be relied upon in making purchasing decisions.

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 3


Agenda

HANA Deployment Infrastructure(HDI)


Core Data Services(CDS)

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 4


HANA Deployment
Infrastructure(HDI)

Public
HANA Deployment Infrastructure(HDI)
Vision
The vision of HDI is to simplify the deployment of database objects into the SAP HANA database:

Describe the SAP HANA persistency model with file-based DB design-time artifacts following the
declarative approach.

Simplify the deployment of SAP HANA database artifacts via a transactional all-or-nothing
deployment model and implicit dependency management.

Enable a dependency based incremental deployment of SAP HANA DB entities

Offer the deployment of isolated native SAP HANA content multiple times via the HDI container
model where each container corresponds to a database schema.

Use the container deployment concept to increase database security by database means, e.g. each
database schema with its deployed objects is owned by a per-schema technical database user.

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 6


HANA Deployment Infrastructure(HDI)
Overview

HANA DI is a service layer of the SAP HANA database that simplifies the deployment of SAP HANA
database artifacts by providing a declarative approach for defining database objects and ensuring a
consistent deployment into the database, based on a transactional all-or-nothing deployment model
and implicit dependency management.
Containers; HANA DI containers allow multiple deployments, sandboxing, etc.
Focus on deployment; no version control aspects, no lifecycle management aspects
Database objects only; no JavaScript programs, no OData, no application-layer artifacts

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 7


HANA Deployment Infrastructure(HDI)
File Based Design Time Artifacts

File-System-like Storage com.sap.hana.example/


Storage per Container |- src/
| |- A.hdbview
Structuring of Artifacts via Folders | |- B.hdbtable
| |- C.hdbprocedure

Runtime Names of Database Objects


Independent from File Names and Folders view X
Support for Namespace-prefixed Names as proc Z
and Free-Style Names table Y from Y as
Schema-free: No Explicit Schema References ( ) from X
A.hdbview
to Allow Containerization C.hdbprocedure
B.hdbtable

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 8


HANA Deployment Infrastructure(HDI)
Dependency Based Deployment

Dependency Extraction per Artifact


view X
Provided Database Objects Y as X
Required Database Objects from Y
A.hdbview

Deployment Process
Transactional, all or nothing
Deployment Order is Based on Dependencies table Y
Re-Deployment of Dependent Artifacts - Y
( )
proc Z
X as Z
B.hdbtable
from X
C.hdbprocedure

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 9


HANA Deployment Infrastructure(HDI)
Container Model

Database-level Container
A Container is Equal to a Database Schema view X
Database objects are deployed into the as proc Z
Schema table Y from Y as
Definitions have to be written in a schema-free ( ) from X
way
Schema-external objects are referenced via CONTAINER
database synonyms
Technical User as Object Owner
Deployment API and Storage Schema
CONTAINER#OO

APIs Storage
CONTAINER#DI

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 10


HANA Deployment Infrastructure(HDI)
Container Isolation

Zero Privileges By Default


Object Owner is a Restricted Database User view X
Object Owner has CREATE ANY on the as proc Z
Schema from Y as
But, Object Owner has No External Privileges from X

CONTAINER
Schema-free Objects
References to External Objects are Not
Allowed
view Y CONTAINER#OO
( )
ERP

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 11


HANA Deployment Infrastructure(HDI)
Cross Container Access

Zero Privileges By Default


Explicitly Grant SELECT ON ERP.Y view X
(w/ Grant Option) to the Containers Object as proc Z
Owner syn Y
from Y as
for
from X
ERP.Y
Schema-free Objects
CONTAINER
Synonym Artifacts can Point to External
Objects
Deployment-specific Configuration Artifacts
can Override Target Specifications view Y CONTAINER#OO
( ) select
ERP ERP.Y

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 12


HANA Deployment Infrastructure(HDI)
Supported Artifacts as of SPS12
Tables Synonyms & Configurations Public Synonyms
Virtual Tables & Configurations Roles Text Analysis Configuration
Indexes BI Views / Calculation Views Text Analysis Dictionaries
Fulltext Indexes Core Data Services Text Analysis Extraction Rules
Constraints Data Control Language(DCL) Text Analysis Extraction Rules
Triggers Includes
Analytical Privileges
Text Analysis Extraction Rules
Views AFLLANG Procedures Lexicons
Projection Views & Configurations Virtual Function Packages Text Mining Configurations
Scalar/Table/Aggregate/Window Table Data w/ CSV Files
Functions
Table Data w/ Properties Files
Virtual Functions & Configurations
Search Rule Sets
Table Types
Flowgraph
Procedures
Replication Task
Procedure Libraries Structured Privileges
Sequences Graph Workspaces
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 13
HANA Deployment Infrastructure(HDI)
Modeled Views & HDI

No longer supported
Analytic Views Calculation views
Attribute Views Calculation views
Scripted Calculation Views Table Functions
No column based filters Filter Expression
Explicit Client Field Modeling
Derived Parameters by Table Only Derived by Procedure

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 14


Core Data Services(CDS)

Public
Core Data Services
Development Artifact
New development artifact extension in SAP
HANA SPS 06 hdbdd (Data Dictionary)
changed to hdbcds in HDI with SPS 11

Defines reusable types, multiple entities


(tables), and views all within one source file

Multiple catalog objects are generated upon


activation

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 16


Core Data Services
User Defined Types

Individual types as well as structured


types

A structured type is a data type


comprising a list of attributes, each of
which has its own data type.

The attributes of the structured type


can be defined manually in the
structured type itself and reused
either by another structured type or
an entity.

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 17


Core Data Services
Entities & Associations
Entity is the core artifact for persistence-model
definition using the CDS syntax

CDS entity is a table with a set of data


elements that are organized using columns
and rows.

Associations define relationships between


Entities (tables)

Associations are specified by adding an


element to a source entity with an association
type that points to a target entity,
complemented by optional information defining
cardinality and which keys to use

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 18


Core Data Services
Views

CDS syntax expands to include the


definition of views

A view is a virtual table, not persisted,


based on the dynamic results
returned in response to an SQL
statement

Views can utilize the defined


associations between entities

Supports the use of functions and


expressions as well aggregation and
filtering.

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 19


Core Data Services
Graphical Editor

Graphical representation of CDS


source code
Form based entity and association
editors

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 20


Cross Container Access

Public
Cross Container Access
CUPS Create User Provided Service for the Foreign Schema Access

xs cups CROSS_SCHEMA_SFLIGHT -p
"{\"host\":\<hostname>\",\"port\":\"3XX15\",\"user\":
\<username>\",\"password\":\<password>\",\"driver\":
\"com.sap.db.jdbc.Driver\",\"tags\":[\"hana\"] ,
\"schema\" : \SFLIGHT\" }"

https://github.com/I809764/dev703/blob/master/create-cups-sflight.txt
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 22
Cross Container Access
MTA.YAML Project Usage of the User Provided Service

_schema-version: 2.0.0 resources:


ID: dev703 - name: hdi-container
version: 1.12.0 type: com.sap.xs.hdi-container
properties:
modules: hdi-service-name: ${service-name}
- name: db parameters:
type: hdb config:
path: db schema: DEV703_EXAMPLE
requires:
- name: hdi-container - name: CrossSchemaService
group: SERVICE_REPLACEMENTS type: org.cloudfoundry.existing-service
properties: parameters:
key: hdi-local-service service-name: CROSS_SCHEMA_SFLIGHT
service: ~{hdi-service-name} properties:
TARGET_CONTAINER: ~{hdi-service-name} sflight-service-name: ${service-name}
- name: CrossSchemaService
group: SERVICE_REPLACEMENTS
properties:
key: hdi-sflight-service
service: ~{sflight-service-name}

https://github.com/I809764/dev703/blob/master/mta.yaml

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 23


Cross Container Access
HDBSYNONYMGRANTOR
{
"CROSS_SCHEMA_SFLIGHT": {
"object_owner" : {
"schema_privileges":[
{
"reference":"SFLIGHT",
"privileges_with_grant_option":["SELECT", "SELECT METADATA"]
}
]
},
"application_user" : {
"schema_privileges":[
{
"reference":"SFLIGHT",
"privileges_with_grant_option":["SELECT", "SELECT METADATA"]
}
]
}
https://github.com/I809764/dev703/blob/master/db/cfg/grantor.hdbsynonymgrantor
}
}
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 24
Cross Container Access
HDBSYNONYM

{
"SFLIGHT": {
"target": {
"object": "SFLIGHT",
"schema": "SFLIGHT"
}
},
"SBOOK": {
"target": {
"object": "SBOOK",
"schema": "SFLIGHT"
}
},
"SPFLI": {
"target": {
"object": "SPFLI",
"schema": "SFLIGHT"
}
}
} https://github.com/I809764/dev703/blob/master/db/src/synonyms/sflight.hdbsynonym
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 25
Cross Container Access
HDBROLE
{ "role":{
"name": "dev703",
"schema_privileges": [{
"privileges": ["SELECT METADATA", "SELECT CDS METADATA"]
}],
"schema_analytic_privileges": [
{
"privileges":[ "FLIGHT_VIEW_PRIVILEGE",
"::FLIGHT_PRIV",
"PO_VIEW_PRIVILEGE" ]
}
],
"object_privileges":[
{
"name": "PO.Header",
"type": "TABLE",
"privileges": [ "SELECT" ]
}
]
}
}

https://github.com/I809764/dev703/blob/master/db/src/roles/dev703.hdbrole
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 26
Cross Container Access
Default Access Role
{
"role":{
"name": "default_access_role",
"schema_roles": [{
"names": ["dev703"]
}]
}
}

https://github.com/I809764/dev703/blob/master/db/src/defaults/default_access_role.hdbrole
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 27
Cross Container Access
Referencing the Role in Consuming HDI Container via HDBSYNONYMGRANTOR

{
"CrossHDIAccess-hdi-container": {
"object_owner": {
"container_roles":[dev703"]
},
"application_user": {
"container_roles":[dev703"]
}
}
}

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 28


Cross Container Access
HDBCDS Syntax Difference

context PurchaseOrder {
Entity Header {
key PURCHASEORDERID: BusinessKey;
ITEMS: Association[*] to Item on ITEMS.PURCHASEORDERID = PURCHASEORDERID;
HISTORY: HistoryT;
NOTEID: BusinessKey null;
PARTNER: BusinessKey;
CURRENCY: CurrencyT;
GROSSAMOUNT: AmountT;
NETAMOUNT: AmountT;
TAXAMOUNT: AmountT;
LIFECYCLESTATUS: StatusT;
APPROVALSTATUS: StatusT;
CONFIRMSTATUS: StatusT;
ORDERINGSTATUS: StatusT;
INVOICINGSTATUS: StatusT;
} technical configuration {
column store;
};
};

https://github.com/I809764/dev703/blob/master/db/src/data/PurchaseOrder.hdbcds
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 29
Cross Container Access
CDS Views for Foreign Schema Objects
using SFLIGHT as FLIGHTTBL; define view SflightExt as select from SflightView{
using SBOOK; "Client",
using SPFLI; "CarrierId",
context FLIGHT { "ConnectionId",
define view SflightView as SELECT from FLIGHTTBL "FlightDate",
mixin { "Bookings".BOOKID as "BookingId",
SBOOKLink: Association[*] to SBOOK "Price",
on SBOOKLink.MANDT = $projection.Client "Currency",
and SBOOKLink.CARRID = $projection.CarrierId "PlaneType",
and SBOOKLink.CONNID = $projection.ConnectionId "Bookings".CUSTOMID as "CustomerId",
and SBOOKLink.FLDATE = $projection.FlightDate; "Bookings".CUSTTYPE as "CustomerType",
} "Bookings".PASSNAME as "PassengerName
into { } with structured privilege check;
MANDT as "Client", };
CARRID as "CarrierId",
CONNID as "ConnectionId",
FLDATE as "FlightDate",
PRICE as "Price",
CURRENCY as "Currency",
PLANETYPE as "PlaneType",
SBOOKLink as "Bookings
};

https://github.com/I809764/dev703/blob/master/db/src/data/FLIGHT.hdbcds
2016 SAP SE or an SAP affiliate company. All rights reserved. Public 30
SAP TechEd Online

Continue your SAP TechEd


education after the event!
Access replays of
Keynotes
Demo Jam
SAP TechEd live interviews
Select lecture sessions
Hands-on sessions

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 31


Further information
Related SAP TechEd sessions:
DEV100 Overview of SAPs Development Platform for SAP HANA and SAP Cloud (2 hour lecture)
TEC201 SAP HANA Extended Application Services: From Classic to Advanced Model (1 hour lecture)
DEV204 Whats New in Native Application Development with SAP HANA (1 hour lecture)
DEV161 Intro to SAP HANA Extended Application Services (2 hour hands-on)
DEV107 Introduction to the SAP Web IDE for SAP HANA (1 hour lecture)
DEV607 Get a First Look at SAP Web IDE for SAP HANA (1 hour CodeJam mini-edition)
DEV703 Migrating Apps Between Models of SAP HANA Extended Application Services (30 min. Code Review)
DEV160 Intro to SAP HANA Database Development with Deployment Infrastructure (2 hour hands-on)
ITM111 Development Process and Software Logistics in XSA in SAP HANA (1 hour lecture)
DEV162 SQLScript: Basics (2 hour hands-on)
DEV264 SQLScript: Advanced Concepts (2 hour hands-on)
DEV707 SQLScript: Common Patterns, Part 1 / DEV708 SQLScript: Common Patterns, Part 2 (30 min. Code Review)
DEV608 SQLScript: How to Analyze Problems (1 hour CodeJam mini-edition)

SAP Public Web


scn.sap.com SAP HANA and In-Memory Computing SAP HANA Developer Center
www.sap.com developers.sap.com hana.sap.com

SAP Education and Certification Opportunities


www.sap.com/education
open.sap.com/courses/hana4 & open.sap.com/courses/hana5

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 32


Software Development on SAP HANA (Q4/2016)
openSAP

Available from November 2, 2016


Duration: 5 weeks
Course closure: December 15, 2016
Effort required: 3-4 hours per week

Unit 1: Introduction to SAP HANA XS Advanced

Unit 2: Database Development

Unit 3: Application Server and UI Development

Unit 4: Node.js

Unit 5: Wrap-Up

Unit 6: Final Exam

Speakers:
Thomas Jung
Rich Heilman

Sign up for free: https://open.sap.com/courses/hana5


2016 SAP SE or an SAP affiliate company. All rights reserved. Public 33
Feedback
Contact information:
Please complete your
Rich Heilman
session evaluation for Director, SAP HANA Product Management
DEV160 rich.heilman@sap.com

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 34


2016 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate
company) in Germany and other countries. Please see http://www.sap.com/corporate-en/about/legal/copyright/index.html for additional trademark information and notices.

Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors.

National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its
affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and
services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as
constituting an additional warranty.

In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop
or release any functionality mentioned therein. This document, or any related presentation, and SAP SEs or its affiliated companies strategy and possible future
developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time
for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-
looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place
undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

2016 SAP SE or an SAP affiliate company. All rights reserved. Public 35