Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 24, 2017 at 09:46 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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!