1

Is there any utility available to Import the table data from CSV file.

Since I have huge no of tables and rows.Writing COPY FROM sql will take a time,so in need of any utility or another approaches

0

2 Answers 2

8

You really should use copy:

#!/bin/bash

(
  echo 'copy table_name from stdin (format csv);'
  cat table_name.csv || exit 1
  echo '\.'
) | psql database_name

You don't need to change your big files in any way. You may need to tweak some copy options (delimiter, quote etc.).

Sign up to request clarification or add additional context in comments.

1 Comment

Agree, COPY operator's built in CSV support is very powerfull.
0

This might be helpful:

http://csvloader.sourceforge.net/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.