Subject: the wire protocol

From: Catonano <[email-masked]>
Date: Sat, 19 Jan 2019 14:56:09 +0100

Hello,

there's this Python project using the so called wire protocol (as far as I
understand)

https://github.com/MagicStack/asyncpg

I'm caressing the idea to create a GNU Guile based project that does the
same thing

But I don't understand how they manage to get the connection to Postgresql,
their code is too complicated for me

Do they use the C library, libpq ?
Or do they manage the connection in their own code ?

Should I use libpq ?
Or should I manage the connection in my own code ?

In Guile I can manipulate sockets and the semantics are pretty close to the
ones of plain C

So even an example in C would be fine

I'd like to use a Unix socket

I hope this was the right mailing list for this question

If it's not, i apologize

Thanks in advance

---

From: Dmitry Igrishin <[email-masked]>
Date: Sat, 19 Jan 2019 18:16:31 +0300

сб, 19 янв. 2019 г. в 16:56, Catonano <[email-masked]>:
>
> Hello,
>
> there's this Python project using the so called wire protocol (as far as I understand)
>
> I'm caressing the idea to create a GNU Guile based project that does the same thing
>
> But I don't understand how they manage to get the connection to Postgresql, their code is too complicated for me
>
AFAIK, asyncpg implements the frontend/backend protocol described here:
https://www.postgresql.org/docs/current/protocol.html

> Should I use libpq ?
Not necessary.

> Or should I manage the connection in my own code ?
You can implement the protocol yourself in pure Guile. It's up to you to decide.

> In Guile I can manipulate sockets and the semantics are pretty close to the ones of plain C
>
To do it, first of all you need to familiarize with the
frontend/backend protocol mentioned above.

---

From: John DeSoi <[email-masked]>
Date: Mon, 21 Jan 2019 21:25:26 -0600

> On Jan 19, 2019, at 7:56 AM, Catonano <[email-masked]> wrote:
> 

Here is a Common Lisp library that uses sockets and the wire protocol to work with Postgres.

https://github.com/marijnh/Postmodern

Should be very close to what you want to do with Guile/Scheme.

John DeSoi, Ph.D.

---

From: Tony Locke <[email-masked]>
Date: Tue, 22 Jan 2019 08:06:41 +0000

Hi, pg8000 is a pure-python implementation of the wire protocol:

https://github.com/tlocke/pg8000

Might be of help.

-Tony

On Tue, 22 Jan 2019, 03:25 John DeSoi <[email-masked] wrote:

> > But I don't understand how they manage to get the connection to
> Postgresql, their code is too complicated for me
>
>