On Dec 3, 2008, at 1:26 PM, Guillaume wrote:

>
> Hello,
>
> is there a way with the ORM layer to have abstract base class like in
> django ?
> <http://docs.djangoproject.com/en/dev/topics/db/models/#abstract-base-
> classes>

sure, just pass along cls=MyBaseClass along to declarative_base().    
You can also make your own metaclass if you wanted, and pass it in as  
metaclass=MyMetaClass, or you can use the individual components within  
declarative_base explicitly if you wanted to roll it yourself.   This  
is all in the docstrings for declarative.

> Another somehow related question is there any plan for declarative
> base to support inheritance ala django ?

declarative supports all three of SQLA's table inheritance forms  
fully.    It pretty much happens automatically when you make a  
subclass, and you just need to pass along polymorphic_on/ 
polymorphic_identity into __mapper_args__.   If Django supported some  
kind of inheritance scenario that we don't I'd be very interested to  
see that :) .




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