mvantellingen / psycopg2-ctypes

ctypes port of psycopg2 (see https://github.com/chtd/psycopg2cffi)
Other
56 stars 59 forks source link

cursor_factory is not honored in connection object #31

Open haizaar opened 10 years ago

haizaar commented 10 years ago

Consider the following:

import psycopg2ct as psycopg2
from psycopg2ct import compat
compat.register()
from psycopg2.extras import RealDictCursor

conn = psycopg2.connect("dbname=haizaar user=haizaar password=password host=localhost port=5432", cursor_factory=RealDictCursor)
cursor = conn.cursor()
cursor.execute("SELECT 1 AS a")
print cursor.fetchall()
print type(cursor)

It prints:

[(1,)]
<class 'psycopg2ct._impl.cursor.Cursor'>

However I would expect a dictionary.