GQL icon indicating copy to clipboard operation
GQL copied to clipboard

Add pgwire PostgreSQL wire protocol interface to CLI

Open shah opened this issue 10 months ago • 9 comments

Hello @AmrDeveloper this is a fantastic library, thanks for putting it together!

We have a need to query our Git repos using SQL but with a PosgreSQL wire protocol (so we can use it with psql or any other PostgreSQL client application).

If you're willing, we'd love to see you add a server mode in GQL using Rust pgwire crate. pgwire does all the hard work of setting up a PostgreSQL wire compatible server and can accept SQL through the wire and pass it into your GQL crates/code.

Something like this:

gql server --repo=NAME,/path/to/repo --repo=NAME2,/path/to/repo2 --port 5432 
  • NAME, NAME2 would be schema names (case insensitive)
  • /path/to/repo would be the repo names

The above would launch a server listening on port 5432 that would make gql pretend to be a PostgreSQL server. Then, any SQL sent to the GQL server through any PostgreSQL client would be sent to GQL and responses returned using PostgreSQL wire protocol.

We would be able to use NAME and NAME2 schema names to combine multiple repos' output.

shah avatar Aug 18 '23 12:08 shah