This project is archived and is in readonly mode.

#211 ✓invalid

connect(cursor_factory=NamedTupleCursor) seems broken

Reported by jagt | April 27th, 2014 @ 01:56 AM

Greetings. As the title suggested, NamedTupleCursor doesn't work well when passing into connect(). Here's a test case:

import psycopg2
from psycopg2.extras import NamedTupleCursor

conn = psycopg2.connect("dbname=collective user=collective", cursor_factory=NamedTupleCursor)
cur = conn.cursor()
cur.execute("SELECT 'ok';")

I'm on Python3.4, psycopg2==2.5.2. Thanks in advance!

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo April 30th, 2014 @ 04:34 PM

    • State changed from “new” to “invalid”

    The error is pretty obvious:

    ValueError: Type names and field names can only contain alphanumeric characters and underscores: '?column?'

    if you want to use a named tuple why don't you give a damn name to your fields?

    cur.execute("SELECT 'ok' as blah;")

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="">the new tracker</a>.
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins