Skip to content

convert Record object to json  #263

Description

@python-programmer

hi, i have a table like this:

Product
    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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions