[Sqlalchemy-tickets] Issue #3462: new single inh polymorphic identity logic in query should skip if
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2015-06-19 16:04:05
|
New issue 3462: new single inh polymorphic identity logic in query should skip if there's no actual identity https://bitbucket.org/zzzeek/sqlalchemy/issue/3462/new-single-inh-polymorphic-identity-logic Mike Bayer: e.g. ``` #!python from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Client(Base): __tablename__ = 'client' id = Column(Integer, primary_key=True) class SubClient(Client): pass class Thing(Base): __tablename__ = 'thing' id = Column(Integer, primary_key=True) cid = Column(ForeignKey('client.id')) s = Session() print s.query(Thing).join(SubClient, Thing.cid == SubClient.id) ``` produces: ``` #!sql SELECT thing.id AS thing_id, thing.cid AS thing_cid FROM thing JOIN client ON thing.cid = client.id AND NULL ``` |