如何将csv包含的数据导入SAP Cloud Platform HANA MDC里

简介: 如何将csv包含的数据导入SAP Cloud Platform HANA MDC里

本文使用的csv文件从这个链接里下载:

http://grouplens.org/datasets/movielens/latest/image.pngSAP HANA XS) enables you to create database schema, tables, views, and sequences as design-time files in the repository.


这个练习里,我们将会使用SAP HANA Extended Application Services (XS)提供的database schema,tables和views来实现数据导入的效果。


The HDBtable syntax is a collective term which includes the different configuration schema for each of the various design-time data artifacts, for example: schema (.hdbschema), sequence (.hdbsequence), table (.hdbtable), and view (.hdbview).


This is why we will be using the SAP HANA HDBtable syntax including Core Data Service (CDS) artifacts instead, which only requires the SAP HANA Web-based Development Workbench available with any SAP HANA MDC on the SAP Cloud Platform. All the objects will be created as design-time and will allow us to adapt the structure easily without reloading the data.


首先在SAP Cloud Platform Neo环境的HANA MDC实例里,打开HANA Web-based development workbench,切换到Catalog视图:image.png点击SQL,使用SQL语句创建一个新的user: MOVIELENS_USERimage.pngimage.pngimage.png执行后,该用户创建成功:image.png注销SYSTEM用户,使用新创建的用户登录:

image.png切换到Editor视图:

image.png在content节点下,右键菜单,新建一个Application:image.pngimage.pngPackage维护成public.aa.movielens:image.pngimage.png新建三个package,分别为data, hdb和service:image.pngimage.pngimage.png将之前链接里提供的csv文件导入data package内:

image.pngHANA schema是存放HANA数据库对象诸如表,视图,存储过程等的容器。

新建一个.hdbschema文件,内容如下:

schema_name=“MOVIELENS”:image.png再创建一个user.hdbrole文件:image.png内容如下:image.png这个role定义了我们创建的这个应用工作时需要的权限:image.pngimage.png最后创建CDS artifacts:

新建一个data.hdbdd文件:image.pngimage.png使用下列的SQL语句将新创建的user role分配给用户MOVIELENS_USER:

call _SYS_REPO.GRANT_ACTIVATED_ROLE (‘public.aa.movielens.hdb::user’,‘MOVIELENS_USER’);image.png创建一个table-import配置文件,在里面指定存储于csv文件里的数据,按照怎样的逻辑写入HANA MDC的持久化对象,比如数据库表里。

hdb package里创建一个新的文件data.hdbti :image.png此时执行下列SQL语句,就可以成功从HANA MDC实例的数据库表里读取源自csv文件里的数据了:image.pngimage.png



相关文章
|
2月前
|
UED
什么是 SAP Commerce Cloud SmartEdit Product Carousel Component Editor
什么是 SAP Commerce Cloud SmartEdit Product Carousel Component Editor
|
2月前
|
数据库
什么是 SAP S/4HANA 的 Brown Field 迁移和 Green Field 迁移
什么是 SAP S/4HANA 的 Brown Field 迁移和 Green Field 迁移
|
2月前
|
机器学习/深度学习 存储 人工智能
SAP Business Technology Platform 支持的技术栈
SAP Business Technology Platform 支持的技术栈
|
2月前
|
机器学习/深度学习 搜索推荐 UED
SAP Commerce Cloud Context Driven Services 概述
SAP Commerce Cloud Context Driven Services 概述
|
2月前
|
监控 搜索推荐 安全
SAP Commerce Cloud Context Driven Services 里 profile-tag.js 的作用介绍
SAP Commerce Cloud Context Driven Services 里 profile-tag.js 的作用介绍
|
2月前
|
存储 消息中间件 搜索推荐
SAP Commerce Cloud Context Driven Services 的 clickStreamEvents HTTP 请求
SAP Commerce Cloud Context Driven Services 的 clickStreamEvents HTTP 请求
|
2月前
|
机器学习/深度学习 人工智能 搜索推荐
SAP Commerce Cloud 智能销售服务 (Intelligent Selling Services)概述
SAP Commerce Cloud 智能销售服务 (Intelligent Selling Services)概述
|
2月前
|
安全 UED 开发者
SAP Commerce Cloud 配置项 refreshWithLock=false 的作用介绍
SAP Commerce Cloud 配置项 refreshWithLock=false 的作用介绍
|
2月前
|
Java BI API
SAP Cloud for Customer 里如何通过 ABSL 二次开发方式消费 SAP S/4HANA 系统的 API
SAP Cloud for Customer 里如何通过 ABSL 二次开发方式消费 SAP S/4HANA 系统的 API
|
2月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍