Trouble supporting mixed case entities.
Benjamin Scherrey <[email protected]>
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Organization | Proteus Technologies, Inc. |
| Message-ID | <FAQROJDZ5Z21A6RXS71CBSPTRPNIF.3e88d336@BONZO> |
Many thanx to Gerhard for getting me a workaround for 2.2 OpenSSL so now I can use PyPgSQL!
To wit:
I am having trouble getting mixed case entities working. Postgres doesn't make this real
easy but the support is there and necessary for a project I am involved in that exports tables from
Access into Postgres using IDENTICAL names so that, once simple ODBC connections are made
to the back end, the existing Access front-end operates without modification. I have this part
working but now want to talk to the backend database via a python app (which will eventually
replace Access altogether) using PyPgSQL. Unfortunately this means I have to be able to refer to
table and field names using their double-quoted mixed-case names but the PyPgSQL code doesn't
seem to get along with it. Attached is a bit of sample code demonstrating the problem. Am I doing
something wrong or is this support not yet available?
many thanx,
Ben Scherrey
------------------------------
from pyPgSQL import PgSQL
if __name__ == '__main__':
src = PgSQL.connect( user="xxx", password="xxx", host="xxx", database="xxx" );
cur = src.cursor()
cstmt = ""
sstmt = ""
istmt = ""
# Change this to demonstrate problem with mixed case...
mixed = 0
if not mixed:
cstmt = r"""create table test ( fname varchar(20), lname varchar(20) )"""
istmt = r"""insert into test values ( 'Benjamin', 'Scherrey' )"""
sstmt = r"""select fname, lname from test"""
else:
cstmt = r"""create table "Test" ( "FName" varchar(20), "LName" varchar(20) )"""
istmt = r"""insert into "Test" values ( 'Benjamin', 'Scherrey' )"""
sstmt = r"""select "FName", "LName" from "Test" """
print cstmt
cur.execute( cstmt )
print istmt
cur.execute( istmt )
print sstmt
cur.execute( sstmt )
res = cur.fetchone()
print res["fname"]
print res["lname"]
cur.close()
src.close()
----------------------
-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/