Much like FormAlchemy, I am trying to update my model from a post in a 
generic manner. I'd like to find out if an Attribute(InstrumentedAttribute) 
or its associated ColumnProperty is read-only. (please excuse ridiculous 
example)


class Foo(Base):    
    id = Column(Integer, primary_key=True)
    name = Column(String)    
    title = column_property(
        select([func.UPPER(name)]).\
        where(id==id)
    )

Although setting 'title' will not cause an insert or update in the db 
transaction, as it is a column_property, it will be settable. I'd like to 
not set the attribute by using class_mapper(Foo).iterate_properties and 
being able to determine that it was read_only. I do not ask lightly. I've 
read extensively and looked through the source code and come up blank. I 
also acknowledge that I wrote the model so I know it's read only - but I'd 
rather be lazy and get my update to do the work - after all, that is why 
I'm using such an excellent ORM.


 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/kFNDPpm3J9EJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to