[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Eric Ongerth
Kevin, the default behavior is for relations to be represented by lists. If what you want is a tree structure where a directory can only have a single parent, you would use backref=backref(parentdir, uselist=False). Or at least that's how you'd do it in plain SA; i haven't used the declarative

[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Kevin Dangoor
On Sun, Feb 1, 2009 at 10:17 AM, Eric Ongerth ericonge...@gmail.com wrote: Kevin, the default behavior is for relations to be represented by lists. If what you want is a tree structure where a directory can only have a single parent, you would use backref=backref(parentdir, uselist=False).

[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 The syntax is basically same. Look at the standard documentation and examples for relation() and apply it to the decl layer. - -aj On 01.02.2009 16:17 Uhr, Eric Ongerth wrote: Kevin, the default behavior is for relations to be represented by

[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Nebur
Kevin, did you already look at http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships ? By default, as the doc says, one-to-many is assumed. You want the backref (parentdir) to be a scalar, so you probably have to specify remote_side. Ruben

[sqlalchemy] Re: parent/child relationship: what am I doing wrong?

2009-02-01 Thread Kevin Dangoor
Thanks for that link! It was late last night when I was looking at this and, embarrassingly enough, I hadn't gone to that particular section of the doc. Kevin On Sun, Feb 1, 2009 at 10:22 AM, Nebur t...@reifenberg.de wrote: Kevin, did you already look at