[PEAK] How do I configure access into Postgresql?

Victor Ng vng1 at mac.com
Sun Nov 9 04:14:30 EST 2003


Hi all,

I've taken the sample code from the wiki on PeakDatabaseApplications  
and I'm trying to get basic access into my Postgres database using the  
psycopg database adapter.

Two questions here:

How do I go about setting up a peak.ini file to use pyscopg (or  
pyPgSQL) instead of pgdb?  I'd like to use pyscopg because I seem to  
get much better performance out of that particular database driver.   
That and I also can't seem to get pgdb (as of Postgres 7.3.3) to build  
properly under OSX.

My code is straight from the wiki - the only modification I've made is  
to peak.storage.SQL where I've changed PGSQLConnection to use psycopg  
instead of pgdb.

Any ideas what's going on here?

I'm also a little bit fuzzy on how to use the DataManager's in PEAK -  
is there a working example somewhere?

Here's the stack trace that's thrown when I try to use psycopg to bind  
into Postgresql:

   File "peakdb.py", line 23, in ?
     app.run()
   File "peakdb.py", line 17, in run
     self.worker.doWork()
   File "peakdb.py", line 8, in doWork
     for row in self.db('select id, large_unit_name from currency'):
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/peak/storage/SQL.py", line 179, in __iter__
     typeMap = self.typeMap
   File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112,  
in _once.BaseDescriptor.__get__
   File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100,  
in _once.__get__
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/peak/binding/components.py", line 446, in computeValue
     return self.targetName.findComponent(obj, self.default)
   File  
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/peak/binding/components.py", line 319, in findComponent
     resolvedObj = ob
peak.exceptions.NameNotFound:   
[resolvedName=ComponentName([]),remainingName=ComponentName(['typeMap']) 
,resolvedObj=<peak.storage.SQL.PGSQLConnection object at 0x3faa50>]




More information about the PEAK mailing list