Skip to Content
0

How to export a table to my local file system using the EXPORT command and not through HANA Studio

Mar 24, 2017 at 09:00 PM

405

avatar image

I need to be able to export database tables to my local file system with the EXPORT command as csv files but whenever I try to issue the command (something like)

export <table name> as csv into '/mydir' with replace

the command fails with 'cannot open file: Cannot open the path /mydir

The directory does exist locally and I have all the correct permissions on it to be able to read/write to it. I know HANA Studio can do this so there must be a way through the EXPORT command to do the same. I think the command is looking for the directory on the database server which of course doesn't exist but I can't figure out how to make the command look to my local file system

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Mar 24, 2017 at 09:46 PM
1

hi Steve,

The IMPORT/EXPORT commend do not work for local file system.

You can right-click on the table itself and follow the steps(with data checkbox selected) to export data to your local file system

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Benedict,

There must be a way to do this. I'm in the process of building an application that requires translating parts of some Ruby scripts and one of the Ruby scripts does exactly this by use of the EXPORT command with the same format as I described in my question. For some reason when I try to issue the command I get the error I described so it must be something that I'm doing specifically that is incorrect

0

The only way to do this with the EXPORT command is to make your local filesystem available to the SAP HANA server and allow the directory as an export target.

As Benedict correctly stated, the EXPORT/IMPORT commands are for server-side data management and don't have a client component/

If you show us your RUBY script, we could possibly figure out, what's happening.

But beyond that, there simply is no "EXPORT" command in SAP HANA that would allow a client-side export.

HANA studio, FWIW doesn't make use of the EXPORT command for the client-side export, but simply reads data from the server via SQL commands (more or less) and writes the results out to the local file system.

1

Hi Lars,

So it must be the case that the filesystem location that the EXPORT is referencing must be configured to be accessible by HANA. There's nothing in any of the scripts that looks like the filesystem location is being exposed to HANA, so it must be done somewhere else. On the other hand, I suppose I could just certainly mimic HANA Studio and issue a SELECT statement and write the results out to a .csv as the EXPORT command can do as well.

Thank you Benedict and Lars for your quick responses!

0