Re: [SQLObject] request for elaboration on code
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Luke O. <lu...@me...> - 2004-02-16 08:20:38
|
> Firstly what is 'id' representing? It is an optional to give the ID parameter when creating an object, this is the value to use if not expected to be auto-generated. > Secondly, the SQL in the latter case is NOT going to work if the tables have > been created without oid's. Yes, I suppose this could be mentioned in the requirements (although I've never seen a table without oids in my work). Basically, unlike some of the other DBs, Postgres provides no cursor-level way to retrieve auto-generated IDs. There are alternatives to doing it by oid, such as pre-selecting the nextval on the sequence, but using oids seemed to be the least intrusive to SQLObject's design. If you have a need for an alternative way, there will have to be a subclass of PostgresConnection, most likely that takes some style object or attributes for determining how to construct sequence names. (The default for SERIAL columns is tableName_idName_seq I believe, a style that would be easy to calculate in the _queryInsertID method.) Cool? - Luke |