>
> SQLAlchemy lets you define separately DB code and python classes, but
> then you hve a real duplication.


Duplication is bad, but you're never forced to duplicate
anything.Pythonoffers all the tools you need to prevent duplication,
and SA offers whatever
you need to 'extract' metadata from tables in order to employ it. Take a
look at what ActiveMapper does.

I'll give you the example implementation of my system: I have defined my own
database through sqlalchemy.

Then I write the 'base' DB class for my system (which may vary depending on
the software I'm working on) and I use a custom metaclass I've created to
sort out all the object-related issues.

In the end, I get a full-working set of mapped classes without ever
duplicating a single line of code, unless I want to override a default
behaviour.

Of course, since SQLAlchemy can't know what are you doing if you use
'strange' naming (well, I guess this could be sorted out anyway by
harvesting globals(), but it's a slow approach), you'll have to trade naming
convention for 'singleness' - e.g., if have a table called 'place', its
corresponding object will be named 'Place'. And if, in another class, I have
a FK column called 'place_id' it will point (for sure!) at the
place.idcolumn, and that class will have a 'place' property.

Try it out, you'll find amazing how easy it's to write such code.

-- 
Alan Franzoni <[EMAIL PROTECTED]>
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E


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