Wonderful! Thanks a lot.
2013/4/2 Michael Bayer <mike...@zzzcomputing.com> > The insert() construct supports a call called returning() to emit whatever > RETURNING you want, but if you're using the ORM, then the insert() > construct is generated by your mappings. In this case, the ORM right now > favors being able to batch the INSERT statements together into an > executemany(), which doesn't support RETURNING, so as far as it using > RETURNING specifically for non primary-key defaults, the ORM isn't quite > set up for that yet. > > But, that doesn't mean you can't get those values automatically. Any > column that's not passed in and is marked as having a "server default" will > be queued up to fetch automatically as soon as you access it. The > FetchedValue construct is used as this marker when you're dealing with > something like a trigger: > > from sqlalchemy import FetchedValue > > class MyClass(Base): > # ... > > some_col = Column(Integer, server_default=FetchedValue()) > > > > http://docs.sqlalchemy.org/en/rel_0_8/core/schema.html#triggered-columns > > On Apr 1, 2013, at 5:26 PM, Alexey Vihorev <viho...@gmail.com> wrote: > > Hi!**** > I've got a server-side trigger function (before insert) - it changes some > fields of the inserted record, and I need this info back in my SA entity > object (akin to what SA does with ID's). SA uses RETURNING whenever it is > supported, maybe I can use it as well? Or am I limited to refreshing the > object manually via session.refresh()?**** > Thanks!**** > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email tosqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Алексей Вихорев -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.