Build or install pg_loader on Windows

I use PostgreSQL 9.6 on a Windows 7 laptop that is tightly managed by enterprise IT. I do not have administrator rights on this laptop, but you can do a lot of things, including installing software, through the elevated rights granted through BeyondTrust.

I use this database to import several medium-sized datasets from different sources and to conduct in-depth analysis and reporting. These datasets have crazy coding and formatting variations, which creates import issues. For a single dataset, I first import it into MySQL, breaking the data characters, exporting it back to CSV, and finally importing this cleared data into PostgreSQL.

As an experiment, I installed PostgreSQL 9.6 and pg_loader on my home iMac running macOS 10.12, and it can import all data sets without problems.

Given all this as a background, I need to use pg_loader to import various data sets. However, the website does not offer a Windows installer or instructions for compiling it in Windows.

Can someone point me in the direction of one of the following options: the list will be from the desired to the least desired?

  • Windows Installer pg_loader
  • Windows Installer comparable alternative to pg_loader
  • Detailed instructions for compiling pg_loader on Windows
  • Suggestions for using Python to clear data before importing (caveat: I have very little experience with Python)
+6
source share
1 answer

This solution may be a little late to the initial request, but for those who are still looking for a solution for Windows. I can confirm that I managed to get pgloader to work using Docker for Windows.

My environment is installing MySQL locally on a Windows 10 PC. I installed Docker for Windows. Then I installed PostgreSQL via docker: docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres

Finally, I launched pgloader via docker to output the schema and data from mysql to postgres using the following: docker run --rm --name pgloader dimitri/pgloader:latest pgloader mysql://root: root@host.docker.internal /my_db_name pgsql://postgres: mysecretpassword@host.docker.internal /postgres

This created a schema named "my_db_name" in my postgres instance. "Root: root" and "postgres: mysecretpassword" is my username: password data. This is obviously a production ready environment! Another useful bit, "host.docker.internal", is the Docker reference to the host's parent environment. In addition, I ignored the SBCL warning.

I am still processing the results. Almost everything looks as if it has been successfully transferred. I miss the triggers (not supported) and some foreign keys (error?). In any case, I hope this can be useful to others.

0
source

All Articles