diff options
Diffstat (limited to 'wqflask/utility/monads.py')
-rw-r--r-- | wqflask/utility/monads.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/wqflask/utility/monads.py b/wqflask/utility/monads.py index 21d04f36..26225eaa 100644 --- a/wqflask/utility/monads.py +++ b/wqflask/utility/monads.py @@ -115,6 +115,13 @@ class MonadicDictCursor(DictCursor): Monadic version of MySQLdb.cursors.DictCursor that returns a MonadicDict instead of the built-in dictionary. + + Execute a SQL query and retrieve results as MonadicDict + objects. Each row object in the following code is a MonadicDict. + >>> with conn.cursor(MonadicDictCursor) as cursor: + ... cursor.execute("SELECT foo FROM bar") + ... for row in cursor.fetchall(): + ... print(row) """ def fetchone(self): return MonadicDict(super().fetchone()) |