Using PostgreSQL. To export table data, perform the following command:
sudo -u system_user psql -d database -c "\copy (SELECT * FROM table_name) to '/tmp/output_data.csv' (format csv, delimiter ',') "
To import the data, use this command:
sudo -u system_user psql -d database -c "\copy table_name FROM '/tmp/import_data.csv' (format csv, delimiter ',')"