On 26 Ott, 13:41, Mike Conley <mconl...@gmail.com> wrote:
> > I see, but I need a proper shallow copy instead, with every
> > attribute.. Is there no way? :/
>
> > What is missed?
>
> I am not sure what you mean by shallow copy. The fact that there are
> relations to be lazy loaded is present in the new object when instantiated.
> Obviously the objects pointed to by the relation are not copied, but I would
> call that a deep copy, and to do that you would need to iterate over them
> also.

I'm sorry, by "shallow copy" I mean that only the parent object should
be a copy (=different instance), while the related ones should be kept
as-is...

For example, given an object A that references B and C, a shallow copy
of A would be made up of a copy of A that references the original B
and C (not copies of B or C).

So, in Python a non-automatic shallow copy would be:

A = Some_class()
A.refs = [B, C]
Acopy = Some_class()
Acopy.refs = A.refs

My problem is that if A.refs has to be lazy loaded, when I try to copy
it over to Acopy, it triggers the query, and I'd like to avoid that,
while still copying the fact that Acopy.refs should be the same as
A.refs.

Thanks for your attention again!
--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to