Loading data from flat files
Loading data into your database is one of the most important tasks. You need to do this accurately and quickly. Here’s how.
Getting ready
For basic loading, COPY
works well for many cases, including CSV files, as shown in the last recipe.
If you want advanced functionality for loading, you may wish to try pgloader
, which is commonly available in all main software distributions. At the time of writing, the current stable version is 3.6.9. There are many features, but it is stable, with very few new features in recent years.
How to do it...
To load data with pgloader
, we need to understand our requirements, so let’s break this down into a step-by-step process, as follows:
- Identify the data files and where they are located. Make sure that
pgloader
is installed in the location of the files. - Identify the table into which you are loading, ensure that you have the permissions to load, and check the available...