1

I know that by doing:

COPY test FROM '/path/to/csv/example.txt' DELIMITER ',' CSV;

I can import csv data to postgresql.

However, I do not have a static csv file. My csv file gets downloaded several times a day and it includes data which has previously been imported to the database. So, to get a consistent database I would have to leave out this old data.

My bestcase idea to realize this would be something like above. However, worstcase would be a java program manually checks each entry of the db with the csv file. Any recommendations for the implementation?

I really appreciate your answer!

2

1 Answer 1

1

You can dump latest data to the temp table using COPY command and MERGE temp table with the live table.

If you are using JAVA program for execute COPY command, then try CopyManager API.

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.