Re: [sqlalchemy] [Q] How to fix a circular dependency error?

2014-05-28 Thread Ladislav Lenart
On 27.5.2014 22:09, Michael Bayer wrote:
 some improvement was made to this formatting in 0.8 or so, though even now 
 it's not very easy to read directly.   
 
 Typically I try to look at the classes and relationships being mentioned in 
 the error and then inspect the mappings.  In this case it appears like the 
 cycle is just on the Partner class and the bazaar relationship alone.   
 Almost as though maybe you set a Partner.bazaar to be self, e.g. pointing 
 to itself.

Thank you for the explanation.

I suspected that the cycles attribute tells me everything I need to know.

You are also right about the following assertion:

# p is a Partner.
p.bazaar is p # True

However the operation in question does not modify this attribute at all. This
assertion is True before, during and after the operation. Does the error mean
that the code is infact trying to modify the bazaar attribute? OR the error is
triggered simply by the fact that a cycle exists no matter whether the
particular relationship is being updated or not?


Thank you in advance,

Ladislav Lenart


 On May 27, 2014, at 5:48 AM, Ladislav Lenart lenart...@volny.cz wrote:
 
 Hello.

 A specific DML request crashed with a CircularDependencyError on our test 
 env. I
 know that I should set post_update=True to the problematic relationship. The
 thing is I do not see the cycle and the error description is quite big. Could
 you please provide some guidance as to how to find the cycle from the 
 provided
 error description?

 The error has the following two attributes:
 * cycles = set([
  SaveUpdateState(Partner at 0x7f2be28113d0),
  ProcessState(
  ManyToOneDP(Partner.bazaar),
  Partner at 0x7f2be28113d0,
  delete=False
  )
  ])
 * all_edges = set([...]) # about a text page of data

 but I do not understand them.

 If it matters, I am still using SA v0.7.

 If you need more info, just ask.


 Thank you in advance,

 Ladislav Lenart

 -- 
 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.
 For more options, visit https://groups.google.com/d/optout.
 


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] [Q] How to fix a circular dependency error?

2014-05-28 Thread Michael Bayer

On May 28, 2014, at 6:42 AM, Ladislav Lenart lenart...@volny.cz wrote:

 On 27.5.2014 22:09, Michael Bayer wrote:
 some improvement was made to this formatting in 0.8 or so, though even now 
 it's not very easy to read directly.   
 
 Typically I try to look at the classes and relationships being mentioned in 
 the error and then inspect the mappings.  In this case it appears like the 
 cycle is just on the Partner class and the bazaar relationship alone.   
 Almost as though maybe you set a Partner.bazaar to be self, e.g. pointing 
 to itself.
 
 Thank you for the explanation.
 
 I suspected that the cycles attribute tells me everything I need to know.
 
 You are also right about the following assertion:
 
# p is a Partner.
p.bazaar is p # True
 
 However the operation in question does not modify this attribute at all. This
 assertion is True before, during and after the operation. Does the error mean
 that the code is infact trying to modify the bazaar attribute? OR the error is
 triggered simply by the fact that a cycle exists no matter whether the
 particular relationship is being updated or not?

Well if you say something like x.foo = bar, that triggers an attribute 
history event which will result in a UOW operation.   I'm not sure offhand if 
in the case of many-to-one how far it gets before it decides that no action is 
to be taken, or if it even does so, it might do an UPDATE unconditionally in 
some cases for m2o as we don't always emit a load for the previous value in 
the interests of performance in the majority of cases. 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] [Q] How to fix a circular dependency error?

2014-05-27 Thread Ladislav Lenart
Hello.

A specific DML request crashed with a CircularDependencyError on our test env. I
know that I should set post_update=True to the problematic relationship. The
thing is I do not see the cycle and the error description is quite big. Could
you please provide some guidance as to how to find the cycle from the provided
error description?

The error has the following two attributes:
* cycles = set([
  SaveUpdateState(Partner at 0x7f2be28113d0),
  ProcessState(
  ManyToOneDP(Partner.bazaar),
  Partner at 0x7f2be28113d0,
  delete=False
  )
  ])
* all_edges = set([...]) # about a text page of data

but I do not understand them.

If it matters, I am still using SA v0.7.

If you need more info, just ask.


Thank you in advance,

Ladislav Lenart

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] [Q] How to fix a circular dependency error?

2014-05-27 Thread Michael Bayer
some improvement was made to this formatting in 0.8 or so, though even now it's 
not very easy to read directly.   

Typically I try to look at the classes and relationships being mentioned in the 
error and then inspect the mappings.  In this case it appears like the cycle is 
just on the Partner class and the bazaar relationship alone.   Almost as 
though maybe you set a Partner.bazaar to be self, e.g. pointing to itself.






On May 27, 2014, at 5:48 AM, Ladislav Lenart lenart...@volny.cz wrote:

 Hello.
 
 A specific DML request crashed with a CircularDependencyError on our test 
 env. I
 know that I should set post_update=True to the problematic relationship. The
 thing is I do not see the cycle and the error description is quite big. Could
 you please provide some guidance as to how to find the cycle from the provided
 error description?
 
 The error has the following two attributes:
 * cycles = set([
  SaveUpdateState(Partner at 0x7f2be28113d0),
  ProcessState(
  ManyToOneDP(Partner.bazaar),
  Partner at 0x7f2be28113d0,
  delete=False
  )
  ])
 * all_edges = set([...]) # about a text page of data
 
 but I do not understand them.
 
 If it matters, I am still using SA v0.7.
 
 If you need more info, just ask.
 
 
 Thank you in advance,
 
 Ladislav Lenart
 
 -- 
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.