
On Nov 26, 2007 5:03 PM, Niels Nes
On Mon, Nov 26, 2007 at 04:57:38PM -0700, m h wrote:
On Nov 26, 2007 3:38 PM, Niels Nes
wrote: On Mon, Nov 26, 2007 at 03:27:39PM -0700, m h wrote:
On Nov 26, 2007 3:15 PM, Niels Nes
wrote: On Mon, Nov 26, 2007 at 03:09:38PM -0700, m h wrote:
In MonetSQLdb BaseCursor.insert_id, the docstring says to use the lastrowid attribute.
When I try to access that lastrowid on the cursor instance I get an AttributeError.
Should I file a bug for this?
I think we should remove this remark. The server only sends rows-affected info on insert (and other update statements), ie its not easy to implement this feature (and this is afcourse mostly guessing what the python BaseCursor.insert_id/lastrowid is supposed to be do?).
Hmmm, most all the other python db cursors implement this. Here is Maybe I should have a look at those other cursors.
If the ids are changing often, it might be difficult....
the pep-249 info:
This read-only attribute provides the rowid of the last modified row (most databases return a rowid only when a single INSERT operation is performed). If the operation does not set a rowid or if the database does not support rowids, this attribute should be set to None. I guess then we should set it to None. Problem is that we would like to controll the rowid, ie for example when we insert the rowid may not be fixed (could change).
Are these changed often? yes on concurrent updates.
The semantics of .lastrowid are undefined in case the last executed statement modified more than one row, e.g. when using INSERT with .executemany().
Warning Message: "DB-API extension cursor.lastrowid used"
I realize this is "optional" but it seems like along the way support for this was either available or going to be available.
Currently its not and we went for a different solution for sequence numbers.
Him, if there is a way to get these sequence numbers that might help too. Can it be done via SQL? Yes.
create sequence seq as integer; select next value for seq;
Ok, (sorry if I'm being slow). So if a table has an autoincremented column, is that using sequences? Can I pull the next value out using SQL?