On May 6, 2013, at 6:30 AM, sajuptpm <sajup...@gmail.com> wrote:

> Hi,
> 
> * I have a table "A" with __mapper_args__ = {'polymorphic_on': type}
> * Table "B" "C" and "D" are inherited from "A" with polymorphic_identity 
> "type_b", "type_c" and  "type_d" respectively
> 
> I want to change the value of "polymorphic_identity" for an instance of class 
> "B",  how do it ??
> 
> I tried like this, but not working
> instance_of_B.type = "type_c"
> DBSession.add(instance_of_B)
> transaction.commit();
> 
> 
> I want to change the class of instance_of_B to "C" dynamically.

set it like this:

instance_of_B.__class__ = C_Class
instance_of_B.type = "type_c"

session.flush()


> 
> 
> 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 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.


Reply via email to