Reputation: 13
my postgres version is 12.4 , I'm loading multiple csv files into single table, The problem here is every time firing below command is not good ,any other alternative (or) suggestions are there?
COPY testemail FROM '/md-data/vamshi/s3data/test_Hash_2021.csv' WITH (FORMAT csv);
COPY testmail FROM '/md-data/vamshi/s3data/test_Hash_2025.csv' WITH (FORMAT csv);
COPY testmail FROM '/md-data/vamshi/s3data/test_Hash_2026.csv' WITH (FORMAT csv);
..............etc
and below command also i tried, but its not working,
COPY testemail FROM '/md-data/vamshi/s3data/t*.csv' WITH (FORMAT csv);
Upvotes: 1
Views: 299
Reputation: 1220
you can load all files using:
cat /md-data/vamshi/s3data/test_Hash*.csv | psql -c 'COPY testemail from stdin CSV HEADER'
Upvotes: 1