Oliver Beattie wrote: > Sorry to bug… I imagine there is no way of doing this, but would be > good to know for sure. If not, this would be really useful > functionality. For instance, I might want to populate one column based > on the contents of one of more other columns. > > On 12 Jan, 11:21, Oliver Beattie <oli...@obeattie.com> wrote: >> Hi there, >> >> I feel like I'm perhaps missing something, but I wonder if there's any >> way to access the object being updated inside a ColumnDefault? More >> specifically, if I have a… let's call it DBObject (using declarative) >> which has a callable as its default, is there any way to access that >> DBObject instance inside the default function? I see it gets passed an >> ExecutionContext instance, but I don't see a way to get the object >> from there :\ >> >> If there's a way to do this, it would help me a lot :)
The executioncontext has all the parameters for the whole statement, you can use those. But the ORM object is not available at that level. You might want to use MapperExtension.before_insert() if you need ORM-level awareness. >> >> Thanks, >> Oliver > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.