Closed ruslantalpa closed 9 years ago
try like this: sql2graphql --db=dbname -u=username -p=password ...
or I think you can also use sql2graphql -i
Couple of things:
1) The aliases for --port
and --password
differ in case: Port has a capital P
while password has a lowercase p
.
2) Awkwardly enough, the postgres adapter didn't implement the hasDuplicateValues
method. We really need some tests here soon. I've added the method and published as 2.0.7, give that a try and see if it works out any better.
In interactive mode i get the same error, when specifying all the params, the error changed
Workstation:sqlgraphql ruslantalpa$ sql2graphql --db=dbname -u=username --password "" --port 5432 -b postgres -o ./app
Unhandled rejection error: select count("client_id") as "hasSameValues" from "projects" group by "client_id" having "hasSameValues" > $1 limit $2 - column "hasSameValues" does not exist
at Connection.parseE (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:105:22)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
Unhandled rejection error: select count("project_id") as "hasSameValues" from "tasks" group by "project_id" having "hasSameValues" > $1 limit $2 - column "hasSameValues" does not exist
at Connection.parseE (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:105:22)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
as you can see it read a bit of the structure of the db, to the connection params are correct
It seems in postgresql you can't use the alias inside the having clause, the error in the adapter for that hasSameValues
part is in line #L118.
I've tried to deal with it in postgres and it seems that the following works, however i can't find a way to make it work with the pg.having
query function since it wraps it in double quote like in the image.
select count("user_id") from "posts" group by "user_id" having count("user_id") > 1 limit 2
When i run by providing each paramerter manually i get
if i runin interactive mode, i get
i think i checked the user/pass and they seem to be correct Thanks.