[D]psycopg2有没有dictfetchall方法
今天用了一下,提示这个
<type 'exceptions.AttributeError'>: 'psycopg2._psycopg.cursor' object has no attribute 'dictfetchall'
args = ("'psycopg2._psycopg.cursor' object has no attribute 'dictfetchall'",)
message = "'psycopg2._psycopg.cursor' object has no attribute 'dictfetchall'"
在网上找了半天没有这方面的资料,请高手求救
---------------------
Double行动:
原帖分数:40
帖子加分:40
[解决办法]
- Python code
>>> cur.execute("SELECT * FROM test;")>>> cur.fetchall()[(1, 100, "abc'def"), (2, None, 'dada'), (3, 42, 'bar')]
[解决办法]
psycopg2.extras.DictCursor