GQL icon indicating copy to clipboard operation
GQL copied to clipboard

Add pgwire PostgreSQL wire protocol interface to CLI

Open shah opened this issue 2 years ago • 10 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

Hello @shah,

That's sound very cool and can be used in many projects, thanks you so much for suggestion, My first plan is to start improving the core of GQL and then working on supporting for clients but i think it will be good to start checking PosgreSQL wire protocol and maybe start this module side by side with the core.

Thank you, Amr Hesham

AmrDeveloper avatar Aug 18 '23 19:08 AmrDeveloper

GQL now has support for queering multi repositories :D

AmrDeveloper avatar Aug 20 '23 15:08 AmrDeveloper

That's great news, @AmrDeveloper I appreciate the quick acceptance!

shah avatar Aug 20 '23 18:08 shah

Hey @AmrDeveloper , your code works great with multiple repositories but we could use a column called repo in each table so that when you query multiple repos, we could use the repo column in our WHERE criteria.

Lilit0x avatar Aug 22 '23 20:08 Lilit0x

Hey @AmrDeveloper , your code works great with multiple repositories but we could use a column called repo in each table so that when you query multiple repos, we could use the repo column in our WHERE criteria.

Nice idea, i will implement it, Thanks for suggestion

AmrDeveloper avatar Aug 23 '23 17:08 AmrDeveloper

Hey @AmrDeveloper , your code works great with multiple repositories but we could use a column called repo in each table so that when you query multiple repos, we could use the repo column in our WHERE criteria.

Done, i implemented it now and will be released soon

AmrDeveloper avatar Aug 31 '23 19:08 AmrDeveloper

@AmrDeveloper , hi there. Has this been released? I tried this now with the package, it throws an error, but it works when I compiled the code.

Lilit0x avatar Sep 03 '23 18:09 Lilit0x

I will release it by the end of this week at most because i am working on big improvements in error handling, functions and performance

AmrDeveloper avatar Sep 03 '23 18:09 AmrDeveloper

@shah « 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). » Very neat idea ! With a postgreSQL wire, we could use some automatic SQL to graphQL tools like Hasura or plateformaticDB to provide a grapQL endpoint to query git repositories. It would be awesome !

ManUtopiK avatar Dec 14 '23 17:12 ManUtopiK

GitQL 0.22.0 now has more features from postgreSQL and we can work on the write soon

Thank you

AmrDeveloper avatar Jun 12 '24 17:06 AmrDeveloper