Skip to content

Since SPS09 Hana supports writing new adapters for Smart Data Access, Batch Data Loading, ETL, Realtime Replication and Realtime Transformations. While common adapters are provided by SAP, everyone can write own adapters using the Hana Adapter SDK. This github project aims to provide additional adapters for using them or as samples. Feel free to…

License

Notifications You must be signed in to change notification settings

cwilligv/hana-native-adapters

 
 

Repository files navigation

Hana Native Adapter Development in Java

Overview

While Hana can be seen as yet another database to read data from or load data in using external tools, Hana has built-in capabilities for batch and realtime data provisioning and data federation. Any adapter registered in Hana can be used to query remote sources using regular Hana SQL commands and, if the adapter supports this capability, push changes into Hana tables or tasks (=transformations). As all adapters written using the Adapter SDK are no different from the SAP provided adapters, they can be used by all tools and editors as well, e.g. Replication Editor, Task Flow Editor, Enterprise Semantic Search,.....

The aim of this repository is to provide adapters as source code to access more sources. These adapters are provided by SAP employees, partners and customers on a as-is basis with the indention of being used in production environments and to act as examples.

For more details refer to Hana Smart Data Integration at SCN. The Adapter SDK is part of the Hana EIM option and as such fully documented in help.sap.com

Contributing

This is an open source project under the Apache 2.0 license, and every contribution is welcome. Issues, pull-requests and other discussions are welcome and expected to take place here.

Sample Adapters

  • WriteBackAdapter: Shows the writeback capabilities, meaning read data from hana and push to remote source
  • DemoAdapter: Shows the virtual function and virtual procedures capablities.
  • JDBCAdapter: Shows how to connect to the remote DB using jdbc and also rewriting HANA SQL Query to remote format
  • RealTimeTestAdapter: Shows Real time replication capablities.
  • WebServiceAdapter: Shows how to call httpserver and expose the response via Adapter SDK. See link

SQL to use custom adapter

--Note: You do not need to run drop command but this provides you an idea what command to run for clean up

drop agent "DebugAgent" cascade;

create agent "DebugAgent" protocol 'TCP' host '<your host ip>' port 5050;

--Check if Agent is registered. Make sure host:port are properly setup.
select * from agents;

--Custom Adapter Registration
drop adapter "WriteBackAdapter" cascade;
create adapter "WriteBackAdapter" at location agent "DebugAgent";

--Run the following if remote source config or capabilities are updated.
alter adapter "WriteBackAdapter" refresh at location agent "DebugAgent";


--Check for adpater registration.
select * from adapters;

--Create WriteBackAdapter Remote Source. Always use UI for doing the following but you can use SQL for testing.
drop remote source "MyRemoteSource" cascade;
CREATE REMOTE SOURCE "MyRemoteSource" ADAPTER "WriteBackAdapter" AT  LOCATION agent "DebugAgent" 
 CONFIGURATION '<?xml version="1.0" encoding="UTF-8"?>
 <ConnectionProperties name="testParam">
	<PropertyEntry name="name">Hana_Studio</PropertyEntry>
 </ConnectionProperties>
'	
 WITH CREDENTIAL TYPE 'PASSWORD' USING 
 '<CredentialEntry name="credential">
		<username>testuser</username>
		<password>testpassword</password>
</CredentialEntry>';

--HANA stores your remote source configuration in the following table.
select * from remote_sources;


--Check if above configuration is correct.
call CHECK_REMOTE_SOURCE('MyRemoteSource');

--Browse via ui.
 CALL "PUBLIC"."GET_REMOTE_SOURCE_OBJECT_TREE" ('MyRemoteSource','',?,?);

--Import the table to hana
drop table "SYSTEM"."test_table";
CREATE VIRTUAL TABLE "SYSTEM"."test_table" at "MyRemoteSource"."<NULL>"."<NULL>"."InMemoryTable";

--Select from source table.
select * From "SYSTEM"."test_table";

About

Since SPS09 Hana supports writing new adapters for Smart Data Access, Batch Data Loading, ETL, Realtime Replication and Realtime Transformations. While common adapters are provided by SAP, everyone can write own adapters using the Hana Adapter SDK. This github project aims to provide additional adapters for using them or as samples. Feel free to…

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%