Hi,

 

Assuming you have a one-to-many type of relationship, say one user has
several roles.

 

The underlying "role" table would hold one foreign key referring to the
user table.

 

A properly written SA ORM allows you to write:

 

user1.roles

 

Now assuming you have just created a new user (user2), what is the
easiest way if you want to "copy" roles from user1?

 

I tried:

 

user2.roles = user1.roles

 

But then it deletes the roles from user1. Same if I go through a
copy.copy():

 

import copy

user2.roles = copy.copy(user1.roles)

 

Does anyone have an idea? I would like to avoid going through a loop and
creating the roles one by one.

 

Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to