[Python] MySQL connector doesn't take "USE db" in account

Discussão em 'Python' iniciado por Stack, Abril 7, 2025.

  1. Stack

    Stack Membro Participativo

    This works and returns the correct rows :

    cursor.execute('SELECT * FROM my_db.my_table')


    This doesn't, no rows are returned :

    cursor.execute('USE my_db; SELECT * FROM my_table;', multi=True)


    Running the query in GUI client works. What do I need to do for the mysqlconnector to behave in the same way as other tools ?

    Thanks.

    Continue reading...

Compartilhe esta Página