svil wrote:
So i have unknown hierarchy of classes - be them documents, entities,
whatever u fancy. And they can point to each other in an unknown way.


so, you are looking to create an application that generates python
applications, basically.  if you want to use SA for that, you have to
completely master SA's relationships using simple, non-dynamically
generated examples first, so you can get a feel for what it does.  For
example, i notice in your example youre trying to send in "primaryjoin"
conditions which are already expressed in the Table objects - that
already is overly complex since SA can divine simple join conditions
from the tables themselves.  for each pattern you are trying to create
dynamically, create a non-dynamic version first, get that to work, then
figure out what about your dynamic thing is different from the simple
version.

also, instead of creating class objects in memory and
dynamically/conditionally attaching properties/methods/bells/whistles
to each one, consider using true code generation instead (i.e. create a
string, then call eval() / imp.load_source()) .  that way, all the
dynamic/conditional stuff can remain a complex beast, but generate very
simple and readable code that would be easy to debug (not to mention
perform much faster, since the complexity at generation time gets
discarded at runtime).  i hear theres a hot new template language
called "Mako" that does this kind of thing.*


* the author is also the author of said template language


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

Reply via email to