Sample Header Ad - 728x90

Spool/Capture output of COPY command in postgres/Redshift in shell script

1 vote
1 answer
997 views
I have shell script which will insert data into Redshift/Postgres database using psql command and i am using > for capturing script output. It captures everything but not how many rows inserted. When i run manually script on screen i can see rows inserted but not when i append output to file. Currently i am getting - TRUNCATE TABLE and COMMIT TRANSACTION COPY Expected output- TRUNCATE TABLE and COMMIT TRANSACTION INFO: Load into table 'tablename' completed, 568 record(s) loaded successfully. COPY Command for insert from my script - psql -w -U uname -h dbhost db --port 1234 -c "COPY tablename FROM 's3://bucket1/tablename.json' credentials 'aws_access_key_id=' format as json 'auto';"
Asked by user437275 (13 rep)
Oct 14, 2020, 11:59 AM
Last activity: Oct 14, 2020, 02:30 PM