Deferred columns cause flush to fail when specified through add_property
Issue #831
resolved
If you specify a deferred column on a mapper by using add_property
rather than using the mapper
constructor, the resulting class cannot be flushed. Here is a failing test case:
from sqlalchemy import *
from sqlalchemy.orm import *
metadata = MetaData()
metadata.bind = 'sqlite:///'
metadata.bind.echo = True
org_table = Table('org', metadata,
Column('id', Integer, primary_key=True),
Column('name', Unicode),
Column('stuff', Unicode)
)
class Org(object):
pass
m = mapper(Org, org_table)
m.add_property('stuff', deferred(org_table.c.stuff))
Session = sessionmaker(bind=metadata.bind)
session = Session()
metadata.create_all()
org = Org(name='Dude')
session.save(org)
session.flush()
This was reported via an Elixir ticket here: http://elixir.ematia.de/trac/ticket/17
Comments (3)
-
Account Deleted -
repo owner - changed status to resolved
I refactored somewhat aggressively in b4e3ba70ce453773bb7d37fa13f59a56ca3c8ae5. all tests pass on my end, should be good on yours.
-
repo owner - removed milestone
Removing milestone: 0.4.xx (automated comment)
- Log in to comment
(original author: ged) By the way, this worked fined in 0.3, this fails in the same way for synonym properties and it produces the following traceback (also on Elixir ticket):