> The mapper expects a > class, but I can't define Content before ContentCollection and > ContentCollection before Content... >
whhy? SA-wise u have no problem: class X: pass class Y: pass mapper(X, ... y=relation(Y,...) ... ) mapper(Y, ... x=relation(X,...) ... ) The problem might be only in your own classes (X,Y). some theory/experience: This is a problem in ordered declarative languages, where order of appearance is important and which usualy have a sort of 'Forward declarations' for that matter. Python itself is a sort of such language without Forward decl, but usualy declaration and usage are in different lifetimes/scopes (e.g. class declaration vs class-method-runtime are different scopes/lifetimes), so u never hit it. Well, If u try using it pure declaratively, in same lifetime/scope - then u have trouble. For python there 2 ways to workaround: - at the reference end/ refereee: use surrogates/aliases instead of real references, then at certain 'end-of-declarations' time go replace all reference to surogate with reference to real thing. May need some rework e.g. not to expect real things before runtime. i'm using this approach in my sa-wrapping pure declarative framework. - at the owner end/ referer: declare the class empty; then somewhat later put the contents in (the contents may be prepared early, but not in the class). This is not straight forward, uses pseudo __bases__ that are replaced with something full later. i'm using this in a 2-tier protocol generator, miming C/CORBA scope semantics in equivalent python classes. If u're interested i can give u some sources doing either one. but i am 95% sure u don't need them - they are of use only for large frameworks where u cant choose which is when nor where. ciao svil --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---