well that's just a simple bug. this fixes:
diff --git a/lib/sqlalchemy/ext/declarative/api.py
b/lib/sqlalchemy/ext/declarative/api.py
index daf8bff..fe64ee7 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -396,7 +396,7 @@ class AbstractConcreteBase(ConcreteBase):
for scls in cls.__subclasses__():
sm = _mapper_or_none(scls)
- if sm.concrete and cls in scls.__bases__:
+ if sm and sm.concrete and cls in scls.__bases__:
sm._set_concrete_base(m)
if you want to post a bug report, or send a PR + test, whatever, that would
help...
for whatever reason this mapping is generating a crapload of warnings too.
Oh, I think its because ConcreteBase hardcodes that name "type" in the
"polymorphic join", if you change that col name to "type_foo" they go away.
the concrete base classes aren't very smooth (nor is concrete mapping
overall...)
On Sep 4, 2014, at 9:37 PM, Alex Grönholm <[email protected]> wrote:
> The following code fails with AttributeError: 'NoneType' object has no
> attribute 'concrete':
>
> from sqlalchemy import *
> from sqlalchemy.orm import *
> from sqlalchemy.ext.declarative import AbstractConcreteBase, declarative_base
>
> Base = declarative_base()
>
>
> class Document(Base, AbstractConcreteBase):
> type = Column(Unicode, nullable=False)
>
>
> class ContactDocument(Document):
> __abstract__ = True
>
> send_method = Column('sendmethod', Unicode)
>
>
> class ActualDocument(ContactDocument):
> __tablename__ = 'actual_documents'
> __mapper_args__ = {'concrete': True, 'polymorphic_identity': 'actual'}
>
> id = Column(Integer, primary_key=True)
>
> configure_mappers()
>
>
> Am I not supposed to have more than one level of abstract base classes? Or am
> I doing something else wrong?
> This is with SQLAlchemy 0.9.7.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.