[Python] How to initialize dict cursor in mysql.connector

Discussão em 'Python' iniciado por Stack, Março 3, 2025.

  1. Stack

    Stack Membro Participativo

    I used to be able to do something like:

    self.conn = MySQLdb.connect(user=...)
    self.dict_cursor = self.conn.cursor(MySQLdb.cursors.DictCursor)


    However, now it's not so simple with the new mysql-python connector. How would I do a similar pattern to initialize a dict cursor?

    self.conn = mysql.connector.connect(user=...)
    self.dict_cursor = self.conn ???

    Continue reading...

Compartilhe esta Página