[PEAK] SQL Object-relational Mapper

Tiago Cogumbreiro cogumbreiro at gmail.com
Thu May 19 19:10:44 EDT 2005


Hello there,
We've (me and Erik) talked earlier in IRC but I want to reinforce my
thoughts about it. It's a very usefull module and I hope I can use it
in my next Peak related project so that I can provide some input to
it. Currently I am using a concept simillar to that but implemented in
a fairly different way. I have not had the time to look at this
implementation deeply but I hope I can share the work I did with my
module in this one.

On 5/19/05, Erik Rose <psucorp at grinchcentral.com> wrote:
> On May 2, 2005, at 5:20 PM, Ulrich Eck wrote:
> > Am Montag, den 02.05.2005, 12:20 -0700 schrieb John Landahl:
> >> Ulrich, if you're listening, any objections to me putting an updated
> >> version of your code on PeakPlace?
> >
> > go ahead, if what's in my cvs at:
> > http://cvs.net-labs.de/cgi-bin/viewcvs.cgi/libs/nll/src/nll/database/
> > sqldm/datamanager.py isn't working or not uptodate. i also have no
> > objection against taking it out of nll and package it with some docs
> > or the like.
> 
> I've posted a heavily revised version of Ulrich's code at
> http://peak.telecommunity.com/DevCenter/SqlDm, and I'd love to hear
> comments about the API changes I've wrought. (There's a big, fat
> docstring at the top. If it's unclear, please complain. Regardless, I
> plan to have a public svn and Trac set up soon so you can read the
> detailed changelogs, commit, file tickets, and have a good time.)
> 
> Major changes:
>   * Updated for compatibility with the latest PEAK
>   * Added compatibility with SQL Server and similar DB's which don't
> support sequences
>   * Renamed several API-exposed variables for brevity and maybe clarity
> (feedback, please)
>   * Added supports for fields which should be read by the DM but not
> written (like DB-maintained timestamps and sequences)
>   * Made it work with Python DB API modules that use the pyformat
> paramstyle (like psycopg).
> 
> If you want to use the autoIncrementedField feature, you'll need to
> stick a getLastAutoincrementSql() method in your PEAK DB adaptor. It
> looks and behaves like this, which is from my MS SQL Server adapter
> (which I'll publish soon):
> 
> def getLastAutoincrementSql(self):
>         """Return the SQL that yields the last value the DB inserted in an
> auto_increment or identity-style column. To avoid race conditions,
> consider only inserts made by this connection (most DB's handle this
> for you).
> 
>         In DB's (like Postgres) which don't have a function like this and
> which do support sequences, you should probably use getSequenceValue()
> instead, which is more flexible anyway.
>         """
>         return 'SELECT @@IDENTITY'
> 
> I probably won't be able to make earthshattering API changes until I
> get the current release of my (other) project out the door, but I will
> gratefully collect them!
> 
> Cheers,
> Erik
> 
> _______________________________________________
> PEAK mailing list
> PEAK at eby-sarna.com
> http://www.eby-sarna.com/mailman/listinfo/peak
> 


-- 
Tiago Cogumbreiro <cogumbreiro at users.sf.net>

http://s1x.homelinux.net/



More information about the PEAK mailing list