Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: DB

Newbie DBAptapter makie want ...

 

 

Zope db RSS feed   Index | Next | Previous | View Threaded


gerhard.haering at gmx

Sep 23, 2001, 10:21 PM

Post #1 of 4 (511 views)
Permalink
Newbie DBAptapter makie want ...

Hi!

Please forgive the silly subject ;-)

I'd like to develop a new database adapter for a Python database module
(pyPgSQL). Being quite a newbie at Zope doesn't make it easier, but I like
challenges :-)

I think that there are a few people on this list who have experience in writing
such an adapter. I'd appreciate if you would share some of them with me.

My first problem is that I haven't found any specification for such a beast. In
Java, I would simply implement a well documented interface. Am I right that no
such thing exists? Or have I overlooked it? Is grabbing an existing DA and
hacking it until it fits really the only possibility?

My second question: How do I debug such a beast? In my prototype, I build a
connection, then a ZSQLMethod that uses the connection, then I "test" the
connection, until all errors in my DA modules are gone. Fine. Now I get a very
obscure error in ZODB. But only when the first column is an integer.

In case this rings any bells: an UnpickleableError is raised. When I try to
find out which type cannot be pickled, dont't laugh!, I get: "Could not pickle:
UnpickleableError"

Is there a way to build an automated testsuite for a database adapter?

Thanks,

Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))


gerhard.haering at gmx

Sep 23, 2001, 10:34 PM

Post #2 of 4 (486 views)
Permalink
Re: Newbie DBAptapter makie want ... [In reply to]

On Mon, Sep 24, 2001 at 07:21:00AM +0200, Gerhard Häring wrote:
> [...] Now I get a very obscure error in ZODB. But only when the first column
> is an integer.
>
> In case this rings any bells: an UnpickleableError is raised. When I try to
> find out which type cannot be pickled, dont't laugh!, I get: "Could not
> pickle: UnpickleableError"

Just to clarify where I got this from. This is the code to test for what could
not be pickled:

In ZODB/Connection.py; class Connection; method commit, i replaced dump(state)
with:

# HACK
try:
dump(state)
except UnpickleableError, args:
f = open("/tmp/gh", "w")
f.write("Could not pickle: " + args.__class__.__name__)
f.close()
raise UnpickleableError, args
# /HACK

Hmm. I guess there must be a better way to debug ZOPE than this hack. Am I
missing something obvious or does it really try to pickle the
"UnpickleableError" exception?

Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))


fog at mixadlive

Sep 24, 2001, 1:22 AM

Post #3 of 4 (473 views)
Permalink
Re: Newbie DBAptapter makie want ... [In reply to]

On Mon, 2001-09-24 at 07:21, Gerhard Häring wrote:

> I'd like to develop a new database adapter for a Python database module
> (pyPgSQL). Being quite a newbie at Zope doesn't make it easier, but I like
> challenges :-)
>
> I think that there are a few people on this list who have experience in writing
> such an adapter. I'd appreciate if you would share some of them with me.

download psycopg and look at the ZPsycopgDA adapter. psycopg is
DBAPI-2.0 compliant, if pyPgSQL is compliant too, you'll only need some
little changes :)

ciao,
federico

p.s. http://initd.org/Software/psycopg/

--
Federico Di Gregorio
MIXAD LIVE Chief of Research & Technology fog [at] mixadlive
Debian GNU/Linux Developer & Italian Press Contact fog [at] debian
99.99999999999999999999% still isn't 100% but sometimes suffice. -- Me


gerhard.haering at gmx

Sep 24, 2001, 4:58 AM

Post #4 of 4 (487 views)
Permalink
Re: Newbie DBAptapter makie want ... [In reply to]

On Mon, Sep 24, 2001 at 10:22:15AM +0200, Federico Di Gregorio wrote:
> On Mon, 2001-09-24 at 07:21, Gerhard Häring wrote:
>
> > I'd like to develop a new database adapter for a Python database module
> > (pyPgSQL). Being quite a newbie at Zope doesn't make it easier, but I like
> > challenges :-)
> >
> > I think that there are a few people on this list who have experience in
> > writing such an adapter. I'd appreciate if you would share some of them
> > with me.
>
> download psycopg and look at the ZPsycopgDA adapter. psycopg is DBAPI-2.0
> compliant, if pyPgSQL is compliant too, you'll only need some little changes
> :)

Heh, guess what I did for my prototype :-)

Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

Zope db RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.