Re: [sqlalchemy] CircularDependencyError

2012-07-05 Thread Julien Cigar
On 07/04/2012 17:29, Julien Cigar wrote: On 07/04/2012 16:38, Michael Bayer wrote: On Jul 4, 2012, at 9:16 AM, Julien Cigar wrote: Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with

[sqlalchemy] CircularDependencyError

2012-07-04 Thread Julien Cigar
Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with Content and data is mapped with File. - File is a Content (joined table inheritance), so File has a foreign key to Content (through the

Re: [sqlalchemy] CircularDependencyError

2012-07-04 Thread Michael Bayer
On Jul 4, 2012, at 9:16 AM, Julien Cigar wrote: Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with Content and data is mapped with File. - File is a Content (joined table inheritance),

Re: [sqlalchemy] CircularDependencyError

2012-07-04 Thread Julien Cigar
On 07/04/2012 16:38, Michael Bayer wrote: On Jul 4, 2012, at 9:16 AM, Julien Cigar wrote: Hello, I have a rather strange CircularDependencyError with the following use-case: - I have a content table and a data table. - content is mapped with Content and data is mapped with File. - File is a

Re: [sqlalchemy] CircularDependencyError with relationships

2012-06-06 Thread Michael Bayer
you need to use the post_update option described at http://docs.sqlalchemy.org/en/rel_0_7/orm/relationships.html#rows-that-point-to-themselves-mutually-dependent-rows . On Jun 6, 2012, at 1:15 AM, Alex Grönholm wrote: I have trouble configuring two relationships from one class to another. The

Re: [sqlalchemy] CircularDependencyError with relationships

2012-06-06 Thread Alex Grönholm
06.06.2012 18:06, Michael Bayer kirjoitti: you need to use the post_update option described at http://docs.sqlalchemy.org/en/rel_0_7/orm/relationships.html#rows-that-point-to-themselves-mutually-dependent-rows . Thanks for the pointer. Problem solved :) On Jun 6, 2012, at 1:15 AM, Alex

[sqlalchemy] CircularDependencyError with relationships

2012-06-05 Thread Alex Grönholm
I have trouble configuring two relationships from one class to another. The following code should be fairly self-explanatory: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Company(Base):

Re: [sqlalchemy] CircularDependencyError, tried use_alter and inverse.

2012-02-18 Thread Jakob D.
Thanks Michael. As always I appreciate the support here. I'll try it out. It might actually be faster to redo these two tables in the model in plain SQLAlchemy than trying to figure out what's wrong with the current one. And, uhm, there is no difference between user_account and workers. I

Re: [sqlalchemy] CircularDependencyError, tried use_alter and inverse.

2012-02-18 Thread Michael Bayer
also in 0.8 I'm definitely going to make it so that primaryjoin thing isn't needed for this kind of case, foreign_keys=foo.id will be enough, see http://www.sqlalchemy.org/trac/ticket/2411 . On Feb 18, 2012, at 7:30 AM, Jakob D. wrote: Thanks Michael. As always I appreciate the support here.

Re: [sqlalchemy] CircularDependencyError, tried use_alter and inverse.

2012-02-18 Thread Jakob D.
Awesome =) Your example definitely works. But given my nature, I cannot leave things like this unanswered. So I took a few steps back and debugged some more. I removed a few fields from the model and added them one by one with elixir. When using reverse I actually had to specify the field on

[sqlalchemy] CircularDependencyError, why?

2011-09-07 Thread Erkan Özgür Yılmaz
The following gives CircularDependencyError where I think there isn't, but you know I don't know that much the internals of SQLAlchemy and maybe (and it is a strong possibility) I'm wrong. I've ripped of the classes causing the error (copy/paste will re-produce the error). from sqlalchemy import

Re: [sqlalchemy] CircularDependencyError, why?

2011-09-07 Thread Michael Bayer
On Sep 7, 2011, at 12:36 PM, Erkan Özgür Yılmaz wrote: The following gives CircularDependencyError where I think there isn't, but you know I don't know that much the internals of SQLAlchemy and maybe (and it is a strong possibility) I'm wrong. I've ripped of the classes causing the error

Re: [sqlalchemy] CircularDependencyError, why?

2011-09-07 Thread Erkan Özgür Yılmaz
Oh, that worked very well, thank you very much... E.Ozgur Yilmaz Lead Technical Director eoyilmaz.blogspot.com On Wed, Sep 7, 2011 at 8:04 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 7, 2011, at 12:36 PM, Erkan Özgür Yılmaz wrote: The following gives CircularDependencyError

[sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Alessandro Dentella
Hi again, sorry for flooding with email this week... I stumbled on the CircularDependencyError in some occasions with self referencing models. I do understand that it can be tricky to INSERT and DELETE but I'm just updating rows. I reduced my problem to the bare minimum. It works both on 0.5.8

Re: [sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Michael Bayer
need a full test case. Here's yours, runs fine: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import * from sqlalchemy.types import * from sqlalchemy.orm import * Base = declarative_base() e = create_engine('sqlite://', echo=True) Base.metadata.bind = e sess =

Re: [sqlalchemy] CircularDependencyError on 0.6 (works on 0.5.8)

2010-08-26 Thread Michael Bayer
of course you'll get a cycle if you do this, though: s1 = School(cod=S1, cod_riferimento=S1, cliente=False) d1 = School(cod=D1, cod_riferimento=S1, cliente=False) s1.sedi = [s1, d1] s1-s1 is not supported by self referential flushes, unless you put post_update=True on the relation() you have

[sqlalchemy] CircularDependencyError? (Wrong approach?)

2009-07-17 Thread AF
Hello, I have tables: Users Departments. (SQlite) Each User is assigned to one Department. (User.dept_id = Department.id ) Now, I want to make once User in each Dept the default user. As in: Department.default_user_id = User.id i.,e. Column('default_user_id', ForeignKey('users.id'))