On 17/01/2017 18:38, mike bayer wrote:


On 01/17/2017 01:05 PM, Chris Withers wrote:
Potentially related issue, given:

class TheTable(Base):
    __tablename__ = 'stuff'
    __mapper_args__ = dict(
        polymorphic_on='type',
        polymorphic_identity='base',
    )
    type = Column(String)
    col = Column(String)

class Model1(TheTable):
    __mapper_args = dict(
        polymorphic_identity='model1',
    )

class Model2(TheTable):
    __mapper_args = dict(
        polymorphic_identity='model2',
    )

session.add(Model1(col='a'))
session.add(Model2(col='b'))
session.flush()

I'd now expect:

self.session.query(Model1)

...to turn the Model1 instance, but in my tests it returns nothing.

you misspelled "__mapper_args__"

D'oh, thanks.

Chris

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to