Skip to content

Conversation

@sinisaos
Copy link
Member

@sinisaos sinisaos commented Dec 3, 2025

Related to this discussion. Any help and feedback is welcome.

@dantownsend
Copy link
Member

I've got the tests running locally now. It's impressive that they're running.

I've tried the playground too, and it seems to work well. I do get things like this printed out in the console:

aiomysql/cursors.py:239: Warning: Unknown table 'piccolo_playground.band'

Do you see them too?

@sinisaos
Copy link
Member Author

I've got the tests running locally now. It's impressive that they're running.

I've tried the playground too, and it seems to work well. I do get things like this printed out in the console:

aiomysql/cursors.py:239: Warning: Unknown table 'piccolo_playground.band'

Do you see them too?

Yes. This is just a warning and is harmless because I am using cursor.description to get the column name. I use something like this

async with self.pool.acquire() as connection:
    async with connection.cursor() as cursor:
        await cursor.execute(query, args)
        rows = await cursor.fetchall()
        columns = (
            [desc[0] for desc in cursor.description] # use only ticket from ticket$concert$concert$band_1 and it works
            if cursor.description
            else []
        )
        await connection.autocommit(True)
        return [dict(zip(columns, row)) for row in rows]

and it works for related columns like this ticket$concert$concert$band_1

Another option would be to use aiomysql.DictCursor like this

async with self.pool.acquire() as connection:
    async with connection.cursor(aiomysql.DictCursor) as cursor:
        await cursor.execute(query, args)
        rows = await cursor.fetchall()
        await connection.autocommit(True)
        return rows

but it doesn't work for related columns like this ticket$concert$concert$band 1. ValueError like this ValueError: No matching column found with name == ticket$concert$concert$band_1 is raised. I think we should leave this as is, maybe we can come up with something better later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants