Contents
Generating Core Data Services files with Sybase PowerDesigner. 1
What is Core Data Services?. 1
The basics: Creating a project, a physical data model and the data model 1
Installing the HDBCDS Extension File (HDBCDS.xem). 6
The funny part: Generating the CDS definition file. 8
Using Domains in the Data Model (CDS Basic Types). 11
Working with multiple Contexts. 13
As described in the SAP HANA CDS Reference guide, Core Data Services (CDS) is an infrastructure that can be used by database developers to create the underlying (persistent) data model which the application services expose to UI clients.
In that sense, CDS looks to be similar to SQL DDL but the key advantage is that CDS definition files are created as design-time objects that means that can be transported together with HANA Models.
Design-time objects for Data Model definition + logic + UI layer is indispensable for Native HANA Apps.
With this SPD Extension you can create CDS (.hdbdd) files from Physical Data Models.
So, let’s take the following example from the SAP HANA CDS Reference Guide
This code creates two tables after activation in the schema MYSCHEMA.
The CDS Guide explains in details all the elements that composes a CDS file (.hdbdd).
Go to File -> New Project and give a name to the project
1) Go to File -> New Model and select Physical Model under the Information category.
2) Create the Book and Author tables
3) Create the SCHEMA
Go to Model -> User and Roles -> Schemas
4) Set the Table’s owner
Go to Model -> Tables
And set the Owner column to MYSCHEMA
5) Preview the Data Model (press Ctrl+G or Right click on the Model -> Properties )
Before proceeding we must create a folder to store the .XEM extension file.
Go to Model -> Extensions -> Attach an Extension
Click on Path and select the folder that contains the .XEM file
After the Path is added, select the HDBCDS extension
Once the HDBCDS extension is added, a new object is added to the toolbox for creating contexts
Before generating the .hdbdd file from the PDM we must create a Package and a Context.
Using the package tool in the toolbox under SAP HANA Database 1.0 category, create a package named com.acme.myapp1
Use the context tool to create a context named Books.
Set the context Books as main context for the data model.
Go to Model Properties (right click on DemoCDS Model -> Properties)
In the CDS Tab set the Books context for the Context property
Finally, generate the CDS Definition files. Go to Tools -> Extended Generation
In the Targets tabs select HDBCDS, let the Selection by default selecting all objects and in Generated Files select the .hdbdd and .hdbschema files.
Set an output directory and click Ok to generate the two files
CDS supports the definition of shared types so that your columns definition can reference the types instead of declaring explicit the data type.
f.e.
To use this feature, go to Model -> Domains and define a Domain, for example “TextoLargo” defined as VARCHAR(100)
Set the Domain in the columns definition, instead of setting the Data Type.
Go to Model -> Columns
And set de Domain value to “TextoLargo” for those fields of Varchar(100) type
Tip: If the Domain column is not present in the Columns properties, press Ctrl+U and select “Domain”.
Go to Tools -> Extended Generation and generate the model.hdbddfile once again.
As described in the CDS Guide, we can define multiple contexts for grouping tables that belongs to the same functional group.
For instance, let’s rename the Book context to Main context, and create 2 more contexts named “Datamodel” and “Application”
Go to the Book table’s properties, and select the CDS tab, then set the Context to “Datamodel”
Create a 3rdtable named UILogic and set the “Application” context in the CDS Tab
Finally, generate the hdbdd file to see the context definition.
It is possible to use Sybase PowerDesigner to generate SAP HANA CDS files. Using an enterprise modeling tool such as PowerDesigner gives more transparency in the model definition and simplifies the data model maintenance. There is no big effort to generate the CDS file once the PDM is defined.
There are some limitations in this extension, for example structured typed cannot be created.
If you want to enhance this extension, feel free to modify the code.
Go to Extensions -> HDBCDS -> Properties to see all the code behind this extension
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
36 | |
25 | |
17 | |
13 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 |