In order to provide for alternative ways of accessing fields, or adding custom functionality, make it possible to specify a Record factory on a connection.
See #38 and #13 for related discussions.
@elprans nice. Incorporating this issue is invaluable.
This is necessary not only for dot accessor wanted in #38 and #13. I don't know any way to elegantly convert json, uuid objects from postgres to python objects except thru monkey patching.
What I am doing now is ugly IMO.
[
{
**record,
'task_id': str(record['task_id']), # uuid to str
'rates': json.loads(t['rates']), # jsonb to dict
}
for record in fetched_records
]
The ability to use customized Record is a must, dude. It's been more than 2 years
The ability to use customized Record is a must, dude. It's been more than 2 years
Dear "dude", you're welcome to make a PR. Please make sure that the performance of asyncpg code that uses the builtin asyncpg.Record won't be impacted by it.
Most helpful comment
Dear "dude", you're welcome to make a PR. Please make sure that the performance of asyncpg code that uses the builtin
asyncpg.Recordwon't be impacted by it.