On Sep 13, 2007, at 8:19 AM, che wrote:
> > Hi, > > Are there any database independent way to get the id from some > sequence - for databases that supports it? For postgres this can be > done by issueing "select nextval('name_of_the_sequence')" statement, > but for other databases like oracle, firebird it is maybe different. > It seems that there is no such protocol in SA source, but maybe i am > missing something obvious. > > I assume that to distinguish the databases that support sequences > metadata.bind.dialect.preexecute_sequences boolean can be used. am i > right? > > regards, > stefan > > p.s. currently i use the following code in postgres, but plan to use > something in other databases too: > sql = "select nextval('\"%s\"')" % name_of_the_sequence > oid = > db.connect().execute( sql.encode( db.dialect.encoding)).scalar() > print oid id = connection.execute(Sequence('my_sequence')) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---