MySQL python DBAPI. How to get a dictionary instead of a tuple?
-
11-10-2019 - |
Question
Python DB API returns a list of tuples when fetchall is invoked on an executed cursor. If you work with the _mysql module, fetch_row has a how
parameter that allows to get a dictionary instead of a tuple. How can I achieve the same with the cursor ?
Solution
Quoting from the documentation
DictCursor
Like Cursor except it returns rows as dictionaries.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow