Skip to content

PostgresqlMixin Process not called #45

@yehonathan

Description

@yehonathan

I have the following in my main javascript file but it seems that the process is never called .

var dpumps =require('datapumps');
Pump = dpumps.Pump;
PostgresqlMixin= dpumps.mixin.PostgresqlMixin;
QueryStream = require('pg-query-stream');
Client = require('pg').Client;

var con = {
host: 'localhost',
port: 5432,
database: 'mydatabase',
user: 'myuser',
password: 'mypass'
};

postgresqlClient = new Client(con) ;

exports.pump = function () {
console.log("Ready To Pump"); //This logs so i know the function is called.
postgresqlCopy = new Pump()
.from(postgresqlClient.query(new QueryStream("SELECT $1~, $2~, $3~ FROM $4~ LIMIT 10",["RowId", "Company", "ArticleNo", "Article"])))
.mixin(PostgresqlMixin(postgresqlClient))
.process(function(data) {
console.log("We are in the Process");
return postgresqlCopy.log(data) ;
})
.logErrorsToConsole()
.run()
.then(function() {
console.log("Done");
console.log(postgresqlClient)
});

};

Hi I started learning node.js three days ago and i have been trying to use datapumps. So far I am running node js with Express and the problem is that my process function never runs. I see this console.log("Ready To Pump"); in the logs so I am able to tell that the function is called. However it seems like the process hangs. (not sure). The process function is not called because console.log("We are in the Process"); part of the code does not show in the logs. Where have i gone wrong here. I also know my connection string works because i have onother function that uses the same query and logs the data to the console. I intend to transfer data from one postgre database to another. And certainly i cant do that if my process function is never called. I do not get any errors in the console either. I believe it hangs because console.log("Done"); does not show either

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions