Help with database connection on import_script

Hi all, I’m attempting to use script/import_scripts/stackoverflow.rb to pull data from a MS SQL Server (the source) into discourse. I’m getting the data ok as I’ve managed to get some gems installed that where needed (tiny_tds and listen) however the script tries to connect to the Postgres Database (the target) via the socket and I can’t figure for the life of me on how to override this to use my ENV variables or config files that specify the DB host etc etc.

Please let me add I’m a sys admin by trade and not even a beginner on ruby dev so I need help like you are explaining it to a 5 year old please :slight_smile:

This is the command I’m trying to run:

bundle exec ruby script/import_scripts/stack_overflow.rb

and the error is:

URGENT: Failed to initialize site default: ActiveRecord::ConnectionNotEstablished could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

How do I get this script to connect to my DB host on another server??? Any help would be greatly appreciated.

Thanks Ric