-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is covered by the decl. layer documentation (including examples):
 - either use strings for the parameter
 or
 - you write outside the class scope
   User.sons = relation(....)

- -aj

On 16.02.2009 9:57 Uhr, 一首诗 wrote:
> I tried to write :
> 
> #------------------------------------------------------------------------------------
> class User(Base):
>     __tablename__ = 'users'
> 
>     id = Column(Integer, primary_key=True)
>     name = Column(String)
>     fullname = Column(String)
>     password = Column(String)
>     sons = relation(User, order_by=User.id, backref="parent")
> #------------------------------------------------------------------------------------
> 
> But the as 'User' is not defined at the line "... relation ... " is
> processed, the code above doesn't work.
> 
> So, does sqlalchemy support self 2 self relationship ?
> If the answer is "YES", how to do it?
> 

- -- 
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: i...@zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
- ------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkmZLQkACgkQCJIWIbr9KYxMRgCeODPG7oL4uj/HmmGinx9E1q3r
xJsAoLq11zIMhRsSqLZfm2RwlLqWB6yA
=ND9E
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:i...@zopyx.com
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

Reply via email to