#30 fetchonemap not working


The following example does not work for me:

import kinterbasdb

dbcon = kinterbasdb.connect(
host = 'hostname',
database = 'filename',
user = 'username',
password = 'password',

dbcur = dbcon.cursor()

dbcur.execute('select "colname" from "tablename"')
dbresult = dbcur.fetchonemap()

print dbresult
print dbresult['colname']

dbresult is printed properly, but the output of the second
print is None
Version 3.1_pre3 raises a KeyError:
Result set has no column named "COLNAME". The column
name must be one of: (colname)

The database server is a firebird server (WI-V6.2.794
Firebird 1.0), the dialect of the database is 3.


  • David S. Rushby

    David S. Rushby - 2003-04-13
    • assigned_to: nobody --> woodsplitter
    • status: open --> open-fixed
  • David S. Rushby

    David S. Rushby - 2003-04-13

    Logged In: YES

    Here's the problem:

    The database engine requires that entities whose names were
    quoted upon creation always be referenced using the same
    case. However, the engine normalizes all non-quoted names
    to upper case. Examples:
    create table test ("cOL1" int)

    /* No error; the quoting causes the case of cOL1 to be
    preserved: */
    select "cOL1" from test

    /* Error; cOL1 is not quoted, so it's normalized to COL1,
    which is not equal to the original name cOL1: */
    select cOL1 from test

    Up to and including version 3.1_pre3, the objects returned
    by kinterbasdb's Cursor.fetch*map methods always normalized
    the case of incoming field names to upper case, as the
    database engine does when the field name is not quoted.

    tries to find a field in the result set named COL1, as in
    statement SQL3 above. As you pointed out, there was no way
    to force "quoted behavior" on field names.

    The latest CVS version of __init__.py allows you to "quote"
    field names when looking them up from fetch*map result set
    objects. For example:
    now behaves like statement SQL2 above (preserving the case
    of the field name).

    So the bug is now fixed in CVS.

    As you can see, quoting entity names is inconvenient unless
    you've a specific reason to do it.

  • David S. Rushby

    David S. Rushby - 2003-05-20
    • status: open-fixed --> closed-fixed
  • David S. Rushby

    David S. Rushby - 2003-05-20

    Logged In: YES

    This fix is in 3.1_pre4.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks