
On Mon, Nov 26, 2007 at 05:30:49PM -0700, m h wrote:
On Nov 26, 2007 5:03 PM, Niels Nes
wrote: 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? auto_increment uses (anonymous) sequence numbers and its default value is set to 'next value for';
Niels
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl