Error with "Copy to"

Hi I am receiving thie error when doing COPY TO with crate command:

crash --hosts 127.0.0.1 -c “copy metermaster22 to DIRECTORY ‘/crateBackup’”
CONNECT OK
SQLActionException[NotSerializableExceptionWrapper: unhandled_server_exception: Failed to open output: ‘/crateBackup/metermaster22_2_.json (No such file or directory)’]

I tried to recreate the error, are you sure that the ‘/crateBackup’ exists?

Hi,

I’m having exactly the same problem.
We have a install/deployment script which always does the same:

  1. remove all json files from backup dir
  2. create new backup files via COPY TO DIRECTORY

This is what I keep getting, and it is not always on the same table too!

curl -H 'Content-Type: application/json' -sSXPOST 'localhost:4200/_sql?pretty' -d@- << EOF
 {"stmt":"COPY bookndrive.\"station\" TO DIRECTORY ?", "args":["/opt/norepos/data/tmp"]}
EOF
{
  "error" : {
    "message" : "SQLActionException[NotSerializableExceptionWrapper: unhandled_server_exception: Failed to open output: '/opt/norepos/data/tmp/station_0_.json (No such file or directory)']",
    "code" : 5000
  }
}

Any idea how we can pinpoint the exact cause of this?

Hi @senchi,

Did you check if the target directory exists?