Wednesday 5 July 2017

HANA 2.0 Doc Store Service

Overview


HANA so far has been excellent providing Row and column store But as they say, there is always scope of improvement and SAP proving it again.


SAP HANA now also includes a DocStore. Not unlike MongoDB, the SAP HANA JSON Document Store enables the developer to store and manage JSON documents (artifacts) with support for native operations on JSON including filtering, aggregation, and joining JSON documents with HANA relational tables. We are not talking about storing JSON as CLOB in a regular database column, in other words – the quick and dirty way.


Doc store service:


The Document Store is an optional feature of the SAP HANA database and you have to enable the docstore operating system process per tenant database.
The DocStore does not have a pre-determined SQL port, all communication is routed through the regular indexserver (database engine) process

Procedure to Setup


As HANA 2.0 SPS01 on wards, it is only MDC so providing only way for Multi DB.

For multi-database instances, there can be 0 (none) or 1 (one) DocStore per tenant database; you can enable the DocStore in a database tenant by running the following command as administrator in the SQL console:

ALTER DATABASE <database> ADD ‘docstore’

SAP HANA 2.0, SAP HANA Certifications

You can add to particular hostname and port also
Alter database <SID> add ‘docstore’ at location ‘<hostname>:<Available Port>’

You can find the already used ports using below command

SELECT DATABASE_NAME, SERVICE_NAME, PORT, SQL_PORT, (PORT + 2) HTTP_PORT FROM SYS_DATABASES.M_SERVICES 

SAP HANA 2.0, SAP HANA Certifications

Removing Service

Alter database <SID> remove ‘docstore’ at location ‘<hostname>:<port>’

Operations on JSON document


Login to Tenant DB using HANA studio or hdbsql or hana cockpit, We just want SQL editor , anyway from mentioned way as per one’s comfort.

SAP HANA 2.0, SAP HANA Certifications

SAP HANA 2.0, SAP HANA Certifications

Run a query for operations on JSON format. If you are developer or ABAPer it will be very easy to run queries. If you know JSON coding, it will be easy to work in HANA also like Select, update, delete, rename to name a few

SAP HANA 2.0, SAP HANA Certifications

Showing example of hdbsql also and running delete query as below:

DELETE FROM CUSTOMERS

SAP HANA 2.0, SAP HANA Certifications

You can also rename JSON documents also similar like running sql queries.

This way SAP has improved another feature of HANA and now you can store your documents directly into HANA using DocStore service.

No comments:

Post a Comment