We have different data sources for databases, especially during test case design, CSV files adds more compatibility and flexibility.
TL;DR: COPY tablename FROM ‘/path/to/file.csv’ WITH (FORMAT csv);
CSV Format
CSV stands for comma separated value. It’s a portable data format, stores data in a text format separated with commas.
Impoting CSV Into a PostgreSQL Table
PostgreSQL offers COPY … FROM syntax to import CSV into a PostgreSQL table. You can read more about COPY statement from this link.
Copy statement also has parameters for HEADERS, different delimiters.
You can import CSV Into a PostgreSQL Table like:
COPY tablename FROM '/path/to/file.csv' WITH (FORMAT csv);
PostgreSQL offers very simplified usage.
Today we covered importing a csv topic, please leave a comment below if you have question or something to add.



Leave a Reply