ybsql \copy Command

The ybsql \copy command runs a client-based operation that inserts records from a file into a table, or sends rows from a table to a file. You can also use stdin and stdout for input and output.
Note: The SQL COPY command is not supported.

Yellowbrick recommends using the bulk loader (ybload) to load large tables into the database. The \copy command may be used to load smaller tables or to export table data to files.

\copy { table [ ( column_list ) ] | ( query ) } 
{ from | to } { 'filename' | stdin | stdout } 
[ [ with ] ( option [, ...] ) ]

where option is:

    FORMAT text | csv | binary
    DELIMITER 'delimiter_character'
    NULL 'null_string'
    HEADER [ 'true' | 'false' ]
    QUOTE 'quote_character'
    ESCAPE 'escape_character'
    FORCE_QUOTE { ( column_name [, ...] ) | * }
    FORCE_NULL ( column_name [, ...] )
    FORCE_NOT_NULL ( column_name [, ...] )
    ENCODING 'encoding_name'
Note: The options list is enclosed in parentheses and separated by commas. The WITH keyword is not required.

The quotes around the file name are optional.

The ybsql client reads or writes the file and routes the data between the server and the local file system. Therefore, file accessibility and privileges apply to the local user, not the server. No superuser privileges are required. For example, the user running this command only requires INSERT privileges on the team table:

premdb=# \copy team from newteam.csv with (delimiter ',');