cunybpl / aiodal

async data access layer and related tools for sqlalchemy core
0 stars 0 forks source link

expose `stream` method on conn #27

Closed bsnacks000 closed 7 months ago

bsnacks000 commented 7 months ago

@tinnaing347 We use transaction.execute 9/10, but for certain client applications i'm using with anyio it is cleaner to stream data in move it through different producer consumer pipelines.

The connection object exposes the stream method for just that. In an app i'm working on I'm doing this:


stream = await transaction._conn.stream(stmt)
async for meter in stream:
    yield meter.meterid

It would be nice to just expose this via the proxy as well as its underlying signature in our TransactionManager object

bsnacks000 commented 7 months ago

At this point maybe its best to just expose _conn directly with simple @property and just start using that... the transaction manager is more a container anyway.

We can still use execute commit and rollback methods for convenience but exposing _conn directly will avoid us having to keep patching this object the more we expose

tinnaing347 commented 7 months ago

closed by #29