#NEWLINE# def test_joined_inheritance_relation( self ) : #NEWLINE# #INDENT# app = flask . Flask ( __name__ ) #NEWLINE# db = fsa . SQLAlchemy ( base ) #NEWLINE# class Relation ( db . Model ) : #NEWLINE# #INDENT# id = db . Column ( db . Integer , primary_key = True ) #NEWLINE# base_id = db . Column ( db . Integer , db . ForeignKey ( 'base.id' ) ) #NEWLINE# name = db . Column ( db . Unicode ( 20 ) ) #NEWLINE# def __init__( self , name ) : #NEWLINE# #INDENT# self . name = name #NEWLINE# #UNINDENT# #UNINDENT# class Base ( db . Model ) : #NEWLINE# #INDENT# id = db . Column ( db . Integer , primary_key = True ) #NEWLINE# type = db . Column ( db . Unicode ( 20 ) ) #NEWLINE# __mapper_args__ = { #NEWLINE# #INDENT# 'polymorphic_on' : type , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# class SubBase ( Base ) : #NEWLINE# #INDENT# id = db . Column ( db . Integer , db . ForeignKey ( 'base.id' ) , primary_key = True ) #NEWLINE# __mapper_args__ = { #NEWLINE# #INDENT# 'polymorphic_identity' : 'sub' , #NEWLINE# #UNINDENT# } #NEWLINE# relations = db . relationship ( Relation ) #NEWLINE# #UNINDENT# db . create_all ( ) #NEWLINE# base = SubBase ( ) #NEWLINE# base . relations = [ Relation ( name = 'foo' ) ] #NEWLINE# db . session . add ( base ) #NEWLINE# db . session . commit ( ) #NEWLINE# base = base . query . one ( )