python-trio / triopg

PostgreSQL client for Trio based on asyncpg
Other
45 stars 8 forks source link

support pool.execute and friends #2

Closed ioistired closed 5 years ago

ioistired commented 5 years ago

One of the things I like about asyncpg is its wrappers for common Connection methods, for instance pool.execute:

async def execute(self, query, *args):
    async with self.acquire() as conn:
        return await conn.execute(query, *args)

It would be nice if we could have such methods on TrioPoolProxy as well. Is that a possibility? I'd PR this myself but I don't know how dynamic you want it to be. Do you want __getattr__ or 4 methods corresponding to fetch, fetchval, fetchrow, and execute?

Nice project, btw!

touilleMan commented 5 years ago

Hi @bmintz !

That seems like a good idea, your PR is welcome ;-)

Do you want __getattr__ or 4 methods corresponding to fetch, fetchval, fetchrow, and execute?

I think having 4 separate methods would be more readable