hi, i have a table like this:
Id
Name
Price
And i get a product with this:
async with db.acquire() as connection:
product = await connection.fetchrow('''
SELECT id, name, price FROM product WHERE id = 1
''')
i want the below result:
{
'id': 1,
'name': 'asyncpg',
'price': 3
}
i want to get a json result from query, and Question is: How do it?
Cast it to a dict: product = dict(connection.fetchrow(...
Most helpful comment
Cast it to a
dict:product = dict(connection.fetchrow(...