sorry for this message, my fault, I have to assign the GroupPermission instance inside the loop. Anyway I see that SA compile the INSERTs with serials as in:
INSERT INTO (id, cod_ruolo, cod_permesso ) VALUES (%(id)s, %(cod_ruolo)s, %(cod_permesso)s); I suppose it should be like this: INSERT INTO (cod_ruolo, cod_permesso ) VALUES (%(cod_ruolo)s, %(cod_permesso)s); because it is a postgresql responsability to assign value to id where serial is triggered. jo Jose Soares ha scritto: > Hi all, > > I would like to know how the postgresl serial type field works in sa? > SA doesn't increment the serial column if of my group_permission table: > > gp=GroupPermission() > for x in Permission.select(): > gp.cod_ruolo = 'sysadmin' > gp.cod_permesso = x.codice > session.save(gp) > print 'inserted: ', gp.cod_permesso, gp.cod_ruolo, gp.id <----_this > field doesn't change !!!_ > session.flush() > > > this is my table: > > table group_permission( > id serial primary key, > cod_ruolo text not null, > cod_permesso text not null > ) > > and this is my mapper: > > class GroupPermission(DomainObject): > pass > assign_mapper(context, GroupPermission, tbl['group_permission'],) > > jo > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---