- attached mapper.diff
single table inheritance and primary key problem
With such scheme:
exportables = sa.Table(
't_exportable', meta,
sa.Column('object_id', OracleNumber, primary_key=True),
sa.Column('type', sa.String(20), primary_key=True),
sa.Column('state', sa.Integer),
)
and class hierarchy:
class Exportable(Base):
__table__ = exportables
__mapper_args__ = {
'polymorphic_on': exportables.c.type,
}
class ExportableTEST(Exportable):
__mapper_args__ = {
'polymorphic_identity': 'TEST',
}
When updating attributes of ExportableTEST object error "''ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1''" acquired. Because of primary key is not passed to update query:
''INFO:sqlalchemy.engine.base.Engine.0x...fdac:UPDATE t_exportable SET state=:state WHERE t_exportable.opcode = :t_exportable_opcode AND t_exportable.object_id = :t_exportable_object_id AND t_exportable.type = :t_exportable_type
INFO:sqlalchemy.engine.base.Engine.0x...fdac:{'t_exportable_object_id': Decimal("8756"), 'state': 3, 't_exportable_type': None, 't_exportable_opcode': 18}''
Comments (5)
-
Account Deleted -
repo owner can you please attach a full test case to this one and ensure its against trunk ? this test doesn't fully show what you're doing. thanks.
-
repo owner - changed milestone to 0.5.6
-
repo owner - changed status to duplicate
dupe of
#1300, which is reopened. -
repo owner - removed milestone
Removing milestone: 0.5.6 (automated comment)
- Log in to comment
this patch helps