hi community,
how do I upload data from an excel or csv file to datalake in sap hana cloud directly?
best regards.
Request clarification before answering.
Assuming that this is a continuation of the other question/post that you have?
If the data was already loaded into a Hana Cloud table and you want to move it into the data lake, the process is fairly straight forward.
Here are the basic steps, hope this helps:
Here is some sample code for everything. There are ways to do certain steps with database explorer, but I am old school and prefer reproducible SQL.
-- create HANA table
CREATE TABLE LOAD_TEST (
"A0" INT, "A1" INT, "A2" INT, "A3" INT, "A4" INT, "A5" INT, "A6" INT, "A7" INT, "A8" INT, "A9" INT
);
-- load in some dummy data
insert into LOAD_TEST values ( 0,1,2,3,4,5,6,7,8,9);
insert into LOAD_TEST select * from LOAD_TEST;
insert into LOAD_TEST select * from LOAD_TEST;
-- create the HDL table
call "SYSRDL#CG".REMOTE_EXECUTE('
drop table if exists LOAD_TEST;
CREATE TABLE LOAD_TEST (
"A0" INT, "A1" INT, "A2" INT, "A3" INT, "A4" INT, "A5" INT, "A6" INT, "A7" INT, "A8" INT, "A9" INT );
');
-- creates the HANA SDA table for the table created above
-- HDL uses SYSRDL#CG for every remote database
-- HDL uses SYSRDL#CG_SOURCE for every remote server
-- "<NULL>" is just a dummy placeholder as IQ/HDL ignore this parameter anyway
drop table HDL_LOAD_TEST; -- will error if it doesn't exist
CREATE VIRTUAL TABLE HDL_LOAD_TEST AT "SYSRDL#CG_SOURCE"."<NULL>"."SYSRDL#CG"."LOAD_TEST";
-- get counts and make sure virtual table works
select 'HANA cnt: ' || count(*) from LOAD_TEST;
select 'HDL cnt: ' || count(*) from HDL_LOAD_TEST;
-- copy data
insert into HDL_LOAD_TEST select * from LOAD_TEST;
-- get final counts to see that they are the same
select 'HANA cnt: ' || count(*) from LOAD_TEST;
select 'HDL cnt: ' || count(*) from HDL_LOAD_TEST;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.